# Perspective, scale, and BLAH

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

## Recommended Posts

Please save me from the doom of failure! I’ve spent a good chunk of money on two different books; ‘Introduction to 3D game programming with DirectX 9.0’ and ‘Managed DirectX 9 Kick Start’ (yes I realize ones for MDX and ones not) Neither of the books spent more than a page and a half on perspective! Heck, the kick start book said word for word what MSDN does even. I just don’t understand this entire world space / perspective stuff though; and its’ not like I haven’t tried. Question: (quick jump reference for those who didn’t want to read my moaning) Where can I get some real help on this topic? I’ve tried two books and have blown a lot of money there already. Know any specific(*) books or articles that might be able to help me out? I’ve looked around here also and found nothing useful for me on this subject. Incase you’re wondering what it is I just don’t get, I guess I’ll explain on it a bit. Say I placed a square along the x axis at -2.5 through 2.5 x and 5 to 0 y with the z axis being 0. This would make the square centered on the x axis and all in positive y axis; assuming 0,0,0 as a base reference for the locations. Now, so I’ve got a 5x5 unit square in the middle of my world.. lets say I place the camera 10 units back and aim it at the y axis of 2.5 with the x and z axis’ of 0. This means the camera would be 10 units back and aimed right in the middle of the square I made right? (that could have been hard to follow due to poor explaining) Ok so assuming that’s right, we know what effect the camera has on positioning but that doesn’t seem to be all that matters! What else is effecting scale? How do I maintain a scale? I don’t know what the heck I’m doing, pleace help. Keith [Edited by - Keith1977 on November 24, 2004 12:22:03 AM]

##### Share on other sites
In the example, you didn't really say what the problem is. Other things that affect the size of displayed objects are angle of view, viewport size, and window size.

If you are trying to render 2D, you should look up "orthographic projection". That kind of projection makes it so the size of an object is the same no matter how far it is from the camera.

##### Share on other sites
JohnBolton--
"In the example, you didn't really say what the problem is. Other things that affect the size of displayed objects are angle of view, viewport size, and window size."

Angle of the camera was taken into account (looking dead on at the center of the square made.) Viewport I really don't understand I guess though, I've seen it mentioned in C++ stuff but I'm working with managed DirectX so thats wrapped for me I think. --window size is part of viewport I think.

Everyone--
The problem I'm having is I want to stick to a real world scale for the center of the camera. I want the player thats about 6ft tall to be scaled down to around 64 pixels tall directly where the camera is pointing. I've also got floor tiles* tat are 64x64 so I want them to look prestine right where the camera is angled. The further you get away from the cameras direction (due to the angle) I expect the things to get larger and smaller of course to give the perspective effect.

My problem is just that though. I don't understand what it takes to make the scale be represented correctly. Theres something I'm missing some where or something? I've spent some time with this though and I'm not getting it. I'm not super dumb or anything.. its just no clicking in though.

-Keith

##### Share on other sites
:( I'll never figure this out

##### Share on other sites
I know you have already spent some serious money on books, but I recommend this one:

Essential Mathematics for Games and Interactive Applications : A Programmer's Guide (The Morgan Kaufmann Series in Interactive 3d Technology)

I have been seriously impressed with every other book that Morgan Kaufmann publishes, an this is no exception. You can find the book on Amazon, and they let you search inside it - so you can see if will be useful. I hope this helps!

-Scott

##### Share on other sites
scott_l_smith --thanks, I've checked into it but I've thought of a good question I should ass, its something I realized I've been assuming but never have seen anything about.

What actually is one unit in world space? Does it have a direct relation to the view port?

One thing I don't understand is in the SDK examples (and my own even) resizing the window/viewport makes the object grow in size. Why? You're still the same distance away and the object is still the same size. Or is it the same size? Is one unit of world space actually the side of the viewport or something?

I could be way off, I've said many times I've got no clue. What makes the "tiger" in the sdk examples grow in size upon resizing? Its not stretching the frames (as far as the C# examples are concerned) so there has to be something more there.

##### Share on other sites
The "angle of view" is the angle from one side of the window to the other (generally bottom-to-top). The angle of view determines how much of the scene is displayed. Think of it in terms of a camera lens -- a wide-angle lens has a high angle of view and shows a lot of a scene, a normal lens has a normal angle of view and shows a average amount of a scene, and a telephoto has a very small angle of view and shows very little of a scene.

Now, here is how angle of view affects the scale. Suppose your camera (using a "normal" angle of view) is at the distance from the model where it fits perfectly in the window. If you switch to a wide-angle with a high angle of view (but displayed in the same window), you will display not only the model but also all the space around it. The model will appear smaller. If you switch to a telephoto with a small angle of view (but displayed in the same window), only a portion of the model will be displayed. The model will appear bigger.

Normally, when you set up your camera, you give it the angle of view, or values that determine the angle of view. The renderer will show the same angle of view no matter how big the window is on the screen. That's why resizing the window doesn't affect how much of the scene is displayed. The tiger will take up the same amount of the window no matter how big you make the window.

I hope this clears up everything.

BTW, a "normal" angle of view is generally between 60 and 90 degrees, but those values are very subjective.

##### Share on other sites
JohnBolton-- Thank you so much. This is exactly what I needed and it expains everything. Why cant these books day this? FOV/angle of view is what was screwing me up but I had no idea. The books and MSDN just say the common value is pi/4 .. that didnt mean shit to me really :) .. as far as my problem went.

Thanks bro
-Keith

##### Share on other sites
This is a related, but new question. FOV dermines how much the camera can see (whats placed onto the render target). Now, so what is it that determines what the viewing area of the camera is? FOV and.. far clipping plane? My guess/assumption is FOV, camera, and far clipping plan os what is determining it. That far clipping plan is the only assumption :-/ Other than that, I don't know what it could be.

FOV & far clipping?
-Keith

##### Share on other sites
My assumption was wrong; I tried it. So, now I've got no idea! I know that the viewport has nothing to do with this, so what tells DX the distance to render to? ..making up the size of the area to be rendered on the target? I checked into lookat and the params of PerspectiveFovLH so I dunno.

• 11
• 20
• 12
• 10
• 38
• ### Forum Statistics

• Total Topics
631400
• Total Posts
2999862
×