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

OpenGL - Is there a way to store depth values above 1?

I'm trying to implement collision detection on the GPU like this article: https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch29.html In step 2- Grid Generation, we use depth testing to make sure we only write particle IDs greater than the…
Mog
  • 1
  • 1
0
votes
1 answer

Open the depth test, but it doesn't work?

m_Program = new GLProgram; m_Program->initWithFilenames(“shader/gldemo.vsh”, “shader/gldemo.fsh”); m_Program->link(); //set uniform locations m_Program->updateUniforms(); glGenVertexArrays(1, &vao); glBindVertexArray(vao); //create…
jerryln
  • 3
  • 1
0
votes
1 answer

Depth test with two transparent images causes strange artifacts

I am rendering a bush composed of two same images crossed as you can see on the image underneath : But when we turn around the bush, on of the two images has visibly big problems with it's depth test : I tried disabling the depth test but it was…
0
votes
1 answer

How do I attach a depth buffer to an FBO context using sharpgl

So after many headaches trying to get depth testing working with an FBO render context in WPF with SharpGL I understand it's not as simple as setting gl.Enable(GL_DEPTH_TEST) like it is with old-style OpenGL and that I have to attach a depth buffer…
Ross Batten
  • 114
  • 8
0
votes
0 answers

Losing depth test precision in OpenGL

I write C# code to draw cubes surrounded by lines on the edges using orthogonal projection using OpenGL Code used at form load private void glControl_window_Load(object sender, EventArgs e) { GL.Enable(EnableCap.DepthTest); …
0
votes
2 answers

Depth Image in Matlab

I have a depth image taken from Kinect V2 which is given below. I want to extract the pixel value x at any specific coordinate and its depth value in Matlab. I used the follwing code in Matlab but it gives me 16-bit value. However, I'm not sure is…
0
votes
0 answers

How to fill the deph buffer in OpenGL 1 with a depth texture?

I separate moveable 3d object and non moveable 3d. I can generate 2 textures for non moveables : background color texture and background depth texture . I have no problem. The values are ok for both. I check the value with a gray gradient texture…
J. S.
  • 51
  • 4
0
votes
1 answer

OpenGL depth sorting fails on single mesh, when rendering to framebuffer instead of screen

As a simple demonstration of my problem, I am trying to render a large but simple mesh to a texture to be used later, but strangely enough, the further-away-from-the-camera parts of this mesh are displayed in front of the closer-to-the-camera parts,…
Nikolaj
  • 1,137
  • 10
  • 22
0
votes
0 answers

HLSL multi-pass geometry shader culling issue

I'm working on a shader that runs two passes: A standard vertex / pixel shader that draws the original object with some alpha blending A geometry shader that subdivides the mesh and makes it crumble My issue however is that the geometry of the…
kiamvdd
  • 31
  • 3
0
votes
1 answer

Matlab Kinect Depth Imaging

I'm working with the kinect camera and trying to display real-life depth imaging using the ptCloud method combining the RGB and Depth Sensor. However just using the initial setup my image is disfigured missing pertinent information, is there anyway…
Krips
  • 11
0
votes
1 answer

Direct3D 11 depth stencil / alpha blending issue

I've been working on a 3D renderer for a game, and until now it rendered all the textureless meshes first and all the textured meshes afterwards, using DrawIndexed. In an effort to improve performance, I've switched to DrawIndexedInstanced and made…
0
votes
0 answers

Why is gl_FragCoord.z always zero?

I'm using Vulkan (GTX 980), and I have this fragment shader: #version 450 #extension GL_ARB_separate_shader_objects : enable #extension GL_ARB_shading_language_420pack : enable layout (location = 0) in vec4 inColor; layout (location = 0) out vec4…
Brent
  • 4,153
  • 4
  • 30
  • 63
0
votes
1 answer

Workaround of disabling depth testing for transparent objects?

In the scene I've got only transparent objects, thus with enabled depth testing it causes objects hiding each other. I know depth testing doesn't consider any transparency, it just writes to the depth buffer looking at values of z. Then how to…
ampawd
  • 968
  • 8
  • 26
0
votes
1 answer

Depth Test in opengl

My program refuses to do depth testing. The two sphere objects are always drawn in the order they are created, not according to their position. Sphere alpha is positioned at (0, 0, 1) and Sphere beta is positioned (0, 0, -10), yet OpenGL still draws…
user5735177
  • 11
  • 1
  • 1
0
votes
1 answer

OpenGL Draw Rectangle At Given Depth

Currently, I have GL_DEPTH_TEST enabled and use it for textures. However, I'd like to draw a untextured rectangle with a certain depth/z value. glDisable(GL_TEXTURE_2D); glColor3f(colour.x, colour.y, colour.z); glRects((short) rect.x, (short)…
1 2 3
8 9