Horde3D
http://horde3d.org/forums/

Getting a list of post-transformed vertices
http://horde3d.org/forums/viewtopic.php?f=1&t=945
Page 1 of 1

Author:  zoombapup [ 14.09.2009, 15:26 ]
Post subject:  Getting a list of post-transformed vertices

Hi guys.

Ok, I've been having some issues with a complicated world mesh and it not squaring up with my navmesh of the same data. Then it occurred to me that the collada file and subsequent scene files essentially include multiple mesh objects within a model. This has the knock-on effect that the meshes within a model have transforms applied to them. My navmesh library expects world space vertex positions for all meshes as an indexed array.

So my question is, is there an easy way to get post-transformed vertex buffer for a given model? Or am I going to have to essentially render the meshes within a model node into my own buffer?

Ta,

Phil.

Author:  marciano [ 14.09.2009, 19:19 ]
Post subject:  Re: Getting a list of post-transformed vertices

Hi Phil,

Horde supports transformations for meshes and even hierarchies of meshes. The mesh transformation is applied to the vertex data on the fly in the vertex shader. This is necessary to support rigid mesh animations in an efficient way. The only way to get the vertices in world space for your library is to transform them yourself. This is just a matrix multiplication for every vertex.

However, the quicker solution in your case is probably to just not use that mesh transformation feature. In 3ds max you can apply the Reset XForm script to your geometry. This should bake the transformation into the vertex positions so that the meshes have an identity transformation matrix. That way you can directly use the vertex data as input for your navmesh lib.

Author:  zoombapup [ 15.09.2009, 09:28 ]
Post subject:  Re: Getting a list of post-transformed vertices

Hmm, right, I'll give that a try. I never knew what that Reset XForm did, everyone told me to use the "box trick" :)

But either way, yes your probably right, easier to fix the input mesh than faffing about trying to transform all the geometry etc. I'll give it a go and see if it makes any difference.

Author:  marciano [ 15.09.2009, 20:37 ]
Post subject:  Re: Getting a list of post-transformed vertices

Please let me know if that works as expected.

Just to make that clear, the manual transformation is not too hard either. Get the absolute matrix of the mesh (which incorporates all parent transformations) using h3dGetNodeTransMats and multiply the vertex positions with that matrix. That's it.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/