Archived

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

Ortho Projection vs. transformed vertices

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

Is there any reason to use orthogonal projection and NOT transformed vertices in D3D for 2D operations? The latter should be faster, since there are no matrices involved in transformations. [edited by - Ardor on August 28, 2002 12:06:22 PM]

Share this post


Link to post
Share on other sites
No, IMHO not - maybe someone else comes up.

Ortho projection is basically very usefull for "extremely narrow camera 3d scenes" - like for example looking at you through the sight of my sharpshooter rifle before bllowing your head of in Unreal Tournament 2003. The "extreme distance" make 3d projectuions futile anyway in this case.

For 2d items (including controls and 3d games), transformed vertives might be better :-)


Regards

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)

Share this post


Link to post
Share on other sites
Orthogonal projection makes rotation using transforms a lot easier. You just set a rotation matrix about the Z axis, set it as a world matrix, and voila. It also takes care of clipping.

With T&L vertices, you have to do both on your own.

You can read more on that at www.andypike.com , check his 2D graphics tutorial.

Share this post


Link to post
Share on other sites
Right, Coder - I forgot this :-( There is a lot of trigonometry transformation that you might WANT to do :-)


Regards

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)

Share this post


Link to post
Share on other sites
In my experience, the bottleneck is more fillrate anyway. In light of that, ortho allows beginners to get their feet wet with matrices. In some cases, matrices will be faster than locked and moved RHW vertices.

Also, you can define an ortho matrix so that the 2D elements are independent of the pixel resolution. For instance, a screen defined as 0.0-1.0 with have the same layout in any pixel resolution.

Share this post


Link to post
Share on other sites
I think it''s a matter of what you really need. Transformed vertices are easier to program, as you don''t need to mess with matrices. The bad thing is that the coordinates are fixed, so if you want to move the image, you''d have to lock the vertex buffer.

With orthogonal projection, you can use matrices to move and rotate the vertices easier and faster.

So, if you need a moving 2D environment, use orthogonal projection, but if the images are mostly still (like in most 3D shooters), transformed vertices are the best way to go.

Share this post


Link to post
Share on other sites