Hello everyone
I am currently trying to implement a post processing effect using (among other things) V-Ray's VRaySamplerInfo Point in camera space. Thus I have a simple way of going from image coordinates to view-space positions. For the other direction however I've run into some problems. My attempt so far is to simply use a modified projection matrix such as the one given here:
http://www.opengl.org/sdk/docs/man/x...erspective.xml
but with the following changes to accomodate for the fact that VRay shows FOVX rather than FOVY:
f = cotangent(FOVX/2)
M[0,0] = f
M[1,1] = aspect * f
For the z_near and z_far I use any two dummy values which I know will cover my whole scene, like 0.1 and 100000 since I'm not interested in the projected z value anyway.
I then simply map from [-1..1] to [0..1] and then to [0..width] or [0..height]
This works perfectly so long as the parameters vertical shift and horizontal shift are 0.
How does the vertical and horizontal shift relate to the FOV of the image? Where can I find documentation on this? Any tips on how to accomodate for shift?
Thanks in advance
I am currently trying to implement a post processing effect using (among other things) V-Ray's VRaySamplerInfo Point in camera space. Thus I have a simple way of going from image coordinates to view-space positions. For the other direction however I've run into some problems. My attempt so far is to simply use a modified projection matrix such as the one given here:
http://www.opengl.org/sdk/docs/man/x...erspective.xml
but with the following changes to accomodate for the fact that VRay shows FOVX rather than FOVY:
f = cotangent(FOVX/2)
M[0,0] = f
M[1,1] = aspect * f
For the z_near and z_far I use any two dummy values which I know will cover my whole scene, like 0.1 and 100000 since I'm not interested in the projected z value anyway.
I then simply map from [-1..1] to [0..1] and then to [0..width] or [0..height]
This works perfectly so long as the parameters vertical shift and horizontal shift are 0.
How does the vertical and horizontal shift relate to the FOV of the image? Where can I find documentation on this? Any tips on how to accomodate for shift?
Thanks in advance
Comment