Questions tagged [depth-testing]

a technique used in 3D graphics to ensure that only the objects closest to the viewer are drawn in a scene.

121 questions
2
votes
0 answers

GLSL, manual depth test

I turned OFF the depth buffer reading and writting. I'm rendering something on top of a previous render. Is there a way to query the current depth buffer (from the previous render) and test it against the current fragment being drawn ? My goal is to…
2
votes
1 answer

When and how does openGL calculate F_depth(depth value)

Meaning at this point the projection has already been done. This article gives us the projection matrix used by OpenGL, and the factor that affect the z-coordinate of a point is the row: [ 0 0 -(f+n)/(f-n) -2fn/(f-n) ] Note, this matrix is computed…
horxCoder
  • 165
  • 8
2
votes
1 answer

Graphics to graphics depth dependency, depth buffer is being corrupted

I am trying to do the following: Take render pass 1, render to attachment set S. Take render pass 2, render to attachment set S again. There is a one to one explanation on how to do this in the official Khronos github: Under Graphics to Graphics…
Makogan
  • 8,208
  • 7
  • 44
  • 112
2
votes
1 answer

Depth Testing not working when using QOpenGLFramebufferObject

I met the problem where the depth testing not working when I use the QOpenGLFramebufferObject. But It worked if I copy default framebuffer to the QOpenGLFramebufferObject using glBlitFramebuffer. I don't know the reason. Here is the code: void…
2
votes
1 answer

Inverting depth testing in OpenGL?

If one wishes to render normally, where the closest object to the camera is rendered, you set the OpenGL flags as follows: glDepthFunc(GL_LESS); glEnable(GL_DEPTH_TEST); So i would assume that…
Makogan
  • 8,208
  • 7
  • 44
  • 112
2
votes
2 answers

Depth testing doesn't work when using custom framebuffer

I'm stydying framebuffers and I've made a mirror in my scene. It works fine except the depth testing. Got stuck trying to make it work. (when rendering to default frame buffer - depth testing works fine). Would appreciate any help. Here is the code:…
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

Display Color and Depth using OpenNI and OpenCV

I've been posting quite alot recently about accessing depth images from a Kinect camera using OpenNI and OpenCV. Following some tutorials and advice from some other posts I have been able to write this script for showing the 2D color stream of the…
James Mallett
  • 827
  • 4
  • 11
  • 27
2
votes
1 answer

Transparency issues with 3d particles and 3d models, libgdx

I got some strange issues with transparency and 3d particles. A short vid to illustrate: https://youtu.be/ZHKI1X3MjhY As you can see I have a 3d particle effect, fire burning. Inside it is a 3 model with no alpha blending and it shows just fine.…
2
votes
3 answers

OpenGL Lines is hidden by other objects

I'm having a trouble with my OpenGL program. I draw three axis Ox, Oy and Oz, along with 4 pyramids lying on the axis. When I rotate the shapes, the axis should be visible, but they are hidden by the four triangles. What can I do to see the…
The Dark Knight
  • 383
  • 1
  • 10
  • 21
2
votes
0 answers

How (often) should you Depth-Sort your 3d objects?

A common way to increase performance of a GPU is to use depth-sorting. You'd want to draw the objects that are closest to you (the camera/viewport) first, that way every fragment(pixel) behind gets disposed early by the Z-Buffer. In case of…
ManIkWeet
  • 1,298
  • 1
  • 15
  • 36
2
votes
1 answer

Polygon Depth Sorting in c#

I'm writing a game in c#, using opengl immediate mode rendering. Many times, transparent polygons do not appear correctly due to bring incorrectly sorted. I've been searching a lot but cannot find a tutorial on how to quickly do depth sorting. My…
2
votes
1 answer

Weird Result with Depth Test

I'm having a problem when I enable GL_DEPTH_TEST when rendering my objects, here's what happens: GL_CULL_FACE is disable on that one. It only happens with perspective view! Does anyone have and idea of what's happening? I'm using Qt 4.8 for…
BlastDV
  • 112
  • 7
2
votes
3 answers

Can Stage3D draw objects behind all others, irrespective of actual distance?

I am making a 3D space game in Stage3D and would like a field of stars drawn behind ALL other objects. I think the problem I'm encountering is that the distances involved are very high. If I have the stars genuinely much farther than other objects I…
moosefetcher
  • 1,841
  • 2
  • 23
  • 39
1
vote
0 answers

Disabling Depth Test Gives Weird Artifacts For Complex Meshes

I imported a mesh from Blender 2.90.1 (glTF 2.0 exporter, all transforms applied, normals calced outside) into Godot v4.0.2.stable.official [7a0977ce2] and when setting no_depth_test = true, it seems like Godot enables the manual depth sorting…
B3D4ev_guy
  • 11
  • 1
1 2
3
8 9