Horde3D

Next-Generation Graphics Engine
It is currently 15.05.2024, 05:49

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 14.09.2009, 15:26 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
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.


Top
 Profile  
Reply with quote  
PostPosted: 14.09.2009, 19:19 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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.


Top
 Profile  
Reply with quote  
PostPosted: 15.09.2009, 09:28 
Offline

Joined: 16.05.2009, 12:43
Posts: 207
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.


Top
 Profile  
Reply with quote  
PostPosted: 15.09.2009, 20:37 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group