Skip to main content
6 votes
Accepted

Is glxinfo saying that the 980 GTX doesn't support a 32 bit depth buffer?

It's important to note that glxinfo -v only reports the supported values for the default OpenGL framebuffer, the one that represents the visible screen itself. It'...
Trevor Powell's user avatar
5 votes

Ray tracing and Z buffering in graphics

"Z-buffers" and "raytracing" are not mutually exclusive. Z-buffers are frequently used to support triangle-based, back-projected rendering (though they are optional in actual usage), and they can also ...
Engineer's user avatar
  • 30k
4 votes

Why is my depth buffer texture so bright?

The depth is stored from 0 to 1 (0 - closest, 1 - farthest) by default. Addition to that, depth in perspective projection is not linear, it looked something like this: So it makes sense to me if it ...
Greffin28's user avatar
  • 999
4 votes

OpenGL ES 2.0 Shadow Mapping - depth only FBO not working due to GL_FRAMEBUFFER_INCOMPLETE_ATTACHMEN

You will need to implement multiple alternative solutions depending on the GPU. Not only are there many choices (GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT32, ...
Stephane Hockenhull's user avatar
4 votes
Accepted

Is it possible to record video, depth map and 6D pose of any games?

One solution is to use DLL injection. This technique facilitates attaching and executing a payload (your code) within the address space of another process (the game or graphics driver) by way of a ...
Pikalek's user avatar
  • 12.4k
3 votes
Accepted

How to use depth buffer for z-level rendering in roguelikes?

What is the Depth Buffer? The depth buffer stores how far away from the "camera" is what you have rendered. This allows the graphic system (the GPU does this in modern hardware) to check if ...
Theraot's user avatar
  • 27.3k
3 votes
Accepted

How is depth buffer written to?

so how is that being done exactly? There is one part of the pipeline that's allowed to both read and write from the render target: the blending unit at the final stage. This has specialized hardware ...
DMGregory's user avatar
  • 135k
3 votes
Accepted

Graphical issue when using a depth pre-pass

There were two problems with my code, thanks @DMGregory for having pointed them out. 1 - The depth buffer also need to be multisampled if the main rendering pass has MSAA. The solution I have found is ...
HenriV's user avatar
  • 45
2 votes
Accepted

Left-handed version of the reversed depth projection with infinite far plane

Well, I feel stupid now. Turns out I had to use a positive 1 in the last member of the third row instead of the -1 displayed in ...
Swyter's user avatar
  • 21
2 votes
Accepted

Simple cartoon water shader shoreline

After much trial and error and Google-fu, I've come across a texture blend shader that gave a similar effect to what you wanted. After a bit of tinkering I've achieved a satisfactory result. What ...
John Hamilton's user avatar
2 votes
Accepted

How to determine how far the background is behind a transparent object in a shader?

Yes, absolutely. The method is outlined in this presentation from Unity in 2011. (See the section "Soft Particles" on slide 22) Some of the shader conventions have changed since then, but the core ...
DMGregory's user avatar
  • 135k
2 votes

How do I write to a 16-bit depth buffer using Monogame and HLSL?

First of all, I am not very familiar with monogame specifically, but what I say apply to DirectX 11, which I expect Monogame is using under the hood. Now, for most cases, you don't need to expicitly ...
János Turánszki's user avatar
2 votes

Is it possible to create a homemade depth buffer?

Of course it is possible, if people can write a depth buffer you can too, but it will be hideously slow. Reading from and updating SDL2 textures is very slow because it's all via software, i.e. not ...
congusbongus's user avatar
  • 14.8k
2 votes

Why do we need a depth buffer to display a single 3D cube?

If you want it to draw correctly, that is, with the planes in the back staying in the back, and the planes in the front staying in the front, you need depth buffer. The depth buffer is used to ...
Ferreira da Selva's user avatar
2 votes
Accepted

Why do we need a depth buffer to display a single 3D cube?

Posting as answer as requested by OP. If you render your primitives without face culling, then the system needs the depth buffer to tell which of the faces of the cube are on the front and which are ...
Theraot's user avatar
  • 27.3k
2 votes
Accepted

Howto use the depth buffer in DirectX 12

You should check that matrix. The DirectXMath function XMMatrixPerspectiveFovLH returns 'row-major' memory order, but HLSL defaults to 'column-major' unless you ...
Chuck Walbourn's user avatar
1 vote

How to write depth texture and read values from it

I found an answer to my question. Thanks DMGregory for your participation. I only needed to add two rows of code into the OnPostRender()-function: ...
Hillbilly Joe's user avatar
1 vote
Accepted

glReadPixels with GL_DEPTH_COMPONENT into PBO is slow

glReadPixels(0, 0, w[index], h[index], GL_DEPTH_COMPONENT, GL_FLOAT, 0); Performance issues of this nature are typically caused by the OpenGL driver needing to do ...
Maximus Minimus's user avatar
1 vote

Why do we need a depth buffer to display a single 3D cube?

For a single non-self-shadowing mesh you don't need a depth buffer, managing draw order and proper winding+culling settings will be enough. However as soon as you want something more complex or want ...
ratchet freak's user avatar
1 vote

Tiled2Unity depth sorting issue with multiple layers

Ok I have finally managed to come up with a solution for this one, Ill post what I did here as I could not find the information anywhere else online so hopefully it will help someone else in future. ...
WraithNath's user avatar
1 vote

Drawing a grid over a terrain using a mesh - Shader Depth and Z-Buffer

You can use a pixel shader for this. Pass the size of a single grid square and the radius of a circle to the shader, divide it by the gridSize, round it then multiply by gridSize to get the closest ...
Bálint's user avatar
  • 14.9k
1 vote

Ray tracing and Z buffering in graphics

Daniel beat me to it but I'm gonna give my own answer anyway since I had fun writing this. His bullet points are solid but I wanted to expand a bit more. I'm going to use the term Rasterization ...
Honeybunch's user avatar
  • 1,383
1 vote
Accepted

Unity Custom Sprite Shader: Don't write transparent pixels into Depth Buffer

Two answers here; the first one is the one that usually works best, the second is closer to the exact answer you requested. First method In your example image, it looks like you are drawing two ...
Victor T.'s user avatar
  • 1,381
1 vote

How to determine how far the background is behind a transparent object in a shader?

You need rendered depth buffer for this to work. First you would get the current fragment depth, and then read the depth buffer value on that fragment and then calculate the transparency value for the ...
Lasse's user avatar
  • 3,241
1 vote

color individual triangles on a mesh in Unity?

As mentioned in the comments above, the "inside out" or incorrect ordering effect comes from using a particle shader - these are written for layering transparent content so they don't write to the ...
DMGregory's user avatar
  • 135k
1 vote

What is the math behind rendering isometric with the aid of Depth Maps?

You can pretty much think of this as deferred shading. At least if I understand your question correctly, you are asking how to handle depth information that is stored in a texture for a sprite you ...
Nils Ole Timm's user avatar
1 vote
Accepted

DX11 Clear Issue, Irregular pattern

It turns out that it's been an unknown local issue. After resuming the project later with no changes, other than restarting and Windows updates, I'm not having this issue anymore. The Windows 10 ...
Dan Wattle's user avatar
1 vote
Accepted

Why is my depth buffer texture so bright?

Your depth buffer seems fine to me. The images you posted most likely have been normalized to make details more easily seen. This process consists of finding the maximum and minimum value of the depth ...
János Turánszki's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible