|
|
« Reply #1455 on: June 14, 2011, 02:44:20 PM » |
|
Pachi's mdl0 is weird as heck. All the string offsets are nowhere near the string I was just guessing it had to do with bones because the error had to do with the string offset of a bone. So I was indeed RIGHT I CAME AT YOU BRO. WATCHA GONNA DO BOUT IT I'm also in a good mood BRO Btw apparently the TEVs are IN the Materials. I found that out while working on calculating the size of materials (which is done btw) it's all the string offsets... not just that one group...
I TOLD YOU!!!
*sigh* I guess we were both right in our own ways -_-*
but you were wrong about telling me to read the string offsets the same way as Brawl's v9 offsets...
now you see what I mean... *sigh*
also... TEV's are Material Nodes... Nodes are part of a material, but they can be used between materials...
they do similar work to shaders, but can't handle every specific task... you should listen to a game developer more often BJ ^_^ lol jk
IK you already do listen to me shoot... we share info like heck...
_________________________________________________ _________________________________________
What's the diff. between v9 and v11 MDL0's?
well: the MDL0 header v11 has extra group offsets v11 string offsets go past the end of the file (if read as v9)
also it's reported that bone data size is not always the same...
yea... there's quite a few differences...
btw... MDL0 versions range from v8 to v12... I havn't seen a v12 yet... but it's been reported...
|
|
« Last Edit: June 14, 2011, 02:45:48 PM by Tcll »
|
Logged
|
|
|
|
|
|
|
« Reply #1456 on: June 14, 2011, 02:54:36 PM » |
|
it's all the string offsets... not just that one group...
I TOLD YOU!!!
*sigh* I guess we were both right in our own ways -_-*
but you were wrong about telling me to read the string offsets the same way as Brawl's v9 offsets...
now you see what I mean... *sigh*
also... TEV's are Material Nodes... Nodes are part of a material, but they can be used between materials...
they do similar work to shaders, but can't handle every specific task... you should listen to a game developer more often BJ ^_^ lol jk
IK you already do listen to me shoot... we share info like heck...
Well a few of the v11 mdl0's I've opened worked fine reading the strings normally. So why the string offset would be different on most but not all v11 mdl0s is strange. I had assumed that the bone data length was longer than usual and possibly had a different header setup, but apparently not. It's just the offset... Now we have to figure out how to read it... And "Material Nodes" as you call them have their own spot in the mdl0. There's a very similar looking thing kryal calls TEVs inside the material itself, and each one is unique. The shader offset references outside of the material itself. It's kinda hard to explain but there are "Material Nodes" inside the material ALSO.
|
|
|
Logged
|
|
|
|
|
|
|
« Reply #1457 on: June 17, 2011, 06:20:56 AM » |
|
OMGOMGOMGOMG
see if you can guess what I've just figured out: http://lh5.ggpht.com/-2dCf4qOJNRc/TftEpDZ5WII/AAAAAAAADG4/1xdZ_32k6Sc/transforms.jpg
I'm so awsome and insainly happy
_________________________________________________ ___________________________________________
I forgot about the primitives in my last post added those and here's my function so far:
def setObject( ObjectID, ObjectName, ParentID, PrimitivesList, VectorsList, BonesList ): if VectorsList != '' and BonesList == '': vert = VectorsList[0] normal = VectorsList[1] UVs = [VectorsList[2],VectorsList[3],VectorsList[4],VectorsList[5],VectorsList[6],VectorsList[7],VectorsList[8],VectorsList[9]] trans_vert = VectorsList[10] trans_normal = VectorsList[11] trans_UVs = [VectorsList[12],VectorsList[13],VectorsList[14],VectorsList[15],VectorsList[16],VectorsList[17],VectorsList[18],VectorsList[19]]
error = 0 if ParentID == '': print 'Object has no parent' if vert != '': setVector( vert, 0, 0, ObjectID, 0 ) else: print 'ERROR: vector object has no Vertices'; error = 1 if error == 0: if normal != '': setVector( normal, 1, 0, ObjectID, 0 ) else: print 'Object has no Normals' if UVs != ['','','','','','','','']: for channel, UV in enumerate(UVs): setVector( UV, 2, 0, ObjectID, channel ) else: print "Object has no UV's" if trans_vert != '': setVector( trans_vert, 0, 1, ObjectID, 0 ) else: print 'Object has no Vertice Transforms' if trans_normal != '': setVector( trans_normal, 1, 1, ObjectID, 0 ) else: print 'Object has no Normal Transforms' if trans_UVs != ['','','','','','','','']: for channel, TUV in enumerate(trans_UVs): setVector( TUV, 2, 1, ObjectID, channel ) else: print "Object has no UV Transforms"
if PrimitivesList != '': setPrimitives( PrimitivesList, ObjectID ) else: print 'Object has no primitives
setBasicObject(ObjectID, ObjectName, ParentID) else: print 'ERROR: Object cannot be logged' if VectorsList == '' and BonesList != '': pass #TODO if VectorsList != '' and BonesList != '': print 'ERROR: object must not contain both vectors and bones'
yes, it's huge, and only 50% complete >_>
_________________________________________________ ___________________________________________
I have made progress
>>> setWrite() tmp set to write >>> setObject(0, 'test', '', [[[1,1,1],[1,1,1]],'','','','','','','','','','','','','','','','','','','',''], '' ) Object has no parent 'vertices' Vectors for object 0 logged successfully Object has no Normals Object has no UV's Object has no Vertice Transforms Object has no Normal Transforms Object has no UV Transforms Object "test" logged successfully >>> closeWrite() tmp sucessfully closed >>>
here's the TMP data:
< vertices 0 1.0|1.0|1.0/1.0|1.0|1.0 < object 0 test
EDIT: I've also implemented a few errors:
>>> setObject(0, 'test', '', ['','','','','','','','','','','','','','','','','','','','',''], '' ) Object has no parent ERROR: vector object has no Vertices ERROR: Object cannot be logged >>>
or
>>> setObject(0, 'test', '', ['','','','','','','','','','','','','','','','','','','','',''], [''] ) ERROR: object must not contain both vectors and bones >>>
_________________________________________________ ______________________________________
And "Material Nodes" as you call them have their own spot in the mdl0. There's a very similar looking thing kryal calls TEVs inside the material itself, and each one is unique. The shader offset references outside of the material itself. It's kinda hard to explain but there are "Material Nodes" inside the material ALSO. the TEV is a seperate block... it's called a shader in Brawlbox from my reserch on them, I've found structures that compare almost 100% to material nodes
materials themselves don't have nodes... you have to define a block and link them to the material
shaders are just an extension of the material... (they exist in every material block)
'Lambert' is a shader
|
|
|
Logged
|
|
|
|
|
|
|
« Reply #1458 on: June 17, 2011, 06:47:33 AM » |
|
add the bone matrix to the verts... that's it
I said this in the chat ages ago... I said transforms are mostly bone matricies.
|
|
|
Logged
|
Zephiel: You know what I really like on my stack smash? Texture updates.
Androu1: @Zephiel: “your†Stack Smash?
|
|
|
|
|
|
« Reply #1459 on: June 17, 2011, 06:54:10 AM » |
|
I said this in the chat ages ago...
I said transforms are mostly bone matricies.
yes... that you did >.>
didn't notice that because you didn't mention the verts XD
EDIT: how do I get the bone matrix for that vert??
and how come you don't come back to the chat ;_; we all miss you
|
|
« Last Edit: June 17, 2011, 06:56:35 AM by Tcll »
|
Logged
|
|
|
|
|
|
|
« Reply #1460 on: June 17, 2011, 07:30:47 AM » |
|
yes... that you did >.>
didn't notice that because you didn't mention the verts XD
EDIT: how do I get the bone matrix for that vert??
and how come you don't come back to the chat ;_; we all miss you
Chatango. There is delay with each letter, it's sickening. Get your website back up and I will probably be in the chat a little more.
|
|
|
Logged
|
Zephiel: You know what I really like on my stack smash? Texture updates.
Androu1: @Zephiel: “your†Stack Smash?
|
|
|
|
|
|
« Reply #1461 on: June 17, 2011, 07:36:47 AM » |
|
Chatango. There is delay with each letter, it's sickening. Get your website back up and I will probably be in the chat a little more.
I did mention is was back up... hehheh
http://tcll5850.hostoi.com
atm it's just the old page moved to the new server...
the new website is ballz to progrm DX
speaking of programming... I would have went insain if this didn't work:
>>> getObject(0) Object test successfully returned 'vertices' Vectors for object 0 returned sucessfully 'normals' Vectors for object 0 returned sucessfully 'uvs' Vectors for object 0 returned sucessfully 'uvs' Vectors for object 0 returned sucessfully 'uvs' Vectors for object 0 returned sucessfully 'uvs' Vectors for object 0 returned sucessfully 'uvs' Vectors for object 0 returned sucessfully 'uvs' Vectors for object 0 returned sucessfully 'uvs' Vectors for object 0 returned sucessfully 'uvs' Vectors for object 0 returned sucessfully 'vertices' Transform vectors for object 0 returned sucessfully 'normals' Transform vectors for object 0 returned sucessfully 'uvs' Transform vectors for object 0 returned sucessfully 'uvs' Transform vectors for object 0 returned sucessfully 'uvs' Transform vectors for object 0 returned sucessfully 'uvs' Transform vectors for object 0 returned sucessfully 'uvs' Transform vectors for object 0 returned sucessfully 'uvs' Transform vectors for object 0 returned sucessfully 'uvs' Transform vectors for object 0 returned sucessfully 'uvs' Transform vectors for object 0 returned sucessfully Primitives for object 0 successfully returned ('test', '', [[[['1.0', '1.0', '1.0'], ['1.0', '1.0', '1.0']], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []], []], []) >>>
took an ungodly amount of thought process >:O the session above doesn't return anything... that's just to let you know the functions worked...
yes, every line is a seperate function
|
|
|
Logged
|
|
|
|
|
|
|
« Reply #1462 on: June 17, 2011, 08:41:46 AM » |
|
So, what do you have to do now, bones? And what after that?
|
|
|
Logged
|
FC: 2191-7379-6272
|
|
|
|
|
|
« Reply #1463 on: June 17, 2011, 09:34:16 AM » |
|
So, what do you have to do now, bones? And what after that?
well first off, I have to catch up code-wise
but I'm nearly at the bones and weights, after the bones I'll be able to start on the materials and shaders
then it's the nodes and textures
only then should I actually be finished I think >.>
I may have missed a few things...
|
|
|
Logged
|
|
|
|
|
|
|
« Reply #1464 on: June 17, 2011, 11:08:19 AM » |
|
not what BJ said: vert*matrix=value+vert=actual_vert ^nope :3
I didn't SAY that, that's what KRYAL put in his CODE Here it is: public Vector3 Multiply(Vector3 v) { Vector3 nv = new Vector3(); fixed (float* p = _values) { nv._x = (p[0] * v._x) + (p[4] * v._y) + (p[8] * v._z) + p[12]; nv._y = (p[1] * v._x) + (p[5] * v._y) + (p[9] * v._z) + p[13]; nv._z = (p[2] * v._x) + (p[6] * v._y) + (p[10] * v._z) + p[14]; } return nv; } v is the raw vertex position. nv is the weighted vertex position. p is the array of 16 values in the bone matrix that the vertex is influenced by. ...I need to figure out how to reverse this btw
|
|
« Last Edit: June 17, 2011, 11:20:46 AM by BlackJax96 »
|
Logged
|
|
|
|
|
|
|
« Reply #1465 on: June 18, 2011, 12:49:52 AM » |
|
Re did the algebra, try this: ( wv.x - (rv.y * m[1]) - (rv.z * m[2]) - m[4] ) / m[0] = rv.x
|
|
« Last Edit: June 18, 2011, 08:55:59 PM by VILE »
|
Logged
|
Zephiel: You know what I really like on my stack smash? Texture updates.
Androu1: @Zephiel: “your†Stack Smash?
|
|
|
|
|
|
« Reply #1466 on: June 18, 2011, 05:09:10 AM » |
|
hey VILE :/ what are all the values of a matrix??
I tried looking it up... twice...
the best result I got was: X - 1,0,0,0 Y - 0,1,0,0 Z - 0,0,1,0 W - 0,0,0,1
and then add the values across for the result...
this don't quite work for brbx as the values there (if you stacked them) are: W Z Y X | | | | (1,0,0,0), (0,1,0,0), (0,0,1,0), (0,0,0,1)
anyways... so I need some good notes on a matrix :/
|
|
|
Logged
|
|
|
|
|
|
|
« Reply #1467 on: June 18, 2011, 08:28:57 AM » |
|
hey VILE :/ what are all the values of a matrix??
I tried looking it up... twice...
the best result I got was: X - 1,0,0,0 Y - 0,1,0,0 Z - 0,0,1,0 W - 0,0,0,1
and then add the values across for the result...
this don't quite work for brbx as the values there (if you stacked them) are: W Z Y X | | | | (1,0,0,0), (0,1,0,0), (0,0,1,0), (0,0,0,1)
anyways... so I need some good notes on a matrix :/
We already talked in chat about all this stuff, but just to post it here for anyone else who wants to know. 3F800000 00000000 00000000 3FC78D50 00000000 3F800000 00000000 4176C5F8 00000000 00000000 3F800000 BED0A3D6 Above is what the typical bone matrix looks like, 12 standard 32bit float values. ---------------------------------------------------------------------------------------------------- 1 0 0 1.559000015258789 0 1 0 15.423332214355469 0 0 1 -0.4074999690055847 This is what it looks like converted. ---------------------------------------------------------------------------------------------------- x - 1 0 0 1.559000015258789y - 0 1 0 15.423332214355469z - 0 0 1 -0.4074999690055847A breakdown of what these values determine: Red = The iterations of the raw vertex's x position used to calculate the weighted vertex position.Green = The iterations of the raw vertex's y position used to calculate the weighted vertex position.Blue = The iterations of the raw vertex's z position used to calculate the weighted vertex position.Yellow = The additional amount added to total generated by red, green and blue, to make the weighted vertex's position.---------------------------------------------------------------------------------------------------- To apply the transforms with these values, this procedure must be followed: weightedVert.x = (rawVert.x * matrix[0]) + (rawVert.y * matrix[1]) + (rawVert.z * matrix[2]) + matrix[4] weightedVert.y = (rawVert.x * matrix[5]) + (rawVert.y * matrix[6]) + (rawVert.z * matrix[7]) + matrix[8] weightedVert.z = (rawVert.x * matrix[9]) + (rawVert.y * matrix[10]) + (rawVert.z * matrix[11]) + matrix[12] ---------------------------------------------------------------------------------------------------- Just thought I should post this so other people can read over it and so I don't forget (haven't archived any of this and I'm pretty tired).
|
|
« Last Edit: June 18, 2011, 08:53:07 PM by VILE »
|
Logged
|
Zephiel: You know what I really like on my stack smash? Texture updates.
Androu1: @Zephiel: “your†Stack Smash?
|
|
|
|
|
|
« Reply #1468 on: June 18, 2011, 01:17:18 PM » |
|
Yo BlackJax96, try these:
v = Raw vertex position p[] = Bone matrix
v._x = -((v._y * p[4]) - (v._z * p[8]) - p[12]) / p[0] v._y = -((v._x * p[0]) - (v._z * p[8]) - p[12]) / p[4] v._z = -((v._x * p[0]) - (v._y * p[4]) - p[12]) / p[8]
or
v._x = -((v._y * p[5]) - (v._z * p[9]) - p[13]) / p[1] v._y = -((v._x * p[1]) - (v._z * p[9]) - p[13]) / p[5] v._z = -((v._x * p[1]) - (v._y * p[5]) - p[13]) / p[9]
or
v._x = -((v._y * p[6]) - (v._z * p[10]) - p[14]) / p[2] v._y = -((v._x * p[2]) - (v._z * p[10]) - p[14]) / p[6] v._z = -((v._x * p[2]) - (v._y * p[6]) - p[14]) / p[10]
----------------------------------------------------------------------------------------------------
I just did some simple algebra to reverse the equation, I only tested the first 3, but they should all work.
None of them worked :/ - I need to get from the weighted position to the raw position. Where is the weighted position in those equations...? - This is the matrix in brawlbox, just so you know: 0, 4, 8, 12 = X 1, 5, 9, 13 = Y 2, 6, 10, 14 = Z 3, 7, 11, 15 = W
|
|
« Last Edit: June 18, 2011, 01:18:10 PM by BlackJax96 »
|
Logged
|
|
|
|
|
|
|
« Reply #1469 on: June 18, 2011, 01:58:19 PM » |
|
from what VILE discussed with me... there's only one logical way I can see to do this:
nv._x = (p[0] * v._x) - (p[4] * v._y) - (p[8] * v._z) - p[12]; nv._y = (p[1] * v._x) - (p[5] * v._y) - (p[9] * v._z) - p[13]; nv._z = (p[2] * v._x) - (p[6] * v._y) - (p[10] * v._z) - p[14];
there would be no division...
if it's not that, then shoot me XD
EDIT: btw, I think I finally understand C-type coding and the reason you get inverse values when reading
the way it reads would basically be:
returned_value = '' file = list('MDL0') #['M','D','L','0'] for byte in file: value += byte print returned_value
>>> 0LDM
where: file would be the file you're reading from byte would be the current byte the program is on and returned_value is, in all obviousness, the returned value being read
so that's a simple python program that reads like a C-type compiler
python actually returns the value as it looks in the file
|
|
« Last Edit: June 18, 2011, 02:20:03 PM by Tcll »
|
Logged
|
|
|
|
|
|