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

How to use depth buffer to store indices

I want to use the depth buffer in a slightly unorthodox way and I got heavily confused by all the normalization, scaling and what ever is going on there. My plan is to implement a spatial hashing algorithm by some guys from AMD (link to pdf).…
Gigo
  • 3,188
  • 3
  • 29
  • 40
5
votes
1 answer

Using depth buffer with GL_LINES

I want to draw edges of an object with hidden edges removed. The idea I want to apply is to render the object's faces first to the depth buffer, then in a second pass drawing the edges with depth testing enabled. Since not all triangle edges should…
Etan
  • 17,014
  • 17
  • 89
  • 148
5
votes
1 answer

glReadPixels doesn't read depth buffer values on iOS

I can't seem to read the depth buffer values in OpenGL ES2 on iOS 4.3 afDepthPixels = (float*)malloc(sizeof(float) * iScreenWidth * iScreenHeight); glReadPixels(0, 0, iScreenWidth, iScreenHeight, GL_DEPTH_COMPONENT, GL_FLOAT, afDepthPixels); My…
Kalen
  • 3,106
  • 8
  • 29
  • 42
5
votes
1 answer

Getting world coordinates from OpenGL depth buffer

i am using pyBullet, which is python wrapper to bullet3 physics engine and i need to create point cloud from virtual camera. This engine uses basic OpenGL renderer and i am able to get values from OpenGL depth buffer img = p.getCameraImage(imgW,…
mereth
  • 465
  • 3
  • 9
  • 19
5
votes
1 answer

ARCore – Raw Depth Data from rear Android depth camera

I can't figure out how can I get raw depth data from my Xiaomi Redmi Note 8 Pro with rear ToF depth sensor. I've tried: Camera2Format from android samples. No results (and I'm not alone) get physicalId from rear camera as described in android…
Grigory Feldman
  • 405
  • 3
  • 7
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

Create depth buffer histogram texture with GLSL

I'm using the depth buffer of the current context to influence a texture I am displaying. The texture is 1 dimensional and in grayscale. From left to right represents from near to far. The more pixels are at a certain depth the brighter the texture…
Paul Wagener
  • 432
  • 6
  • 12
5
votes
2 answers

OpenGL impostor-sphere : problem when calculating the depth value

I'm trying to render a sphere as an impostor, but I have a problem in calculating the depth value of the points of the sphere's surface. Here you can see what happens when I move the camera around the impostor-sphere and a "real" cube that…
Arctic Pi
  • 669
  • 5
  • 19
5
votes
2 answers

Linear depth buffer

Many people use usual perspective matrix with third line like this: (0 0 (n+f)/(n-f) 2*n*f/(n-f)) But it has problem with float precision near far clipping surface. The result is z-fighting. What about to use linear transformation of z? Let's…
lzv
  • 93
  • 2
  • 7
5
votes
1 answer

How to disable the depth buffer?

I don't see a RenderState as a member in the GraphicsDevice class, which is where the functions for disabling the depth buffer used to be. Anyone know how this is done with this new 4.0 API? It would be great if I could somehow access a full…
Kalen
  • 3,106
  • 8
  • 29
  • 42
5
votes
3 answers

iOS-Metal: How to clear Depth Buffer ? Similar to glClear(GL_DEPTH_BUFFER_BIT) in OpenGL

I need to clear the depth buffer, for which i use glClear(GL_DEPTH_BUFFER_BIT) in OpenGL, how to do in metal ? I have gone through apple's documentation, there is no hint about it.
VivekParamasivam
  • 1,086
  • 2
  • 13
  • 23
5
votes
1 answer

JavafX 8 3D Z Order. Overlapping shape behaviour is wrong.

I have a JavaFX 3D scene with a bunch of boxes and spheres added at random locations. It seems like the depth order is all wrong and I'm not sure why. I have tried to use myNode.setDepthTest(DepthTest.ENABLE) but that doesn't seem to help. I've…
Jamie Macaulay
  • 794
  • 6
  • 20
5
votes
1 answer

Using depth buffer for layering 2D sprites

I'm making a 2D game using OpenGL. I want to do the drawing like, first I copy vertex data of all objects I want to draw into VBOs (one VBO per texture/shader), then draw each VBO in separate draw call. It seemed like a good idea, until I realized…
Xirdus
  • 2,997
  • 6
  • 28
  • 36
5
votes
1 answer

Away3D Stage3DProxy drawing order

I have a flash application where two 3d Views are sharing the same Stage3DProxy, because I need one to be overlaid/drawn over the other at all times. However, they seem to share the same 3d space/z-buffer(?). My update function currently looks like…
MickMalone1983
  • 1,054
  • 8
  • 17
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
1 2
3
30 31