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

439 questions
15
votes
2 answers

Android OpenGL ES Framebuffer objects - rendering depth-buffer to texture

I am using an Android device running Froyo supporting OpenGL ES 1.1 and OpenGL ES 2.0 I want to render the depth buffer to a texture. Having seen a number of examples for OpenGL, OpenGL ES on other platforms (including iPhone) I have tried a number…
Graham
  • 321
  • 1
  • 2
  • 7
14
votes
4 answers

How to render depth linearly in modern OpenGL with gl_FragCoord.z in fragment shader?

I read lots of information about getting depth with fragment shader. such as http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=234519 but I still don't know whether or not the gl_FragCoord.z is linear. GLSL specification…
tomriddle_1234
  • 2,813
  • 6
  • 34
  • 58
14
votes
1 answer

Why do we have to clear depth buffer in OpenGL during rendering?

I was trying to run an OpenGL code, it didn't have GL_DEPTH_BUFFER_BIT cleared in glClear(), because of which I couldn't render my scene. I added this bit, and the scene was rendered. Why is it necessary to use this clear bit? I may know the reason…
2am
  • 619
  • 1
  • 7
  • 24
11
votes
2 answers

Depth of Field: combining a point shader with a blur shader (Processing 3)

I would like to display thousands of points on a 3D canvas (in Processing) with a Depth of Field effect. More specifically, I would like to use a z-buffer (depth buffering) to adjust the level of blur of a point based on its distance from the…
solub
  • 1,124
  • 9
  • 33
11
votes
2 answers

Direct2D Depth Buffer

I need to draw a list of shapes and I am using Direct2D. I get the list of shapes from a file. The list is sorted and the order of the elements inside the file represents the order these shapes will be drawn. So, if for example the file specifies…
Nick
  • 9,515
  • 17
  • 75
  • 175
11
votes
2 answers

OpenGL ES2 Alpha test problems

I am rendering in 3D multiple objects with textures that have alpha. All the textures load fine but when I try to render them in front of each other I get the following: Left is what I have. Right is what it should be. The grid is just to help…
sgtHale
  • 1,377
  • 1
  • 14
  • 27
11
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
  • 120,726
  • 52
  • 304
  • 418
10
votes
4 answers

How to correctly render coincident polygons in OpenGL (ES)

I understand that by setting the depth function in OpenGL ES one can control how overlapping geometries are rendered in a 3D scene. I use gl.depthFunc(gl.LEQUAL) (webgl) in my code. However when two sets of polygons are coincident and are of…
Jayesh
  • 46,729
  • 19
  • 69
  • 96
9
votes
3 answers

OpenGL, how to use depthbuffer from framebuffer as usual depth buffer

I have frame buffer, with depth component and 4 color attachments with 4 textures I draw some stuff into it and unbind the buffer after, using 4 textures for fragment shader (deferred lighting). Later i want to draw some more stuff on the screen,…
ShPavel
  • 892
  • 1
  • 9
  • 16
9
votes
1 answer

How to use depth testing when rendering to an offscreen buffer then onto texture

I'm rendering my scene to a texture. This works fine except that depth testing does not work. How do I enable depth testing if rendering to an offscreen texture? I'm using the FrameBuffer class…
user491880
  • 4,063
  • 4
  • 25
  • 45
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
  • 931
  • 7
  • 17
8
votes
1 answer

World-space position from logarithmic depth buffer

After changing my current deferred renderer to use a logarithmic depth buffer I can not work out, for the life of me, how to reconstruct world-space depth from the depth buffer values. When I had the OpenGL default z/w depth written I could easily…
RamblingMad
  • 4,946
  • 1
  • 20
  • 41
8
votes
3 answers

Logarithmic Depth Buffer OpenGL

I've managed to implement a logarithmic depth buffer in OpenGL, mainly courtesy of articles from Outerra (You can read them here, here, and here). However, I'm having some issues, and I'm not sure if these issues are inherent to using a logarithmic…
Haydn V. Harach
  • 1,185
  • 14
  • 30
7
votes
5 answers

How can I read the depth buffer in WebGL?

Using the WebGL API, how can I get a value from the depth buffer, or in any other way determine 3D coordinates from screen coordinates (i.e. to find a location clicked on), other than by performing my own raycasting?
Kevin Reid
  • 21,218
  • 9
  • 61
  • 82
7
votes
3 answers

OpenGL es 2.0 Read depth buffer

As far as i know, we can't read the Z(depth) value in OpenGL ES 2.0. So I am wondering how we can get the 3D world coordinates from a point on the 2D screen? Actually I have some random thoughts might work. Since we can read the RGBA value by using…
Brian
  • 665
  • 1
  • 8
  • 12
1
2 3
29 30