View vs World

Started by
1 comment, last by FijiRasta 21 years, 5 months ago
Just wanting to know so that I dont generate bad habits: When moving around in a scene is it best, better coding practice or whatever, to set the view once and then move all objects based on new world coordinates, or simply move the view and leave the world coordinates alone? Cheers.
Advertisement
Rename "View" to "Camera" and "World" to "Object into universe" it all makes sense

i.e. To move the viewer around the scene, the common practice is to alter the view matrix. To move objects within the world, alter the world matrix.

Both matrices get concatenated by D3D internally anyway* so there''s no greater cost for one over the other, but view is more "usual" for cameras.


[as an aside, OpenGL takes a matrix it calls "WorldView" where you do the same concatenation yourself before calling the API]

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Well D3D adverts against changing the view matrix to much as it does have an aditional overhead to reset it for cards (don''t ask me read the docs), but when they say this they''re talking about setting the view matrix far too many, like far too many times each frame. What is far too many? Well every frame you have to set the view matrix once and probably some 2 or 3 more times for additional views and tricks but far too many would be more like setting the view matrix for every object instead of using the world matrix... (Who does this?).
So a optimal solution is to use things the way they are intended to be used: to move your virtual eye use the view matrix every frame, to move objects use the world matrix. Remember that if your moving all other objects then your doing a huge amount of calcs and if you just move the cam your reducing the load (obviously I''m going to admit your scene has more then 1 spinning cube)

This topic is closed to new replies.

Advertisement