Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [depth-buffer]

Depth buffer stores a depth (z-coordinate) of a rendered pixel of a 3D scene. Depth buffer is used in Z-buffering (management of image depth coordinates). Because of this depth buffer is often called Z-buffer.

0
votes
1answer
16 views

XNA 4.0 How to change GraphicsDevice Default DepthStencilState Value

I want to change one of the deafult values of my GraphicsDevice to that: GraphicsDevice.DepthStencilState.DepthBufferEnable = true; But I know only to change it ...
0
votes
1answer
22 views

World position reconstruction from depth fails when viewport size does not match window size

I'm facing very strange issue. My code for world pos reconstruction works correctly when the viewport size is equal to window size (or framebuffer size in other words). Below is the part for ...
0
votes
1answer
76 views

How can I write an additive mesh shader that splits the RGB channels while accounting for depth?

I'm trying to create a sort of "hologram" effect. So far, what I have is an additive, three-pass shader that uses ColorMask for each pass to separate the RGB channels. The problem is that doing so ...
0
votes
3answers
97 views

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

According to a Vulkan tutorial I am following, I will need to create a depth buffer in order to display a 3D cube: However, as far as I understand, depth buffers are used for the Z-buffering ...
0
votes
0answers
72 views

Performance comparison of reading Depth Buffer or texture in fragment shader

My requirement is to render per pixel data (say pixel transparency) to some buffer (say render pass 1) and then render a shape using the per pixel lighting rendered in shape 1. I can use depth buffer ...
0
votes
1answer
91 views

Depth Compositing - Background Not Being Rendered

I have a pre-rendered 3D scene which I am rendering as a background image. Over this, I am rendering an invisible version of this scene only into the depth buffer, so that any other 3D object will be ...
0
votes
0answers
60 views

Sampling the depth buffer and normalizing to [0,1] (DirectX)

I'm trying to visualize (for debugging purposes) the depth of a scene on a textured quad (I want to display the depth of a water pond onto the surface of the water). So what I'm doing is rendering the ...
0
votes
1answer
95 views

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

Developer of the game explains how z-buffer works in Dwarf Fortress (loosely quoted): "If you clear the buffer every single frame, it kills the game. You have sort of a depth of field. You say I need ...
1
vote
2answers
381 views

Tiled2Unity depth sorting issue with multiple layers

I have been struggling with an issue for a couple of days now trying to get depth sorting properly when using multiple layers in tiled. My tiled map is set up as follows: The sorting Layers I have ...
1
vote
0answers
150 views

Shadow Map compression artifacts [closed]

I am having weird artifacts with a shadowmap. The shadows seem to missing inside the polygons. But it is not wireframe rendering, and it is certainly not shadow acne (frontface culling is on and the ...
1
vote
1answer
35 views

Where do the buffer values come from when rendering?

In the textbook I am reading, it talks about fragment tests that are performed when rendering. All of these tests involve comparing the current fragment x value (x can be alpha, color, etc.) with a ...
0
votes
3answers
509 views

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

I am trying to add simple shadow mapping to my friends gles 2.0 app. It is based on gles 2.0 and PowerVR SDK. The problem I encounter is that FBO is not valid due to ...
1
vote
0answers
177 views

Improving Shadow

I need to improve the shadows in my scene. At a first look they don't look too bad: They look awful when the camera gets closer to them, showing weird artifacts. I would like to know what are the ...
2
votes
1answer
846 views

Difference between linear and logarithmic z-buffer

I've searched about this topic for awhile and i couldn't find it on google. I've come across several ways to avoid z-fighting which are linear z-buffer, logarithmic z-buffer and reversed z-buffer. I ...
0
votes
1answer
622 views

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

What I'm trying to achieve is rendering a (huge) tile grid over a terrain. For that I'm using a generated mesh of quads, one for every tile, whose vertices Y value is the same of the terrain to "shape"...
0
votes
1answer
189 views

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

I'm working on shadow mapping. Part of the implementation involves drawing 3D models to a depth buffer with recommended 16-bit depth. To that end, I'm first creating a render target as follows: ...
4
votes
3answers
899 views

Ray tracing and Z buffering in graphics

I am a high school student taking computer science as a subject, and someone who is very interested in the game development industry. I am currently writing an essay on Raytracing and Z-buffering by ...
0
votes
0answers
136 views

Rendering FBO with depth information

OpengGL 4.5 with LWJGL For my particle system, I have billboards that are rendered to an off screen texture. This FBO contains texture information, multiple render targets, a depth texture and a ...
3
votes
1answer
233 views

Reading depth buffer result in only two values

I am attempting to add an SSAO post processing shader to my deferred rendering engine. I am running into problems with reading from the depth buffer. In the images linked below you can see the depth ...
0
votes
0answers
186 views

opengl depth buffer calculation

I'm rendering an earth globe. Real positions of the globe were calculated as the intersections of the ray from camera to cube and the ellipsoid in Fragment shader. And I need to recalculate the depth ...
0
votes
1answer
1k views

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

For performance reasons, i have to create my own billboards to replace some geometry. I modified the standard sprite shader to Cull Back and ...
0
votes
1answer
233 views

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

Let's say that I have standard left-handed WorldToView and ViewToScreen row-major matrices in the same vein as the DirectX ...
0
votes
1answer
456 views

Direct3D11 Depth buffer problem

Encountered a strange error when using Direct3D11, feature level 10.0. If the depth buffer texture is created with the format DXGI_FORMAT_R24G8_TYPELESS, bind flag D3D11_BIND_DEPTH_STENCIL | ...
3
votes
1answer
3k views

Simple cartoon water shader shoreline

I'm currently attempting to create a cartoon-ish water shader with a shoreline. After looking around trying to find out how other games do it i figured out it has something to do with getting the ...
0
votes
2answers
645 views

Unity, depth behind a transparent object

Is there a way to know how far away is any object behind a transparent object in shader? Like making water fully transparent when close to shore.
2
votes
2answers
765 views

color individual triangles on a mesh in Unity?

I am trying to use Unity to display a model and color some triangles on the model to high light those parts of the model. I have created a scene, with a camera, a light source and a cube. After the ...
0
votes
1answer
181 views

Depth test -opengl

Does depth test runs before fragment shader,hence not even processing the fragment with frag shader if fragment is discarded Or It first runs the fragment shader and then depth test I.e. fragment ...
1
vote
0answers
211 views

How to do Decal Clipping with OpenGL using Depth Buffer comparison?

Basically I'm already drawing decals on top of various flat surfaces and that works great. As soon as the decal approaches the edge of a surface, naturally it doesn't get clipped. Is there a way to ...
1
vote
1answer
313 views

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

I am currently in the process of designing an Isometric game, and one of the features we are trying to add, is using sprite depth maps to render geometry in the correct order. The reason we are ...
0
votes
2answers
103 views

DX11 Clear Issue, Irregular pattern

So far I've put together a bare minimum of a DirectX 11 application. All it does is clear the window to a random shade of red. ...
0
votes
1answer
136 views

Z buffer for large vs small objects

Are there common, tried and tested techniques for making sure that when displaying very large and very small objects, in a 3D environment, those objects don't display in front or behind each other? ...
2
votes
2answers
402 views

Why is my depth buffer texture so bright?

https://www.youtube.com/watch?v=QuvAEqgHrMY&feature=youtu.be https://www.youtube.com/watch?v=5ob1JsPIGAs&feature=youtu.be ...
2
votes
3answers
257 views

Process of writing to the depth texture

In openGL, let's say I output one single point from the vertex shader with this value gl_Position = vec4(2.0,3.0,5.0,7.0); what exact math operations happen to "...
0
votes
1answer
128 views

Webgl: is possible to use one color buffer to unsharp masking the depth buffer?

I'm noob to webgl. After reading the tutorials at webglfundamentals.org and "Introduction to Computer Graphics", i'm able to succesfully draw some stuff and the depth buffer without thirty-party ...
1
vote
1answer
603 views

How to enable depth test with QOpenGLWidget? It renders black screen

Currently I am writing a small application with Qt and OpenGl and I choosed QOpenGLWidget for rendering graphics. That's how I declared my widget: ...
4
votes
1answer
805 views

An invisible object that deletes anything behind it?

I am using augmented reality to put a 3D object on top of a "camera detected" object. The 3D object can be though of as leaves that go above the real world object but also fall in front / behind / on ...
2
votes
1answer
653 views

Is it possible to create a homemade depth buffer?

Studying the case of isometric rendering, I'm facing a big and well-known problem : depth sorting. After many researches it seems that without tile mapping or 'height-leveling' it's impossible to ...
1
vote
1answer
385 views

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

I've been using the glxinfo command (glxinfo -v) to explore the supported framebuffer configurations. There are two values relating to depth, "depth" and "depthsize." According the source, it appears ...
4
votes
3answers
240 views

Image-Space coherence of the z-buffer algorithm

I'm reading Hierarchical z-Buffer Visibility by Ned Greene et al. and they state that traditional Z buffering makes reasonably good use of image-space coherence in the course of scan conversion. I ...
1
vote
0answers
696 views

Why does reverse depth buffering provide more precision? (with DXGI_FORMAT_D24_UNORM_S8_UINT Datatype layout)

I lately came around methods optimizing the use of the depth buffer, as the easiest solution reverse depth buffering is mentioned but I cannot wrap my head around why I would be gaining a better depth ...
0
votes
0answers
164 views

SlimDX 11: Setting Multiple Render Targets

I'm using SlimDX 11 in my managed Direct3D application. I would like to implement deferred shading. I'm having trouble when I try to set a depth stencil surface and multiple render targets at the same ...
7
votes
1answer
2k views

Depth Peeling implementation problem: How to render the next layer? (OpenGL)

I try to implement order-independet transparency sticking to the pseudo code in the linked paper (page 4). I can't figure out how they are able to do this in OpenGL. I am rendering the scene two ...
1
vote
2answers
408 views

How to combine depth and stencil tests?

I have a continuous height-mapped mesh to represent landscape. I use the stencil test to create holes in the mesh. I draw holes to the stencil buffer and then use it to discard mesh fragments. ...
0
votes
1answer
138 views

OpenGL: strange thing with depth and text rendering

TL;DR I render a scene with M,V,P matrices as always. Than I render something (in this case - text) without any matrices and using separate shaders pair on coordinates with Z = -1. Somehow it's ...
1
vote
2answers
305 views

Does Direct3D 11 enable Z-clipping/discard by default?

I'm rendering simple 2D figures in DirectX 11.1 and I cannot get Z-values to be rendered; all pixels with Z != 0 get discarded. I'm doing proper world transform as far as I know. X/Y translations work....
1
vote
1answer
619 views

Depth testing before fragment shader

Accoring to this, depth testing is usually performed after the fragment shader stage. Why is that? I thought that a fragment is sent with its depth value to the FS, then the depth test happens before ...
1
vote
1answer
253 views

OpenGL Picking: How to avoid entities?

I have a terrain and entities(npc, house...). I'm able to convert screen coordinates to world coordinates with the glReadPixels function: ...
2
votes
1answer
570 views

Render scene depth to texture via FBO?

I'm trying to render my scene's depth via FBO and Render To Texture. I have a scene that I'm rendering to a texture, then render that texture to a fullscreen quad in a second pass using a fragment ...
1
vote
1answer
1k views

Raymarching on a Hi-Z buffer in GLSL

So I'm trying to implement Screen Space Reflections using a Hierarchical z-Buffer in GLSL. I'm following the approach from GPU Gems 5 and the Frostbite presentation linked here ("Stochastic Screen-...
0
votes
1answer
272 views

How to use default framebuffer's depth/stencil when rendering to a texture?

Is it possible to use the default framebuffer depth buffer when rendering to a texture (instead of using a depth texture)? The Idea is to continue to render part of the scene normally but on a ...