Questions tagged [depth-testing]

a technique used in 3D graphics to ensure that only the objects closest to the viewer are drawn in a scene.

121 questions
13
votes
1 answer

Meaning and usage of the factor parameter in glPolygonOffset

I am having difficulty understanding the meaning of the first parameter in glPolygonOffset function. void glPolygonOffset(GLfloat factor, GLfloat units); The official documentation says that factor Specifies a scale factor that is used to create…
Armen Tsirunyan
  • 130,161
  • 59
  • 324
  • 434
9
votes
1 answer

Early Z-test / depth-test in DirectX 11

As a DirectX noob i'm trying to wrap my head around depth buffers and specifically how pixel shaders are called for obscured pixels. From what i understand, the rasterizer calls the pixel shader for each pixel that is covering the primitive beeing…
aL3891
  • 6,205
  • 3
  • 33
  • 37
8
votes
2 answers

Can't get depth testing to work in OpenGL

I use SFML to create the window. In this screenshot the cube should be behind the pyramid but it just doesn't work. Here is the minimal code I used: #include #include #include #include…
RadicalRaid
  • 996
  • 9
  • 17
6
votes
2 answers

iOS / Core-Animation: 12 overlapping cards in a circle

I am trying to arrange 12 objects in the circle so that each overlaps its anticlockwise neighbour. Something like this: Problem is that if I just rely on the drawing order, one of them is always going to be completely on top, in this case the red…
P i
  • 29,020
  • 36
  • 159
  • 267
6
votes
1 answer

How does WebGL set values in the depth buffer?

In OpenGL, depth buffer values are calculated based on the near and far clipping planes of the scene. (Reference: Getting the true z value from the depth buffer) How does this work in WebGL? My understanding is that WebGL is unaware of my scene's…
rjkaplan
  • 3,138
  • 5
  • 27
  • 33
5
votes
1 answer

OpenGL depth testing and blending not working simultaniously

I'm currently writing a gravity-simulation and I have a small problem displaying the particles with OpenGL. To get "round" particles, I create a small float-array like this: for (int n = 0; n < 16; n++) for (int m = 0; m < 16; m++) …
Paul Aner
  • 361
  • 1
  • 8
5
votes
1 answer

How to render particles in depth order in three.js?

Dislaimer: I am relatively new to three.js, WegGL and 3D graphics in general. I am using three.js to display points from GPS tracks in 3D. The datasets we have to be able to visualize can be quite big(hundreds of thousands of points) so performance…
Pierre Henry
  • 16,658
  • 22
  • 85
  • 105
5
votes
0 answers

Unity: Saving Depth from Render Texture as png

What is the simplest way to save my Depth color mode Texture Render. Can it be done without using replacement shaders on my camera? It seems like most of the work is done just setting the color mode to depth on a camera with a render target.…
5
votes
2 answers

Z-fighting after depth prepass on GTX 980

I'm implementing a depth prepass in OpenGL. On an Intel HD Graphics 5500, this code works fine but on a Nvidia GeForce GTX 980 it doesn't (the image below shows the resulting z-fighting). I'm using the following code to generate the image.…
Henkk
  • 609
  • 6
  • 18
5
votes
1 answer

OpenGl alpha test - How to replace AlphaFunc deprecated?

I'm trying to draw sphere with alpha, but I have a problem with my Z-buffer. Some pixels are transparent but write in the Zbuffer so a pixel opaque just behind is hidden. Here are my settings: gl Enable: gl DEPTH_TEST. gl DepthFunc: gl LEQUAL. gl…
user3755394
  • 51
  • 1
  • 2
5
votes
1 answer

Display not correct using glEnable(GL_DEPTH_TEST)

My program below must display a cube in rotation illuminated with a simple light. The problem is the cube is flashing. When I withdraw the call glEnable(GL_DEPTH_TEST) the cube is not flashing but I can see the faces inside it (it's normal because…
user1364743
  • 5,283
  • 6
  • 51
  • 90
5
votes
1 answer

how does glDepthRange work?

My vertex cords are : GLfloat vertices[]= { 0.5f,0.5f,0.5f, -0.5f,0.5f,0.5f, -0.5f,-0.5f,0.5f, 0.5f,-0.5f,0.5f,//face 1 0.5f,-0.5f,-0.5f, -0.5f,-0.5f,-0.5f, …
debonair
  • 2,505
  • 4
  • 33
  • 73
5
votes
1 answer

Odd OpenGL behavior when drawing a cube

When I draw a cube with this code glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); gluLookAt( x, y, z, x+xp, y+yp, z+zp, 0.0f, 1.0f, 0.0f); glBegin(GL_QUADS); glColor3f(0.0f,1.0f,0.0f); …
WIll Cobb
  • 113
  • 9
4
votes
0 answers

Direct3D11 depth test LESS_EQUAL not working as expected

How is it possible that a fragment is generated, passes the depth test but isn't written to the current render target? This is the pixel history I see if I capture a frame in RenderDoc: The fragment should pass the depth test (same depth of the…
4
votes
1 answer

How do I make cube faces opaque on OpenGL?

I'm writing a program to draw a cube on OpenGL and rotate it continuously on mouse clicks. At particular angles, I'm able to see through the cube (transparent). I've enabled Depth Test, so I don't know why this is happening. I am not sure if I have…
acr1997
  • 43
  • 5
1
2 3
8 9