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
2
votes
1 answer

Reading depth buffer using OpenGLES3

In OpenGL I am able to read the z-buffer values, using glReadPixels, like so: glReadPixels(scrx, scry, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth); If I do the same in OpenGL ES 3.2 I get a GL_INVALID_OPERATION error. Checking the specification, I…
Bram
  • 7,440
  • 3
  • 52
  • 94
2
votes
0 answers

Qt3d Correct rendering of transparent mesh

I want to render a custom mesh (LAB.obj) with a certain transparency in a Qt3D scene. I use QDiffuseSpecularMaterial with diffuse color set to Qt.rgba(1,0.6,0.42,0.9) - alpha value is 0.9. I get strange horizontal stripes throughout my model when…
user137589
  • 163
  • 8
2
votes
1 answer

Distorted output when I apply projection OpenGL

I'm trying to implement camera functionality on a simple scene but the output is distored. I think it has something to do with perspective projection or maybe I'm using the gluLookAt() function wrong but I can't seem to pinpoint the problem.…
Marij Khan
  • 151
  • 1
  • 12
2
votes
1 answer

how to retrieve z depth and color of a rendered pixel

I would like to retrieve the z height of each pixels of a rendered object in a scene. I will need to retrieve the color rendered too. What are the opengl technics to implement ?
sancelot
  • 1,905
  • 12
  • 31
2
votes
1 answer

Prioritizing selected line objects over others by manipulating gl_FragDepth

In our current project we have probability of having some lines drawing on exact same place. Than we are having a flickering effect like this. I am trying to manipulate gl_FragDepth values depending on the geometry types to over come this problem.…
Kadir Erdem Demir
  • 3,531
  • 3
  • 28
  • 39
2
votes
1 answer

Depth buffer is not filled with data in shadow map render pass

I'm currently working on my shading in Vulkan. I've created a separate render pass for my shadow map basing on SaschaWillem's and Itoral's code. The base of my app was based on VulkanTutorial. The problem I'm having is that the depth buffer the Z…
2
votes
2 answers

Populating the depth buffer based on a 2D visual produced from a software renderer

My situation is this: a 2D image, as a 2D texture, is produced from a software renderer that actually illustrates a "3D" visual. OpenGL is then used essentially for nothing more than displaying this 2D texture. As a result, despite rendering what…
Aaa
  • 123
  • 1
  • 9
2
votes
0 answers

Depth of Field shader for points/strokes in Processing

Recently I've been using the Depth of Field shader below (originally from the ofxPostProcessing library for OpenFrameworks) for my Processing sketches. depth.glsl uniform float maxDepth; void main() { float depth = gl_FragCoord.z /…
solub
  • 1,291
  • 17
  • 40
2
votes
0 answers

Unity Mobile depth buffer precision

I'm a mobile game developer using Unity Engine. Here is my problem: I tried to render the static scene stuffs into a render target with color buffer and depth buffer, with which i render to the following frames before the dynamic objects are…
2
votes
2 answers

Making OpenGL polygonOffset and DirectX9 depthBias behave the same

For our multiplatform engine that supports both OpenGL and DirectX9 I am adding support for decals. In OpenGL I can set glPolygonOffset(-1.0f, -1.0f) to fix z-fighting between the wall and the decals. I want the DirectX version to behave exactly the…
Oogst
  • 358
  • 2
  • 14
2
votes
1 answer

OpenGL GL_DEPTH_TEST vs glDepthFunc and glDepthMask?

I've been using glDisable(GL_DEPTH_TEST) to disable depth testing, thinking that it only disables depth "testing". The reason I've been confused I guess is because I've created two functions, one to disable the depth "test", and another to disable…
Zebrafish
  • 11,682
  • 3
  • 43
  • 119
2
votes
1 answer

Depth testing is not working at all

For some reason in my project my depth testing is not working. I have made sure it is enabled and it doesn't work. I know this because I can see certain faces being drawn over each other and different objects (cubes) in the scene are drawn over each…
Vitulus
  • 654
  • 4
  • 10
2
votes
1 answer

How to access the values of the depth buffer outside of WebGL context?

Given a WebGL scene (created from THREE.js), how would you go about accessing the floating point values (as an array of data outside of the WebGL context) from the DEPTH_ATTACHMENT given the framebuffer has been bound to texture using…
Andy
  • 134
  • 8
2
votes
1 answer

Strange depth/blending in OpenGL drawing models

I'm having a strange problem which I cannot figure out for the life of me. I'm loading an OBJ model file from Maya and rendering it an OpenGL environment. This appears to go well and in my independent model viewer, they display correctly. However,…
Sonoman
  • 3,379
  • 9
  • 45
  • 61
2
votes
1 answer

WebGL2 FBO depth attachment values

I'm simply trying to render the depth values of my scene using WebGL2 like so: //Texture depthTexture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, depthTexture); gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT24, width,…
Doc
  • 53
  • 7