New answers tagged

1

The depth is stored from 0 to 1 (0 - closest, 1 - farthest) by default. Addition to that, depth in perspective projection is not linear, it looked something like this: So it makes sense to me if it fades to white faster.


1

Your depth buffer seems fine to me. The images you posted most likely have been normalized to make details more easily seen. This process consists of finding the maximum and minimum value of the depth buffer and remapping the color range onto that range. It is also linearized. Graphics debuggers have usually such an option to render the depth buffer (or even ...


-2

after setting glDepthRange(n, f); Full formula: finalDepth = (gl_Position.z/gl_Position.w)*(f-n)*0.5+(f+n)*0.5 Bonus: Every other answer out there about depth buffer always assumes the use of projection matrix, this matrix is a waste of space, time and precision, of the 16 floats that it has only 2 are really needed, the "field of view" and the "...


0

After all of your transformations are applied (rotations, perspective transformations, etc.), all of the coordinates are divided by w (the fourth value in the gl_Position vector) to determine Normalized Device Coordinates, NDC. In other words NDC = (x/w, y/w, z/w) The x, y, and z coordinates in NDC space are in the range [-1..1] if they are in the clip ...


0

If I remember correctly, z (as well as x and y) will be divided by w. Then, everything outside of -1..1 will be culled. And then, resulting value will be mapped to 0..1 (or to whatever range you selected with glDepthRange()). In case of default range, full formula would be depth = z / w / 2 + 0.5.


0

No, actually is not allowed to read and write to/from the same buffer at the same time. This results in undefined behavior. If it does work on one piece of hardware, it may not work on another. Here is a more detailed explanation: https://www.opengl.org/wiki/Framebuffer_Object#Feedback_Loops Here is the resulting error: GL_INVALID_OPERATION> Source and ...


0

First of all, please give a complete source code of (small error-prone version of) your project, because this kind of problem depends on lots of things. However, there are lots of reasons that can make unwanted black screen, most common mistakes that I can guess in your case, are: mathematics mistakes camera matrix (in your case see your clipping range) ...



Top 50 recent answers are included