Page 51 of 123

Re: Señor Casaroja's Noesis

Posted: Sun Feb 05, 2012 1:09 pm
by chrrox
instead of applying the faces as f1 f2 f3 do f1 f3 f2

Re: Señor Casaroja's Noesis

Posted: Sun Feb 05, 2012 8:07 pm
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.

Re: Señor Casaroja's Noesis

Posted: Sun Feb 05, 2012 8:32 pm
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)

Re: Señor Casaroja's Noesis

Posted: Sun Feb 05, 2012 9:22 pm
by MrAdults
No, changing the winding order should have no extra potential for crashing.

Re: Señor Casaroja's Noesis

Posted: Tue Feb 07, 2012 6:48 am
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.

Re: Señor Casaroja's Noesis

Posted: Tue Feb 07, 2012 8:32 am
by MrAdults
There's already an interface for assigning any shortcut you want to any menu item you want. View->Interface->Customize...

Re: Señor Casaroja's Noesis

Posted: Tue Feb 07, 2012 8:52 am
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.

Re: Señor Casaroja's Noesis

Posted: Wed Feb 08, 2012 2:56 am
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.

Re: Señor Casaroja's Noesis

Posted: Wed Feb 08, 2012 4:15 am
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.

Re: Señor Casaroja's Noesis

Posted: Wed Feb 08, 2012 1:57 pm
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.

Re: Señor Casaroja's Noesis

Posted: Wed Feb 08, 2012 10:43 pm
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.

Re: Señor Casaroja's Noesis

Posted: Fri Feb 10, 2012 12:38 am
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.

Re: Señor Casaroja's Noesis

Posted: Sat Feb 11, 2012 1:37 am
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.

Re: Señor Casaroja's Noesis

Posted: Sat Feb 11, 2012 9:45 pm
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.

Re: Señor Casaroja's Noesis

Posted: Sun Feb 12, 2012 12:58 am
by Arymond
The contents of this post was deleted because of possible forum rules violation.