Stupid nearplane and depth buffer questions...
Hi, i know opengl pretty good but i got a few very basic and probably stupid questions, for some reason i am just not totally sure about them:
1. Is the nearplane:
A. A plane of which the length of the vector from the camera eye to every point on the plane DOT the camera direction normal = nearplane distance (a straight plane).
B. Or a 'plane' of which every point on it lies at the same distance from the camera.
I guess A, as it's a plane.
2. Are the values stored in the depth buffer:
A. The distance to the camera-eye.
B. Or the length of the vector to the camera-eye DOT the camera direction normal.
I got no idea.
Thanks for any help.
It's the distance of (point dot camera front) in both cases -- so, a flat plane, and a dot product.
And what's stored is actually the distance (after dot product, along camera front) divided by the homogenous w, and scaled/offset to be 0 at the near plane, and 1 at the far plane; quantized to depthbuffer bits (or other values for "0" and "1" as set by glDepthRange()).
And what's stored is actually the distance (after dot product, along camera front) divided by the homogenous w, and scaled/offset to be 0 at the near plane, and 1 at the far plane; quantized to depthbuffer bits (or other values for "0" and "1" as set by glDepthRange()).
Also, I'll point out that due to how the depth buffer is done(as explained above), things closer to the camera are more accurately placed depthwise as there are more bits(I think it is logarthmic, sorry bad spelling), and using to high of a far plane to near plane ratio usually causes Z fighting between triangles. This is fixed usually by moving the near plane farther from the camera instead of the far plane since closer is more accurate.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement