jjerry Posted October 5, 2005 Posted October 5, 2005 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 Quote
IngisKahn Posted October 5, 2005 Posted October 5, 2005 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. Quote "Who is John Galt?"
sgt_pinky Posted October 6, 2005 Posted October 6, 2005 (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 October 6, 2005 by sgt_pinky Quote
jjerry Posted October 6, 2005 Author Posted October 6, 2005 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.. Quote
IngisKahn Posted October 6, 2005 Posted October 6, 2005 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. Quote "Who is John Galt?"
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.