Applying transformations to meshes

jjerry

Newcomer
Joined
Oct 3, 2005
Messages
7
Is there a way to apply an affine transformation to an entire mesh, I looked but couldn't find any methods that seemed to do the job. What I mean is - I don't want to use Device.Transform.World matrix anymore to transform the mesh at render time, I'd rather transform the mesh in place and change the actual positions of the vertices (like, translate Mesh.Sphere out of (0,0,0)).

I'd also like to avoid opening the vertex buffer and manually aplying transformations to vertices and recalculating face/vertex normals, if possible :D

Is there a way to do it?
10X,

Janko Jerinic
 
You'll have to do it manually (thou a Mesh can auto-generate its normals). But may I ask why you don't want to use the world matrix... Every vertex will get transformed by that matrix anyway (unless you're using the programable pipeline) so there's no performance gain.
 
I'm not sure why you would want to do this. That is exactly what the World Matrix is for.

You lose performance, and also possibly the advantage of hardware acceleration for the vertex calculations (if you have a decent GFX card), if you open up the VB.
 
Last edited:
sgt_pinky said:
I'm not sure why you would want to do this. That is exactly what the World Matrix is for.

You lose performance, and also possibly the advantage of hardware acceleration for the vertex calculations (if you have a decent GFX card), if you open up the VB.

Right, but let's say you want a simple scene consisting only of generic meshes like Mesh.Box/Sphere/Torus etc. which are all centered at world origin and you want to scatter 'em about, then you'll have to deffine a world matrix for each of them that will translate/rotate/scale them to where you want 'em to be and these matrices will always be applied at render time.

Wouldn't it be cheaper to transform the vertices initially, before render time? (like, my box is created around world origin and I want it to be at (3, 4, 5) and 45 degrees rotated around X-axis..) I figured that you might save some
time then and apply just view/projection matrices to already positioned objects. Of course, if there's no way to disable the world matrix transformation then it doesn't matter if it's done by an identity or some other matrix..

10x guys..
 
jjerry said:
Of course, if there's no way to disable the world matrix transformation then it doesn't matter if it's done by an identity or some other matrix..

Exactly, you can't disable the world matrix transform as part of the fixed function pipeline. It's part of the video card hardware (assuming HTL) and represents no performance hit.
 
Back
Top