Moving the world

Started by
5 comments, last by haegarr 15 years, 8 months ago
Would it be faster to render if a 3d world moves around you or if you and your camera moves around the world?
Advertisement
Generally, in order to move the camera around the world you do move the world around the camera. They're conceptually the same thing.
I would move the camera instead, because you tend to have various objects in the world and it would increase the number of calculations you'd have to do if you moved the whole world... If you move the camera you'll only be calculating it's position.
you're recalculating every objects position in the world every frame either way, but it's just easier in my opinion to picture the camera moving rather than the entire world
When a scene with N world objects (i.e. objects w/ co-ordinate frames related to the global frame) is rendered, then the model-to-view transformations (using row vectors)
Mi * V for all 0 <= i < N
are computed.

With the equivalence
V == C-1
of the view transformation and the camera transformation, it appears that changing the camera by D
C' := C * D
yields in a new view transformation
V' := D-1 * C-1 = D-1 * V

Substituting V with V' yields in
Mi * ( D-1 * V )
what means that a single matrix product does the job.

Since the paranthesis play mathematically no role, we can interpret the formula also as
== ( Mi * D-1 ) * V
and hence compute new model matrices
M'i := Mi * D-1 for all 0 <= i < N
what defines the same behaviour as above but by transforming the world instead of the camera. It means obviously to compute N matrix products.

Hence the effect is the same either, but the costs may differ drastically. So all answers above are correct, but partly ignore that additional costs should not be accepted if avoidable, IMHO.
What I meant by my earlier comment is that while conceptually you are moving the camera, you are actually moving the world.

Most 3D API's, including D3D, don't allow you to "move" the camera - it's always fixed at the origin looking down the Z axis. Hence, to "move" the camera you use a global matrix to move the world in the opposite direction.
Quote:Original post by Hodgman
What I meant by my earlier comment is that while conceptually you are moving the camera, you are actually moving the world.

Most 3D API's, including D3D, don't allow you to "move" the camera - it's always fixed at the origin looking down the Z axis. Hence, to "move" the camera you use a global matrix to move the world in the opposite direction.

For the case you're aiming at me: I know what you meant, and I haven't contradicted your comment in any way.

But interestingly enough, IMHO the reasoning of your objection is questionable. Maybe I'm wrong here, but when being rigorous I think there is no "actually", neither on the world nor on the camera side. Since
M * ( D-1 * V ) == ( M * D-1 ) * V
why should the RHS be superior (say, "more actual") to the LHS?

You justify your meaning with the origin and orientation of the camera. However, if you do so you imply that you interpret the result of the global-to-view transformation still in the global space. Now, someone else can say that s/he interprets the result of the same global-to-view transformation in the view space. Hence your justification doesn't hold w.r.t. to her/his reasoning.

So, IMHO its just a question of how things are interpreted. I personally prefer to consider reference frames, and to distinguish between inter- and intra-frame transformations, simply because of e.g. FK and other everyday mechanisms. But because I'm not a mathematician, I may miss something here.

This topic is closed to new replies.

Advertisement