Page 4 of 6
Re: [NOESIS] Titan Quest
Posted: Fri Mar 09, 2012 8:57 pm
by finale00
That's a pretty big difference in indices they're storing...
Did you release any code?
Re: [NOESIS] Titan Quest
Posted: Fri Mar 09, 2012 9:07 pm
by Demonsangel
Not yet, both the .tex and .msh files are 1 big pile of unorganized code atm
I did get the triangles after rapi.constructmodel with Triangles = mdl.meshes[0].indices though, instead of the raw triangles.
Re: [NOESIS] Titan Quest
Posted: Fri Mar 09, 2012 9:55 pm
by finale00
Hmm that's interesting actually. I would've thought both methods should ideally produce the same results, given the same index buffer lol
Re: [NOESIS] Titan Quest
Posted: Fri Mar 09, 2012 10:04 pm
by Demonsangel
Ok so I corrected all the boneindices for the weights and turned it back into bytes using struct.pack
then called
Code: Select all
rapi.rpgBindBoneIndexBufferOfs(weightIdx, noesis.RPGEODATA_UBYTE, 4, 0, 4)
rapi.rpgBindBoneWeightBufferOfs(self.vertBuff, noesis.RPGEODATA_FLOAT, self.vertLength, self.boneWeightOffset, 4)
weightIdx = 6015 vertices * 4 indices length worth of bytes. I checked it and It has the correct length and data
self.vertBuff is the global buffer I also used for my UV/XYZ/normals so this should be correct , including the Offset.
This is called after my UV/XYZ/normal/tri's but before my
Code: Select all
mdl=rapi.rpgConstructModel()
if not mdl.meshes[0].weights: print("you fail")
mdl.setModelMaterials(NoeModelMaterials(self.texList, self.matList))
mdl.setBones(self.bones)
mdlList=[]
mdlList.append(mdl)
but nothing happens. What's the format for the weightList? I'll create it myself if needed.
Re: [NOESIS] Titan Quest
Posted: Fri Mar 09, 2012 10:25 pm
by MrAdults
Demonsangel wrote:Ok so I corrected all the boneindices for the weights and turned it back into bytes using struct.pack
rapi.rpgSetBoneMap is provided specifically so that you don't have to do that...
Demonsangel wrote:but nothing happens.
Make sure you're binding your vertex weight buffers before you actually commit the triangles. If you aren't seeing weight influences at all, you aren't doing things in the right order, or the data you're feeding in is invalid. I'm just assuming the order you're doing things in is likely to be the problem, because it was your problem with the materials, and I'm forced to make assumptions because you've only posted snippets of your whole script.
Demonsangel wrote:What's the format for the weightList? I'll create it myself if needed.
It's not needed. Using the rpg interface is cleaner, simpler, and more computationally efficient. (much the same as remapping bone indices in Python yourself is also far slower than using rpgSetBoneMap)
Re: [NOESIS] Titan Quest
Posted: Sat Mar 10, 2012 11:33 am
by Demonsangel
is rapi.rpgSetBoneMap able to hold 2 lists and how do I make the vertices pick the correct list?
In other words how do I put the info in the following image into a bonemap?
What is the index for "nobone" for noesis rpgBindBoneIndexBufferOfs? In the .msh a weight of 0 or an index of 0xFF means nobone, but I have been binding these to the rootbone instead.
And it seems something has to be wrong with the data because the order is right, but only the root bone(MOVEAXIS) and the 2 claviculae are being added to the skin modifier.
And since you want the full code: they're attached below.
I haven't rewritten it yet so it's a mess with a lot of redundant code.
https://www.dropbox.com/sh/7pn17bxhwo9gwgu/cORIt1nsc_
Re: [NOESIS] Titan Quest
Posted: Sat Mar 10, 2012 9:10 pm
by Demonsangel
How would I go about adding multi .msh file monsters?
For instance the automai has a body and a head. Both have a bone named "Bone_Neck01". How do I make these play nice?
As far as I can tell the Position info for the bone is the same, but the bone in the head.msh is "parented" to 1 which is root and I assume I'm supposed to 'update' the bonelist by just adding the new bone( Bone_head) to the already existing Bone_Neck01.
Tamschi, do you happen to know in what file the link is between both meshes? I assumed it's in the actual ingame monster data since there are 3 mesh files:(body + 2 heads) which allows for variety.
Re: [NOESIS] Titan Quest
Posted: Sat Mar 10, 2012 9:40 pm
by Tamschi
There's a Bone_Head in the body mesh too. I'm pretty sure you can just use the bones from the body mesh and only use the data from the attached mesh for the bone map.
It's the same with helmets and most armor. Weapons are attached to the AttachPoints from the text data instead.
Re: [NOESIS] Titan Quest
Posted: Sat Mar 10, 2012 10:55 pm
by Demonsangel
Then I have a look in how to import more than 1 mesh and make sure the torso goes in first.
Re: [NOESIS] Titan Quest
Posted: Sat Mar 10, 2012 10:58 pm
by chrrox
it should not matter what mesh gets imported first.
what i did for rumble roses which is the same is just import all the files in a folder.
then as you import the model you will have access to all the bones and won't have to create the bone that exists already again.
just on bone creation check if it exists before creating it and if it does exist just add it to your bone list instead of re creating it.
Re: [NOESIS] Titan Quest
Posted: Sat Mar 10, 2012 11:05 pm
by Demonsangel
I'll try that, though I need to seriously rewrite the script before I can do anything like that.
Thanks.
Re: [NOESIS] Titan Quest
Posted: Sun Mar 11, 2012 1:58 am
by MrAdults
You don't need 2 lists, it only applies to the current draw. You call rpgSetBoneMap for each draw every time you commit triangles. The list is a map that converts the per-vertex bone index to an index into the global bone list.
There should never be a vertex without a bone weight. If you want something that's static and not weighted to any part of the main skeleton, you should create a new bone for it outside of the main hierarchy and weight that static stuff to that, or just split it into a separate NoeModel with no skeleton. Or, don't bind vertex weight buffers at all, but that will require faces with no weights to be drawn in their own draw calls. No format should ever really be using static/boneless verts in the same mesh as weighted verts unless it's already internally assigning them to a bone/matrix with an assumed weighting of 1.0, because that would screw up any kind of shader/hardware transform path.
Re: [NOESIS] Titan Quest
Posted: Sun Mar 11, 2012 10:36 am
by Demonsangel
Not really vertices without any weights, but with boneindices like (10,255,255,255). I'm not sure if the weights for all the 255 are zero so it might try to add the vertex to a nonexisting bone along with the bone #10, unless Noesis treats 255 as nobone as well?
But I'll make it loop over the data first to see if it does this before I start worrying over this.
For the drawcalls, I'll split the triangle list into 2 (which should be easy) and commit them seperately, but what do I do with the vertex list, can I keep committing them as 1 big list?
Re: [NOESIS] Titan Quest
Posted: Sun Mar 11, 2012 1:07 pm
by chrrox
read them as signed numbers and the 255 will be -1 instead of 255.
Re: [NOESIS] Titan Quest
Posted: Sun Mar 11, 2012 1:45 pm
by Demonsangel
That's what I was doing at first but changed it back to normal.
While rewriting the script it seems rapi.multiplyBones doesn't position the bones correctly so I'm just going to rewrite my current function and if someone could take a look at it later it'd be much appreciated.
Edit:
https://www.dropbox.com/sh/7pn17bxhwo9gwgu/cORIt1nsc_
Updated the texture importer to correctly load all textures for each drawcall.
Vertex-Boneweight seems to be correct atm but I'm calling the bindboneIndex/Weight on the full vertex list
Code: Select all
rapi.rpgSetBoneMap(self.drawCallIndex[i])
rapi.rpgBindBoneIndexBufferOfs(self.vertBuff, noesis.RPGEODATA_UBYTE, self.vertLength, self.boneIndexOffset, 4)
rapi.rpgBindBoneWeightBufferOfs(self.vertBuff, noesis.RPGEODATA_FLOAT, self.vertLength, self.boneWeightOffset, 4)
rapi.rpgCommitTriangles(idxBuff, noesis.RPGEODATA_USHORT, numIdx*3, noesis.RPGEO_TRIANGLE, 1)
for each drawcall because I'm not sure how to cut the vertex list.
Also how would I go about loading bumpTextures?
which of the following is a bumptex?
Code: Select all
def setNormalTexture(self, texName):
def setSpecularTexture(self, texName):
def setOpacityTexture(self, texName):