#72834 - Webez - Wed Feb 22, 2006 1:29 am
Hi.
Does someone have an example of how to load 8 bit textures?
And a light example (the one in the examples folder doesn't work for me)?
As for the second thing. I have implemented a milkshape loader including bones. It works (even animations) but it is too slow (i think 15 fps without animations and 10 fps with them) because each time that vertex have to be drawn they have to multiplied (a lot of work). I would like to change things so I can just tranform them with the model matrix multiplied by each bone absolute matrix. Someone can help me or point in the right direction (I am very bad at matrix and vector maths)? (Quite bad explanation but someone who knows about this should understand... or so I hope)
Thanks!
#73043 - Webez - Wed Feb 22, 2006 11:42 pm
http://www.4shared.com/file/857698/31ffbfc1/bones.html
I have uploaded a demo that shows the current state of the ms3d loader. One transforms each vertex each time it has to be drawn. As it can be seen fps are awful because of this operations. The second one uses the modelview matrix multplied by the final matrix of each bone. The problem with this is that then I have to group polygons by their bone. But a polygon has 3 vertex and each one can be relative to a different bone. So they can be first tranformed by the inverse of one matrix and then multplied by another (the one I select for the group) . So the model gets screwed. Is it impossible to group polygons by bone? Then how can display lists be made?
Thanks!
#73163 - ishraam - Thu Feb 23, 2006 6:22 pm
I have exactly the same pbm -_-.
#73170 - Webez - Thu Feb 23, 2006 7:08 pm
So close, so far
#73172 - ecurtz - Thu Feb 23, 2006 7:34 pm
I'm hardly a 3D expert, but I think the problem is you're treating the polygons as though they are attached to the bones rather than the vertices. You can change the matrix between vertices of the same polygon if you need to.
#73176 - Webez - Thu Feb 23, 2006 7:56 pm
So you say something like this?
glBegin(GL_TRIANGLES);
for (all poligons){
matrix=bone[vertexA.bone].matrix;
pushmatrix()
glmultmatrix(matrix)
glvertex(vertexA.x,vertexA.y,vertexA.z)
popmatrix()
....... (the same for vertexA and vertexB)
}
glEnd();
I thought you could only could pushmatrix before glBegin not inside. Even I think I tried that (I am really trying everything). I'll try again with that and see what happens.
But if I do that it is impossible to use display lists.
#73183 - ishraam - Thu Feb 23, 2006 8:45 pm
ecurtz : I am treating the vertices as attached to bones, but I FEAR the impact of loading for each vertice its bone matrix. So I intended to minimize the number of time I load a matrix, hence grouping verts by bone.
The problem is you draw faces not verts. I mean a triangle to be drawn has to "send its vertices to the hardware". So it's not "grouping verts by bone" but "grouping faces by bone" (even if in fact its the verts that are linked to bones, yeah). Which is not quite possible AFAIK - except if you affect a "submesh" to a bone, but what about elbows, knees, etc. ?
Webez: using display list might still be possible, providing they're a little bit dynamic. The only condition would be that the matrices specified in the display lists are reevaluated each time a display list is used.
That would allow to update the bone matrices, and have them properly used in the rendering process.
#73184 - ecurtz - Thu Feb 23, 2006 9:06 pm
Sorry, I thought you were talking about the case using display lists. In that case you can do the following.
Calculate the matrix for each bone and MatrixStore it in the matrix stack.
Embed MatrixRestore commands into your display list when the active bone changes.
Dump the display list onto hardware.
This requires exporting the data into DS specific formats, but it dramatically reduces the amount of calculation you're doing at runtime (which is good.)
ishraam - have you tried using MatrixStore/MatrixRestore instead of MatrixPop/MatrixPush? i.e. Put all the matrices onto the stack before glBegin and change the active one. I THINK that should work.