Spotlight: Señor Casaroja's Noesis

General game file tools that are useful for more than one game
Demonsangel
mega-veteran
mega-veteran
Posts: 241
Joined: Fri Aug 05, 2011 9:31 pm
Location: Antwerp
Has thanked: 13 times
Been thanked: 41 times

Re: Señor Casaroja's Noesis

Post by Demonsangel »

I am at a loss here. I was busy rewriting my Titan Quest script when I ran into some weirdness with the bones. Instead of harassing MrAdults with about a dozen pm's a day I'll put it here incase someone else might be able to help.

Old code:

Code: Select all

    def Bones(self):
        self.data.seek(4,1)
        numBones    = self.data.readUInt()
        self.bones  = []
        for i in range( numBones):
            bone = {'name' : noeStrFromBytes(self.data.readBytes(32))}
            bone['index']       = i
            bone['child']       = self.data.readUInt()
            bone['numChild']    = self.data.readUInt()
            boneBuff=self.data.readBytes(48)
            
            (a1,a2,a3),(a4,a5,a6),(a7,a8,a9),(x,y,z) = NoeMat43.fromBytes(boneBuff)
            
            tupl=(a1,a2,a3,0),(a4,a5,a6,0),(a7,a8,a9,0),(x,y,z,1)
            
            bone['matrix'] = NoeMat44(tupl)
            self.bones.append(bone)
        for bone in self.bones:
            for i in range( bone['numChild']):
                child = bone['child'] + i
                self.bones[child]['parent'] = bone['index']
                
        for bone in self.bones:
            if not 'parent' in bone:
                bone['parent'] = -1
            else:
                matrix = bone['matrix']
                parent = self.bones[ bone['parent']]['matrix']
                bone['matrix'] = matrix.__mul__(parent)
                m = bone['matrix'].mat44
        for bone in self.bones:
            m = bone['matrix'].mat44
            k=[0,0,0,0]
            for t in range(len(m)):
                k[t] = NoeVec3(m[t][:-1])
            bone['matrix'] = NoeMat43(list(k))
            self.boneList.append(NoeBone(bone['index'],
                                         bone['name'],
                                         bone['matrix'],
                                         None,
                                         bone['parent']))
        
        return
new code:

Code: Select all

    def Bones(self):
        self.data.seek(4,1)
        numBones    = self.data.readUInt()
        self.bones  = []
        for i in range( numBones):
            bone = {'name' : noeStrFromBytes(self.data.readBytes(32))}
            bone['index']       = i
            bone['child']       = self.data.readUInt()
            bone['numChild']    = self.data.readUInt()
            bone['matrix']      = NoeMat43.fromBytes(self.data.readBytes(48))
            self.bones.append(bone)
        
        for bone in self.bones:
            for i in range( bone['numChild']):
                child = bone['child'] + i
                self.bones[child]['parent'] = bone['index']
        
        for bone in self.bones:
            if not 'parent' in bone:
                bone['parent'] = -1
            else:
                matrix = bone['matrix']
                parent = self.bones[ bone['parent']]['matrix']
                bone['matrix'] = matrix.__mul__(parent)
                #bone['matrix'] = bone['matrix'].transpose()
                m = bone['matrix'].mat43
            self.boneList.append(NoeBone(bone['index'],
                                         bone['name'],
                                         bone['matrix'],
                                         None,
                                         bone['parent']))
        
        #self.boneList = rapi.multiplyBones(self.boneList)
Old code:
Image

new code:
Image

According to me I'm basically doing the same, but I must be missing some detail.

Edit: updated old code to more readable version
howfie
double-veteran
double-veteran
Posts: 929
Joined: Fri Jul 08, 2011 12:06 pm
Location: Torrance, CA
Has thanked: 10 times
Been thanked: 273 times

Re: Señor Casaroja's Noesis

Post by howfie »

hey rich, how does noesis handle morton ordering with non-power of two and non-rectangular textures? reason i'm asking is that in resident evil 6 PS3 there are 20 type 0x28 textures. most are square and look great when using morton algorithm, but the other non-square ones crash cuz dilate algorithm, which uses bitmasks, returns an invalid index. do you just pad to power of two and square?
fierce
advanced
Posts: 41
Joined: Mon Jul 16, 2012 12:18 pm
Has thanked: 14 times

Re: Señor Casaroja's Noesis

Post by fierce »

Is there any way to make Noesis open a file using a custom script instead of the default? (From a game that is already partially supported). I've been changing the file extension but it would be great if I didn't have to do that.
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 303 times

Re: Señor Casaroja's Noesis

Post by finale00 »

I haven't seen a way to do something like "select plugin to load file with", but if it isn't already built-in that would be a useful tool to write. Maybe I'll write one to take a look at the tool API.
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 504 times

Re: Señor Casaroja's Noesis

Post by MrAdults »

howfie wrote:hey rich, how does noesis handle morton ordering with non-power of two and non-rectangular textures? reason i'm asking is that in resident evil 6 PS3 there are 20 type 0x28 textures. most are square and look great when using morton algorithm, but the other non-square ones crash cuz dilate algorithm, which uses bitmasks, returns an invalid index. do you just pad to power of two and square?
Square shouldn't matter, but when it's not power of 2, PS3 and PSP Morton implementations will both have padding. If the format doesn't have it built into the data (which would be unusual, but it's possible), you should still add it in-memory.
fierce wrote:Is there any way to make Noesis open a file using a custom script instead of the default? (From a game that is already partially supported). I've been changing the file extension but it would be great if I didn't have to do that.
There's no way to do that at the moment.
howfie
double-veteran
double-veteran
Posts: 929
Joined: Fri Jul 08, 2011 12:06 pm
Location: Torrance, CA
Has thanked: 10 times
Been thanked: 273 times

Re: Señor Casaroja's Noesis

Post by howfie »

on image export, can you add switches to apply 2-dilate and 3-dilate morton to an image? thanks!
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 504 times

Re: Señor Casaroja's Noesis

Post by MrAdults »

You can write a tool script to do it. :) See the Gaussian blur example on the plugins repo, you can basically copy that and run morton2d over the image instead of the Gaussian function.
howfie
double-veteran
double-veteran
Posts: 929
Joined: Fri Jul 08, 2011 12:06 pm
Location: Torrance, CA
Has thanked: 10 times
Been thanked: 273 times

Re: Señor Casaroja's Noesis

Post by howfie »

what? me? write code? :) morton is fairly common enough where it should be worthy of its very own checkbox in Noesis! j/k i'll check the guassian thing out in the meantime... thanks.
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 504 times

Re: Señor Casaroja's Noesis

Post by MrAdults »

Oh, there is already a Morton function for you in the API. It's just not a command line processing option, since 99% of the time it's the format that dictates the need for it and not something the user would manually invoke.
howfie
double-veteran
double-veteran
Posts: 929
Joined: Fri Jul 08, 2011 12:06 pm
Location: Torrance, CA
Has thanked: 10 times
Been thanked: 273 times

Re: Señor Casaroja's Noesis

Post by howfie »

i know what you meant; i was just joking about having to even write one line of code lol.
fierce
advanced
Posts: 41
Joined: Mon Jul 16, 2012 12:18 pm
Has thanked: 14 times

Re: Señor Casaroja's Noesis

Post by fierce »

I have 2 UV coordinates on my models, one for diffuse map (I'm sure) and one for specular map (I'm almost sure).
I see that Noesis has the option to add UV2's, but what do they refer to? The lightmap?
Is the lightmap the same as specular map? Or at least can it be used for that?
If not is there any way I can make Noesis use the second UV for the specular map? I see that I can set the specular texture on the material, but how to I assign the second UV's instead of the first ones for that texture?

Thank you in advance for any help
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 504 times

Re: Señor Casaroja's Noesis

Post by MrAdults »

I would make an additional mesh and give it the proper uv's, setting its blend mode to additive. (which will apply the lighting model with your second set of uv's additively on top of your diffuse mesh)
Kaem
beginner
Posts: 27
Joined: Tue May 22, 2012 10:28 pm
Has thanked: 2 times
Been thanked: 3 times

Re: Señor Casaroja's Noesis

Post by Kaem »

Hi.
You could think about doing something with the modding of The Legend Of Zelda Ocarina of Time?

There is a tool called Utily of Time, but it is out of date (2010),

http://code.google.com/p/uot/

Image

With this tool I can open the ROM and then see all the models and animations
The big error is that models cannot be exported.

It would be nice that NOESIS could import this .rom or the format of the models, .zobj.

Is possible?

Thanks.
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 504 times

Re: Señor Casaroja's Noesis

Post by MrAdults »

Noesis 4.0 is out.
https://twitter.com/DickWhitehouse/stat ... 7523981313
I finally added FF12. Thanks to revelation for all of his notes and feedback in the process.

There's also a new material expression system, which is kind of a big thing, but only plugin/script developers will care. Some example expressions:

Code: Select all

				noeMat->expr = rapi->Noesis_AllocMaterialExpressions(NULL);
				//vertex bulge effect
				noeMat->expr->v_posExpr[0] = rapi->Express_Parse("vert_pos_x + vert_nrm_x*0.05*abs(sin(time*0.001 + vert_idx*0.1))");
				noeMat->expr->v_posExpr[1] = rapi->Express_Parse("vert_pos_y + vert_nrm_y*0.05*abs(sin(time*0.001 + vert_idx*0.1))");
				noeMat->expr->v_posExpr[2] = rapi->Express_Parse("vert_pos_z + vert_nrm_z*0.05*abs(sin(time*0.001 + vert_idx*0.1))");
				//texture scrolling
				noeMat->expr->uvTrans[1] = rapi->Express_Parse("0.1 * sin(time*0.001)");
				//texture animation
				noeMat->expr->texIdx = rapi->Express_Parse("min(floor(mod(time*0.001, mdl_numtex)), mdl_numtex-1)");
				//per-vertex fogging
				noeMat->expr->v_clrExpr[0] = rapi->Express_Parse("1.0-max(min((vlen(vert_pos_x-view_x, vert_pos_y-view_y, vert_pos_z-view_z)-1.5) / 1.0, 1.0), 0.0)");
				noeMat->expr->v_clrExpr[1] = noeMat->expr->v_clrExpr[2] = noeMat->expr->v_clrExpr[0];
That's C code, but expressions are exposed to Python in the NoeMaterial as well (see the new functions for setting them), and their syntax is the same. See pluginshare.h in pluginsource.zip for a list of expression functions and variables. You also have the ability to register your own custom expression functions in native code, but I figured all those callbacks (from interpreted expression land to native land to Python native land to Python and back again) would add so much overhead that advanced expression usage like that is better left to native plugins.
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 303 times

Re: Señor Casaroja's Noesis

Post by finale00 »

What is a material expression? lol google didn't seem to give anything. Is it a common concept?
Last edited by finale00 on Sun Dec 16, 2012 5:05 am, edited 2 times in total.
Post Reply