Perspectives

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Perspectives

Post by saigumi »

I have been playing around with the different perspective maticies and have been hitting a lot of problems and questions that I can't resolve. I've been looking through graphics books and Open GL/DirectX tutorials to figure out what the heck I'm doing wrong.

Between the massive amount of bad information out there, I posted several questions on other development boards trying to figure out if/what I am doing wrong, or even if I should care.

In my Orthogonal tutorial (http://www.saigumi.net), I pointed out that I have to reverse the near and far values to get the objects to be rendered in the correct order. This seems strange to me since every Orthogonal tutorial out there says to use -1 for the min and +1 for the max. The only difference is that I am still giving objects locations on the Z. The tutorials I have found don't really talk about this much, many of them only go into rendering billboards.

My current definition for the matrix is buildOrthoLh(16.0f,12.0f,1.5f,-36.5f). This seems bad, because some of the information I have read says that you don't use negatives.

So, does anyone know how to properly specify the min and max values?

Then, we have part 2:

I am using orthogonal because I don't want any perspective as this is a tile based strategy game that I am making. So, I started thinking about how to reduce the perspective effects using the two other persepective matrix types: Perspective and Perspective FOV. No mater what I set the screen size, Field of View, or Aspect Ratio, the tile at the center looks fine, but the ones on the outside extend greatly. At first, I thought that this was because I am using very small models (1 unit in size), but even larger tiles (10 units) get this warping effect.

Most of the information I found out there was to limit your near and far ratios to about 1 to 10. So, I tested aspect ratios from 0 to 1 to 2 and all of them warped.

Is there any way to set up an orthogonal camera without it being purely orthogonal?
Crud, how do I do this again?
Chev
Posts: 37
Joined: Wed Nov 19, 2003 6:15 am

Post by Chev »

These are the values I use for my space sim. I don't recognize much perspective stretching/warping with these #'s. Not sure if this will help you at all because I certainly break the rules of staying between 1 and 10 for near/far.

Code: Select all

camera->setFarValue(2000000.0f);
camera->setNearValue(0.050f);
camera->setFOV(1.8f);
I can get away with these #'s because I only have a handful of models that are rendered :)
Post Reply