Questions tagged [depth-buffer]

Depth buffering(Z-buffering), is the management of image depth coordinates in three-dimensional (3-D) graphics.

In computer graphics, z-buffering, also known as depth buffering, is the management of image depth coordinates in three-dimensional (3-D) graphics, usually done in hardware, sometimes in software. It is one solution to the visibility problem, which is the problem of deciding which elements of a rendered scene are visible, and which are hidden. The painter's algorithm is another common solution which, though less efficient, can also handle non-opaque scene elements.

Resources

454 questions
4
votes
3 answers

Drawing a triangle in 3D to a depth buffer

I am experimenting with 3D graphics without relying on any 3D library, such as Java3D, OpenGL, DirectX, etc. I have a working Z-buffer (aka. "depth buffer"), yet I cannot think of a way of drawing a triangle to that buffer. (Every triangle is…
coderodde
  • 1,269
  • 4
  • 17
  • 34
4
votes
0 answers

(opengl-es 2.0 android libGDX) Depthbuffer cleared when changing FBO color attachment

I have spent a lot of time trying to solve this problem and searching for answers. But I can't figure it out. I am trying to preserve the depth buffer while rendering two images to texture. I have tried two different solutions, which both works on…
Bodzilla
  • 61
  • 5
4
votes
1 answer

Java OpenGL color material darkens when depth test is disabled

I've been working with the depth buffer in OpenGL (JOGL) to ensure certain items are rendered in front of others by disabling the depth buffer (detailed in my previous question Java OpenGL saving depth buffer). This works, except when I set the…
Jeff Storey
  • 56,312
  • 72
  • 233
  • 406
4
votes
1 answer

Optimizing Min/Max Depth GLSL Shader

I am implementing tiled deferred shading, and for that I need to compute the minimum/maximum depth values of a tile. I'm rendering 1 pixel per tile, and collect the depth values in a nested for loop, like this: float minDepth = 1.0; float maxDepth =…
tobspr
  • 8,200
  • 5
  • 33
  • 46
4
votes
2 answers

Render the depth buffer in OpenGL without shaders

I have the following C++ OpenGL code which renders the RGB values of pixels in a scene: glClearColor(0.1f, 0.1f, 0.1f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glViewport(0, 0, _windowWidth,…
Bill Cheatham
  • 11,396
  • 17
  • 69
  • 104
4
votes
1 answer

Render depth from framebuffer texture

I've been trying to add SSAO (based on the tutorial here: http://john-chapman-graphics.blogspot.co.nz/2013/01/ssao-tutorial.html) to a project of mine and I've gotten stuck on rendering the depth correctly. I have created a framebuffer texture to…
sler
  • 974
  • 1
  • 11
  • 19
4
votes
1 answer

How do I write data from Pixmap to Framebuffer's depth buffer?

I'm implementing texture masking using framebuffer's depth buffer following this example: https://github.com/mattdesl/lwjgl-basics/wiki/LibGDX-Masking#masking-with-depth-buffer I got it working with ShapeRenderer altering depth buffer, but now I…
gvlasov
  • 18,638
  • 21
  • 74
  • 110
4
votes
1 answer

How to resolve a multisampled depth buffer to a depth texture?

I'm having trouble with the msaa depth buffer resolving to a depth texture. I create my glTexImage2d for both my color texture and my depth texture and bind them to the "resolve" ( non-msaa ) framebuffer. Then I create and bind another framebuffer…
4
votes
2 answers

How do you tell OpenGL ES 2.0 to use a texture as the depth buffer?

I want to render a scene with an outline post processing effect in OpenGL ES 2.0. First I render all the opaque objects. Then I use a post processing shader for silhouette detection that uses the depth buffer as a texture. And now I want to render…
Gabriel
  • 41
  • 2
4
votes
1 answer

reconstructed world position from depth is wrong

I'm trying to implement deferred shading/lighting. In order to reduce the number/size of the buffers I use I wanted to use the depth texture to reconstruct world position later on. I do this by multiplying the pixel's coordinates with the inverse…
Dr Bearhands
  • 303
  • 2
  • 11
4
votes
2 answers

Rendering multiple depth information with FBOs

I am trying to implement a shader computing the light refraction through two surfaces: the back and front of the object. To do so, I need to render the refractive geometry with the normal depth test (GL_LESS), and the reversed depth test…
geenux
  • 297
  • 4
  • 15
4
votes
1 answer

How to efficiently copy depth buffer to texture on OpenGL ES

I'm trying to get some shadowing effects to work in OpenGL ES 2.0 on iOS by porting some code from standard GL. Part of the sample involves copying the depth buffer to a texture: glBindTexture(GL_TEXTURE_2D,…
mobob
  • 849
  • 10
  • 17
4
votes
1 answer

Get specific depth value of a kinect

I'm currently trying to make a hand / finger tracking with a kinect in XNA. For this, I need to be able to specify the depth range I want my program to render. I've looked about, and I cannot see how this is done. As far as I can tell, kinect's…
N0xus
  • 2,674
  • 12
  • 65
  • 126
3
votes
1 answer

OpenGL ES 2.0 Buffer Setup

I noticed that if I bind my depth buffer before the color buffer, the application works as intended: glGenRenderbuffers(1, &_depthbuffer); glBindRenderbuffer(GL_RENDERBUFFER, _depthbuffer); glRenderbufferStorage(GL_RENDERBUFFER,…
Matisse VerDuyn
  • 1,148
  • 15
  • 40
3
votes
1 answer

Why is only 1 Depth/Stencil buffer needed, even when the swap chain is tripple buffered DirectX12

I am learning DirectX12 programming. And one thing that has me confused is in all the tutorials I read, they only create a single depth/stencil buffer even when triple/double buffering is used with the swap chain. Wouldn't you need a depth/stencil…