Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted
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.
"Who is John Galt?"
Posted (edited)

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.

Edited by sgt_pinky
Posted
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..

Posted
Of course' date=' 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..[/quote']

 

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.

"Who is John Galt?"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...