Skip to main content
GameDev.net gamedev.net
🔒 Locked

Frustum setup with physical screen coordinates + eye

Started by smitty1276 Jul 6, 2011 at 9:33 PM 0 replies 550+ views
Original Post
smitty1276
smitty1276
[color=#1C2837][size=2]
[color=#1C2837][size=2](reposted/moved from OpenGL forum... more appropriate here, I think)
[color=#1C2837][size=2]
Hi everyone, I'm trying to ultimately do something similar to the Johnny Lee headtracking demo, where I want to use the center of the actual screen as the world origin, and I want my "camera" eyepoint to correspond to the user eye position in the real world (in the physical display's coordinate system). Initially, I am just trying to set up a more "traditional" on-axis frustum using eye position and screen dimentions... I am using OGL so this is a right-handed coordinate system looking down neg Z axis...

I setup my projection matrix with a frustum like below

left = -SCREEN_WIDTH_IN_MM / 2.f;
right = SCREEN_WIDTH_IN_MM / 2.f;
bottom = -SCREEN_HEIGHT_IN_MM / 2.f;
top = SCREEN_HEIGHT_IN_MM / 2.f;
near = eyePos.Z - 0.01;
far = eyePos.Z + 1000.f

My view matrix is just translating by -eyePos.

My understanding was that this would provide a view frustum such that anything that sits at z=0.0 (basically, a hair behind the near clip plane) would be displayed in the same position as if I had an ortho view. However, if I move my eyePos backward away from the screen, the geometry is appearing smaller as though it is moving back from the screen. Where is my thinking wrong on this? As the eye moves away from the screen, shouldn't the narrowing frustum exactly offset the greater distance, so that the geometry takes the same space on the screen?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.