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

Depth component readRenderTargetPixels in Three.js?

Can depth pixel numbers be extracted from THREE.WebGLRenderer, similar to the .readRenderTargetPixels functionality? Basically, is there an update to this question. My starting point is Three.js r80. Normalized values are fine if I can also convert…
Michelle Norris
  • 568
  • 7
  • 14
3
votes
2 answers

UE4 UMG widget clips through the environment: VR target reticle

I'm creating a VR game, where I'd like to paint a target reticle wherever the user is looking. The reticle is being drawn in world space, and placed at the same depth as the object the user is looking at. (I'm using a line trace to locate the…
Chris Nolet
  • 8,714
  • 7
  • 67
  • 92
3
votes
1 answer

Extracting _CameraDepthTexture values Unity

I need to extract the depth values for the camera screen and write to a file. I read that _CameraDepthTexture is only accessible from shaders. I am not very familiar with shaders is it possible to write to file in shader code? Or is there any other…
D3GAN
  • 642
  • 10
  • 26
3
votes
1 answer

OpenGL Voxel Game - Avoid transparency overlapping

Im making a voxel game, and i have designed the water as cubes with 0.5 alpha. It works great if all the water is at the same height, like in the image below: But, if the water is not at the same height, alpha overlapping happens: How can I…
Ivelate
  • 298
  • 2
  • 10
3
votes
1 answer

How to fill depth buffer manually using OpenGL and GLSL

I did a lot of researches on how filling the depth buffer manually without success. Until here, all I know is a depth texture (GL_DEPTH_COMPONENT) attached to a FBO is filled automatically by OpenGL during the render pass. For exemple, the following…
user1364743
  • 5,283
  • 6
  • 51
  • 90
3
votes
1 answer

Understanding GL_ARB_conservative_depth extension

OpenGL says that if depth function is GL_LESS and layout qualifier is depth_less, then OpenGL will perform the early depth test. Now if the original value in buffer is 0.5 and if the depth for particular pixel is 0.8, it will fail the early depth…
debonair
  • 2,505
  • 4
  • 33
  • 73
3
votes
2 answers

Why we disable Z-write in blending

In blending, we draw opaque objects first with z-write and test enabled. Then we disable z-write with test enabled for drawing translucent objects. While drawing translucent objects we are drawing them back to front order so why do we need to…
debonair
  • 2,505
  • 4
  • 33
  • 73
3
votes
2 answers

OpenGL sprite scene, using z-buffer with perspective projection and without distortion. Possible?

I'm working on some sprite based games. For z-ordering sprites there are basically the alternatives 1) draw in correct order - can be troublesome for batching 2) use orthographic projection and depth testing - can be troublesome with translucency I…
J-S
  • 425
  • 3
  • 17
3
votes
1 answer

How is glDrawBuffers associated to drawing to a depth texture

You can specify what buffers to draw to using glDrawBuffer() example GLenum buffers[] = { GL_COLOR_ATTACHMENT0 }; glDrawBuffers( 1, buffers ); ok so that makes sense. how about the depth texture though? so we have here our creation of a…
Franky Rivera
  • 553
  • 8
  • 20
3
votes
1 answer

OpenGL depth buffer using QOpenGLFramebufferObject not working

I have a problem where the depth of an OpenGL scene is not rendered correctly. Im doing off-screen rendering into a QOpenGLFramebufferObject. If I run the same code in a QGLWidget it renders fine. Here is the code: // SETUP SurfaceFormat…
matej.svejda
  • 161
  • 1
  • 9
3
votes
1 answer

Depth + Stencil framebuffer concerns

I need both a stencil and depth buffer for my OpenGL app. The depth buffer at least needs to be rendered to texture via a framebuffer object, so that I can do deferred shading and other post-processing effects. I already have this framebuffer set…
Haydn V. Harach
  • 1,265
  • 1
  • 18
  • 36
3
votes
1 answer

Should this depth buffer visualisation appear smooth?

I'm debugging a problem with SSAO and try to visualise my depth buffer. Here's the result: I'm storing the depth and normals in a single 16-bit RGBA texture. This is my depth pass shader: // Vertex shader #version 150 core #extension…
SurvivalMachine
  • 7,946
  • 15
  • 57
  • 87
3
votes
0 answers

Incorrect-Reversed Backface Culling?

glEnable(GL_CULL_FACE); glCullFace(GL_BACK); I have been trying to implement deferred rendering for 2 weeks. But all of the meshes in my test program are culled reversely. The code above should be the correct way to render a model. Every example i…
deniz
  • 2,427
  • 4
  • 27
  • 38
3
votes
2 answers

Why are some of my cube faces not rendering the way I'd like them to?

Front face on the left; right face on the right Back face on the left; left face on the right After some debugging, I've come to a couple conclusions: Face culling (turned off in the photos) appears to make it worse. Depth Buffering (turned on in…
zeboidlund
  • 9,731
  • 31
  • 118
  • 180
3
votes
1 answer

opengl depth buffer slow when points have same depth

I'm making a 2d game involving drawing huge numbers of overlapping quads to the screen. What goes in front of what doesn't really matter. If I draw each of my quads with z values from 0 upwards and have glDepthFunc(GL_LESS) set I get quite a nice…
Ellipsis
  • 63
  • 6