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
0 answers

Depth buffer mode with several axes in Matlab

Is there a way to use the depth buffer while rendering a figure with two axes? Here's the example: The figure consists of two axes, which have symmetrically inverted moving waves (for simplicity red and blue). Obviously, these waves would intersect…
Eugene Kolesnikov
  • 643
  • 2
  • 6
  • 15
2
votes
1 answer

OpenGL Depth Buffer Problem

For my last few projects I have been using some of the utility files that I found whilst looking at a few demos here. Namely a file called opengl.h - mainly used to manage shaders a bit like glew and another file gl_font. gl_font is a class they use…
henryprescott
  • 483
  • 4
  • 19
2
votes
0 answers

ARKit – All fragments in a plane at the same Z-depth

In an ARKit scene I display a number of planes representing photos placed at various points. Sometimes the photos intersect with each other, which doesn't look so great. To avoid this, I'd like to make the Z-depth every fragment / pixel of each…
p10ben
  • 425
  • 1
  • 6
  • 17
2
votes
1 answer

Why is depth buffers faster than depth textures?

This tutorial on shadow-mapping in OpenGL briefly mentions the difference between using a depth buffer and a depth texture (edit: to store per pixel depth information for depth testing or other purposes, such as shadow-mapping) by stating: Depth…
Nikolaj
  • 1,137
  • 10
  • 22
2
votes
1 answer

Enabling blending makes renderPipelineState fail to build in MetalKit MTKView

I'm rendering a geometry that has some translucent areas (alpha < 1) in a metalkit MTKView. If isBlendingEnabled is left as false in the descriptor for the render pipeline state, then everything displays as it should (albeit with all solid…
OliverD
  • 1,074
  • 13
  • 19
2
votes
2 answers

glReadPixels GL_DEPTH_COMPONENT and color

How to get the depth and the color information out of any OpenGL drawing? I would like to save a depth image and a color image to the disk. What i tried is the following: glClear(GL_COLOR_BUFFER_BIT |…
Ben
  • 115
  • 1
  • 2
  • 10
2
votes
3 answers

How can I write a different value to the depth buffer than the value used for depth comparisson?

In Open GL, is it possible to render a polygon with a regular depth test enabled, but when the depth buffer value is actually written to the depth buffer, I want to write a custom value? (The reason is I'm rendering a particle system, which should…
Viktor Sehr
  • 12,825
  • 5
  • 58
  • 90
2
votes
1 answer

Open GL ES 2.0 multiple drawElements and draw order

I implemented simple OBJ-parser and using parallelepiped as example model. I added rotation feature based on quaternions. Next goal - adding light. I parsed normals and decided drawing normals as "debug" feature (for further better understanding…
frankWhite
  • 1,523
  • 15
  • 21
2
votes
1 answer

Metal. Why does setting MTLCullMode to none turn off depth comparison?

I an rendering a simple box: MDLMesh(boxWithExtent: ...) In my draw loop when I turn off back-face culling: renderCommandEncoder.setCullMode(.none) All depth comparison is disabled and sides of the box are drawn completely wrong with back-facing…
dugla
  • 12,774
  • 26
  • 88
  • 136
2
votes
1 answer

GLSL shader: occlusion order and culling

I have a GLSL shader that draws a 3D curve given a set of Bezier curves (3d coordinates of points). The drawing itself is done as I want except the occlusion does not work correctly, i.e., under certain viewpoints, the curve that is supposed to be…
vicrucann
  • 1,703
  • 1
  • 24
  • 34
2
votes
1 answer

Manual depth rendering: Random results despite using atomic operations

i'm rendering single-pixel points into a uint32-texture with a compute shader. the texture is a 3d texture, x and y are viewport coordinates, z has depth information on coordinate 0 and additional attributes on 1. so two manually built…
karyon
  • 1,957
  • 1
  • 11
  • 16
2
votes
2 answers

Depth Buffer seems to not work - OpenGL Shader

I'm using openGL with GLFW and GLEW. I'm rendering everything using shaders but it seems like the depth buffer doesn't work. The shaders I'm using for 3D rendering are: Vertex Shader #version 410\n layout(location = 0) in vec3…
2
votes
1 answer

Controlling depth buffer and drawing order in OpenSceneGraph

I'm working on a little GIS app using OSG, but i'm quite a newbie with it. As the view is not changing a lot, i'm not struggling to keep a decent fps ratio. I have to draw multiple layers on the same view. Layers may overlaps, but not always. Right…
Krag
  • 79
  • 1
  • 9
2
votes
0 answers

GLSL, change glPosition.z to create a flat change in depth buffer?

I am drawing a stack of decals on a quad. Same geometry, different textures. Z-fighting is the obvious result. I cannot control the rendering order or use glPolygonoffset due to batched rendering. So I adjust depth values inside the vertex shader. …
J-S
  • 425
  • 3
  • 17
2
votes
2 answers

OpenGL C++ Depth buffer not working

I've been testing with OpenGL for a while and have not been able to get the depth buffer to work, despite using GLUT_DEPTH as a parameter in glutInitDisplayMode and doing glClear(GL_DEPTH_BUFFER_BIT) at the start of the display function. I don't…
Marijn
  • 47
  • 1
  • 9