a technique used in 3D graphics to ensure that only the objects closest to the viewer are drawn in a scene.
Questions tagged [depth-testing]
121 questions
1
vote
1 answer
OpenGL depth test against cleared depth not as I expected (moderngl)
I am rendering a quad to a blank screen with its depth first cleared to (0.25). The depth of each vertex is set equal to its y coordinate, and it is a rectangle ranging from (-.5, -.5) to (.5, .5), so I would expect that the depth test (set to '>'),…

user2649681
- 750
- 1
- 6
- 23
1
vote
1 answer
Directx how to account for alpha blending in depth test
I am trying to implement a simple way to render particles in my toy app. I'm rendering billboarding quads with alpha blending, but this causes a problem with the depth stenciling where parts of the quad that are fully transparent are still obscuring…

Gregor Sattel
- 352
- 3
- 12
1
vote
1 answer
Will the depth be written immediately after Early Z passes?
If not, then why discard interrupted earlyZ?
Imagine that there is an object A in front of B, A has a discard operation in fs.Assume that the pixel of A at screen coordinates (100, 100) pass the Early z test,then it is discarded in the fragment…

Marsir
- 105
- 1
- 2
- 8
1
vote
1 answer
Why does DirectXToolkit ruin my depth testing
I'm sure I'm just missing some simple step that I've been too blind to notice so far, but I cannot seem to get depth testing to work at all. This is with DirectX 11.
The code that should set it all up:
DXGI_SWAP_CHAIN_DESC swapDesc = { };
…

TigerCipher
- 63
- 5
1
vote
1 answer
OpenGL depth test doesn't work on some computers
My first question here. In my program depth testing works properly on some computers, but it doesn't work on others, objects that are located farther away cover those which are located closer. I called glEnable(GL_DEPTH_TEST); and tried to call…

intereins
- 21
- 5
1
vote
1 answer
How do I create a depth stencil view?
I am in the making of a SharpDX game and I can't figure out how to make a depth stencil view. To be fair, I also don't really know what it is. I've looked everywhere I could find online and everything I do ends up with a black screen.
Can someone…

BendedWills
- 99
- 2
- 10
1
vote
1 answer
Force depth test against a specific depth value, instead of fragment's actual depth
I want to draw some primitives behind everything that wrote to the depth buffer by using glDepthFunc(GL_EQUAL) and writing to every pixel that has a depth of 1.0 (the highest and default value)
However, for this to work I have to ignore the…

Anne Quinn
- 12,609
- 8
- 54
- 101
1
vote
1 answer
Depth test discards fragments on custom framebuffer
In my programm I render multiple matrices to different framebuffers. At the end I render the textures created by the framebuffers to three 2D quads. The problem is that the Depth test discards all fragments of the custom framebuffers except for the…

Kaaarl
- 33
- 3
1
vote
1 answer
Depth-fighting solution using custom depth testing
The core of my problem is that I have troubles with depth-fighting in pure OpenGL.
I have two identical geometries, but one is simpler than the other.
That forms a set of perfectly coplanar polygons, and I want to display the complex geometry on…

Kiord
- 79
- 7
1
vote
1 answer
glDepthMask seems did not work as expected?
I render two triangles: one is a smaller red triangle with negative depth value(z coordinate of the vertex), the other is a bigger triangle with a positive depth value.
float smallVertices[] = {
//position color
-0.5f, -0.5f,…

coulsonwang
- 161
- 1
- 11
1
vote
1 answer
Objects shake when rotating
I'm facing a problem in my opengl code
I'm trying to build a house, and rotate it 360°, for simplicity let's assume the house has the front wall with window and dor, and a back wall.
I'm using DEPTH_BUFFER not to see the back wall when viewing the…

Sat
- 23
- 2
1
vote
1 answer
some models are visible even after z-test lequal in a custom depth mask shader UNITY.
While using some 3D models the depth Mask Shader which is having z-test as "LEqual" need to perform normally as in screenshot1
screenshot1
But it give result which shows grayscale outlined of that part of 3d model where it need to be hidden. [Take…

Praful Sharma
- 21
- 1
- 8
1
vote
1 answer
Wireframe rendering with depth-buffer in deferred rendering
I have a small OpenGL app for some scientific visualization with deferred rendering pipeline. I have got 2 passes: geometric pass, where I render textures with positions, normals, albedo, segmentation, e.t.c.; and lighting pass, where I just map…

Denis
- 719
- 2
- 8
- 23
1
vote
1 answer
Depth test not working correctly with stencil test
I need to cut holes in the 3D surface using stencil buffer.
Currently, everything works as expected, but the main problem is that holes are also visible through hills. How to prevent this behavior and hide holes if they are behind hills?
Current…

Ololoking
- 1,577
- 4
- 22
- 37
1
vote
1 answer
How does opengl depth testing use the 24bit depth buffer?
I am using 32bit float values which I input into the vertex shader for the x,y,z positions of every vertex. But, I have read that opengl uses 24bit for depth buffer and 8 bit for stencil buffer.
Since, I am copying the same 32bit float in…

user007
- 2,156
- 2
- 20
- 35