Jump to content
• Advertisement

# Moving the world

This topic is 3712 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

Would it be faster to render if a 3d world moves around you or if you and your camera moves around the world?

#### Share this post

##### Share on other sites
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.

#### Share this post

##### Share on other sites
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.

#### Share this post

##### Share on other sites
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

#### Share this post

##### Share on other sites
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.

#### Share this post

##### Share on other sites
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.

#### Share this post

##### Share on other sites
Quote:
 Original post by HodgmanWhat 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.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
Rutin
29
2. 2
3. 3
4. 4
5. 5
• Advertisement

• 13
• 13
• 11
• 10
• 13
• ### Forum Statistics

• Total Topics
632955
• Total Posts
3009451
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!