Transformation pipeline questions!

Started by
11 comments, last by SandoSan 15 years, 10 months ago
Quote:Original post by remigius
Reconstructing the world matrix each frame may sound computationally expensive, but it shouldn't be even a blip on the performance radar. FWIW, I always reconstruct the world matrix each frame for each object and haven't run into any issues with that. If you'd really want to, you could only update the world matrix when something (pos/scale/rot) changes, but at some point you'll want your objects moving along smoothly and you'll need to update it practically every frame anyway. To put it into perspective, if you should move on to animation/skinning, you'll be constructing and setting tons of matrices each frame and this is nothing to worry about.


Cheers. That was my main problem - that I had no real idea how many of these construction/multiplication operations were done per object per frame in a real application.

Quote:Original post by remigius
From here you can construct your world matrix and/or change the various seperate transforms as needed without having to decompose the matrix (which as I recall is quite a bit more expensive than constructing one) and you don't have to worry about redundant transforms being 'in sync'. It may help to realize the quaternion is a robust presentation for expessing any rotations, not just some gimmick to do interpolations. If you want to set a new orientation, simply construct a quaternion from axis angle or euler and set that on the object (or of course slerp to the new target rotation). That way all internal rotation information is uniformly stored as quaternions and you can convert back and forth as needed.


This is pretty much what I was doing...

How does incrementing the orientation about a specific axis work? Do you create the incrementation rotation and compose it with the current orientation? Again all this seems like a lot of operations!
Advertisement
Quote:Original post by SandoSan
This is pretty much what I was doing...

How does incrementing the orientation about a specific axis work? Do you create the incrementation rotation and compose it with the current orientation? Again all this seems like a lot of operations!


Sorry if we got you off-track there then [smile]

Incrementing rotations basically works like that, yes. For quaternions things work a bit more smoothly using slerp, but it does come down to the same thing. I can't point to skinning here for comparisson, since that typically comes with pre-baked rotations, but there are several common operations (like collisions/physics, pathfinding and whatnot) that take many orders of magnitude more operations.

In general, I don't think you need to worry about these minor operations (the rotations mind you, not the physics [wink]) when it comes to performance.
Rim van Wersch [ MDXInfo ] [ XNAInfo ] [ YouTube ] - Do yourself a favor and bookmark this excellent free online D3D/shader book!
Quote:Original post by remigius
In general, I don't think you need to worry about these minor operations (the rotations mind you, not the physics [wink]) when it comes to performance.


Cheers man, and everyone else who helped out in on this thread. It was most appreciated.

Sandos

This topic is closed to new replies.

Advertisement