Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Nairou

Camera movement rendering

This topic is 5356 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

I''ve noticed in this forum people talk about 2 different methods of camera transforming, and I''m curious what the performance differences are. The method I''m currently using is to constantly move the viewport to align it with the position of the camera, and then just render the world statically everytime. But I''ve seen people talk of another method, where the camera and viewport are kept in the same place, at identity, and all objects in the world are transformed relative to the camera position before rendering. Giving the same effect, even though the actual view matrix never changed. The first method is very simple, and at first glance sounds like it would be faster, since theres only one call to move the camera matrix, as opposed to the second method where several extra matrix multiplications are needed to position everything on the screen. But since this second method is what I hear most people on this forum talk about... maybe I''m missing something? Can someone tell me what the differences are between the two methods, and why everyone seems to prefer the second?

Share this post


Link to post
Share on other sites
Advertisement
Are you sure you understand camera transforming correctly? Here are the steps (at least how I do it, and a lot of the tutorials out there do it):

1) Create/Set perspective matrix
2) Create/Set view matrix (this is the camera matrix)
3) For every object, create/set it''s unique transform matrix, then render the object

It sounds like in your methods, the camera never actually moves or something - the object just move around it.


Dustin Franklin
Mircrosoft DirectX MVP

Share this post


Link to post
Share on other sites
Actually what you describe is exactly how I''m currently doing it, and it works great. I may have misunderstood what others were describing, but the "everything moves around the camera" idea is what I thought I was hearing, and it didn''t make sense.

For example, creating a skybox. I just added a skybox to my test code, which works fine, but to keep it with the camera I have to transform the box to the camera position before rendering it. But the descriptions I''ve read talk about keeping the skybox centered at identity, with the camera. I''m just trying to understand these other ways of doing it, so I don''t end up doing it the slow way.

Share this post


Link to post
Share on other sites
What he''s trying to say is that in some systems the camera is moved relative to the world, while in other systems the world is moved relative to the camera, and he wants to know if there is any performance difference. Logic tells me that the first method is probably faster, but I don''t really know how OGL handles it.



(Stolen from Programmer One)
UNIX is an operating system, OS/2 is half an operating system, Windows is a shell, and DOS is a boot partition virus

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!