Important information: this site is currently scheduled to go offline indefinitely by end of the year.

Spotlight: Señor Casaroja's Noesis

General game file tools that are useful for more than one game
chrrox
Moderator
Posts: 2602
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1422 times

Re: Señor Casaroja's Noesis

Post by chrrox »

instead of applying the faces as f1 f2 f3 do f1 f3 f2
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 505 times

Re: Señor Casaroja's Noesis

Post by MrAdults »

You don't generally want to touch vertex coordinates if you're just trying to change triangle winding order. If you're using rpgCommitTriangles then you can just use rapi.rpgSetOption(noesis.RPGOPT_TRIWINDBACKWARD, 1) before you call it and it will reverse the triangle winding.
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: 307 times

Re: Señor Casaroja's Noesis

Post by finale00 »

Are there any cases where it is actually bad to change the winding order? (eg: something goes wrong and the faces aren't drawn correctly and maybe crashes occur)
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 505 times

Re: Señor Casaroja's Noesis

Post by MrAdults »

No, changing the winding order should have no extra potential for crashing.
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: 307 times

Re: Señor Casaroja's Noesis

Post by finale00 »

Can you add some GUI shortcuts? lol
Like ctrl+O to open a file, ctrl+R to reload a model, ctrl+W to close a model, etc.
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 505 times

Re: Señor Casaroja's Noesis

Post by MrAdults »

There's already an interface for assigning any shortcut you want to any menu item you want. View->Interface->Customize...
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: 307 times

Re: Señor Casaroja's Noesis

Post by finale00 »

lol cool.
Was this in the docs? (I don't read docs)

I guess I should, since there's information about making plugins that may be relevant. The last point in the plugin making section sounds like something that would be awesome if someone tried adding support for yet another scripting language.
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 505 times

Re: Señor Casaroja's Noesis

Post by MrAdults »

finale00 wrote:Was this in the docs? (I don't read docs)
This explains a great many of your questions. :) But no, I don't think I mentioned that feature in the docs anywhere. I did write the docs to be read, though, and they tend to be sprinkled with various useful tidbits. I'll also occasionally be a worthless bum and put usage info in the "what's new" section when I add features, though, which makes it virtually impossible to find that info another 20-30 releases down the line. There will be proper documentation one day. Unless I die before I write it, which becomes an increasingly likely scenario as I continue to put it off.
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: 307 times

Re: Señor Casaroja's Noesis

Post by finale00 »

Queen's blade topic updated with script + models.
String parsing is getting quite difficult for me.

For example in that game, a lot of the materials reference tex paths that contain korean characters mixed with normal ascii characters.

So for example you might have the following path
d:\work\pc\엔진\pc\커스터마이징\punisher-눈,입술커스텀\ingamedata\pu\..\tex\pu_fc_n_01.dds
Stored as

Image

I don't know how to deal with these.
I would usually just let python deal with it when I'm reading them as normal text, but converting it from bytes would cause problems.

Some methods I had considered:

-just use korean encoding. But it's not all korean...
-try to parse it somehow. Complicated.
-ignore it

I've posed a question on stackoverflow regarding string parsing so maybe I'll find a temp solution for it.
howfie
double-veteran
double-veteran
Posts: 929
Joined: Fri Jul 08, 2011 12:06 pm
Location: Torrance, CA
Has thanked: 10 times
Been thanked: 274 times

Re: Señor Casaroja's Noesis

Post by howfie »

if i recall right there is an algorithm for it where you check the bits and determine if you need to read another character or not. read it a character at a time. if it's greater than 0x7F, read the next character too and then append a crap ascii character to your string like 'x' or something. you should get something like

Code: Select all

d:\work\pc\xx\pc\xxxxxxxxxxxx\punisher-xx,xxxxxxxxxx\ingamedata\pu\..\tex\pu_fc_n_01.dds
stop when you encounter a 0x00 and then extract filename without path. of course this works only if korean unicode character is < 0x7FF. If first character is actually greater than 0xC0 and second character is greater than 0x7F, then you have to skip 3 characters and replace it with one 'x'.

try the first one to see if it works with all filenames.

you could also just read as ascii string until you reach 0x00 and then strip the path as the actual filenames don't appear to use korean. just do whatever's fastest for you cuz we have a bunch of horny bastards here who just want to see some titties :dance: lol.
User avatar
Dinoguy1000
Site Admin
Posts: 786
Joined: Mon Sep 13, 2004 1:55 am
Has thanked: 154 times
Been thanked: 163 times

Re: Señor Casaroja's Noesis

Post by Dinoguy1000 »

That looks to me like Unicode (specifically UTF-8), so any string functions that can handle Unicode strings should be able to handle it just fine, no need for convoluted parsing or anything.
Welcome to Xentax!

Rules | Requests | Wiki | Discord

If you run across a post that breaks the rules, please report the post - a mod or admin will handle it from there.
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: 307 times

Re: Señor Casaroja's Noesis

Post by finale00 »

I've tried encoding it as UTF-8 but it just says that some bytes fall outside of the UTF-8 range.
Hmm.

Regarding "effects" that usually come in games, like the shiny glows that swirl around your shiny weapons and armor, is it possible to show those in noesis? I think they call it "particles" or something.
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 505 times

Re: Señor Casaroja's Noesis

Post by MrAdults »

Yeah, the string you pasted showed things outside of the UTF8 range. What I said earlier only applied for unicode strings that don't go outside of the UTF8 range. Because it does, if you want to treat it as a multibyte string, your only choice is to do something like what howfie suggested. You should still be able to use all 8 bits of encoding, though, if you want, so you can just zero out the top byte in every character and you should eliminate the decoding error. (although you'll of course lose the actual unicode characters in the string)

Internally Noesis uses kind of a horrible hack (keep in mind, this codebase does have a legacy extending over 10 years, and is full of unfathomable horrors in every corner) where I'll use | to encode wide chars in multibyte filename strings. So |FFFF would get parsed out in the conversion back to unicode as a single character representing 0xFFFF. But this approach probably wouldn't be useful to you for what you're trying to do.

If you're mostly worried about the dirtiness, I can provide you a generic "Convert widechar to multibyte" function that forcefully eliminates anything outside of the UTF8 range without concern for preserving genuine wide characters.

On the note of particles...not really. You could sort of create your own particle system by hand-animating a bunch of bones and attaching "particle" meshes to them or by using vertex morphs/animations to move your system. But there isn't an "orient to the view" flag. If you really need that, though, I can add it for you. I'd probably give you a series of "ORIENT_ON_X"/"ORIENT_ON_Y"/etc. flags and then just match the geometry to the view axis on the axis specified by the flag. I also have a nice little portable particle system that I could shove into Noesis, although you'd have to script your own particles to use it, so I guess how useful it would be depends on what you're really trying to accomplish. If you just want to make sprite blobs on models orient to the view then an actual particle system would be totally overkill.
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: 307 times

Re: Señor Casaroja's Noesis

Post by finale00 »

RESOLVED

I'm not too interested in particles.
String-parsing seems rather tricky.

I've noticed something strange when taking a single model with multiple meshes and trying to load them as separate meshes so that you can cycle through them.

I parse the file and store the vertex and index buffers in a list.

Then after parsing is done, for each set of vert and index buffers, I clear buffer binds to clean anything the previous iteration, bind the vertex buffers and commit the triangles, then constructModel, apply materials, and append it to the mdlList.

Code: Select all

def noepyLoadModel(data, mdlList):
    '''Build the model, set materials, bones, and animations. You do not
    need all of them as long as they are empty lists (they are by default)'''
    
    ctx = rapi.rpgCreateContext()
    parser = SanaeParser(data)
    parser.parse_file()
    
    for i in range(len(parser.vertBuffs)):
        vertBuff, numVerts = parser.vertBuffs[i]
        idxBuff, numIdx, matNum = parser.idxBuffs[i]
        matName = parser.matList[matNum].name

        rapi.rpgClearBufferBinds()
        rapi.rpgBindPositionBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 0)
        rapi.rpgBindNormalBufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 12)
        rapi.rpgBindUV1BufferOfs(vertBuff, noesis.RPGEODATA_FLOAT, 32, 24)        
        
        rapi.rpgSetMaterial(matName)
        rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx, noesis.RPGEO_TRIANGLE, 1)    
        
        mdl = rapi.rpgConstructModel()
        
        mdl.setModelMaterials(NoeModelMaterials(parser.texList, parser.matList))
        #mdl.setBones(parser.boneList)
        #mdl.setAnims(parser.animList)
        mdlList.append(mdl)
    return 1
When I look at the data viewer, I see the first model has the mesh 0 as expected.
The second model has the mesh 0 and mesh 1
The third model has mesh 0, mesh 1, and mesh 2.

The code looks like it should be loading one mesh per model.
What am I doing wrong?

Also, I'd like default UI shortcuts. I think it's more user-friendly, especially when I move around to different machines and stuff. Then I don't have to set up what I usually have, which are just window defaults for things like closing the current instance, opening a file, etc.
Last edited by finale00 on Sun Feb 19, 2012 6:27 am, edited 5 times in total.
Arymond
advanced
Posts: 54
Joined: Sun Feb 12, 2012 12:49 am
Has thanked: 6 times
Been thanked: 1 time

Re: Señor Casaroja's Noesis

Post by Arymond »

The contents of this post was deleted because of possible forum rules violation.
Post Reply