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.

learn more… | top users | synonyms

2
votes
0answers
12 views

Strange depth map projection

I'm trying to implement depth-only SSAO and for that, I render a depth map into a texture and pass it to my SSAO shader which then uses it. The problem is that when I try to output the depth map ...
2
votes
0answers
25 views

OpenGL Depth Cubemap with Geometry Shader Not Rendering Correctly

I was having some trouble with cubemaps in OpenGL, and was hoping to get some help. I've been following a tutorial about point light shadow mapping using cubemaps, where a geometry shader is used to ...
1
vote
1answer
29 views

What are the units when reading depth using glReadPixels()?

Suppose I use glReadPixels() to read the depth of a pixel from the depth buffer. What are the units of this? Is it the distance from the camera? Or the distance from the near clip plane? And is the ...
0
votes
0answers
24 views

Drawing directly to XNA depth buffer

Is it possible to set the depth buffer (i.e. draw depth values directly) in XNA? All the examples I could find are showing how to render a 3D scene to a RenderTarget2D and get the depth information ...
3
votes
2answers
120 views

Render Occluded pixels to gray color

In 3d space, objects can be occluded by another objects. By depth testing, the occluded faces are skipped rendering. Only the nearest(smallest) depth value pixels are drawn. But, sometime we need to ...
8
votes
3answers
304 views

Using full resolution of depth buffer for 2D rendering

I'm working on a front-to-back renderer for a 2D engine using an orthographic projection. I want to use the depth buffer to avoid overdraw. I have a 16-bit depth buffer, a camera at Z=100 looking at ...
1
vote
3answers
65 views

Grab depth buffer with unlockable D3DFORMAT

I'm currently piggy backing on a mod framework (Multitheft Auto) and trying to read the depth buffer in D3DFMT_D24S8 (DirectX9). I can read it if I change the format to D3DFMT_D32F_LOCKABLE and then ...
2
votes
1answer
218 views

Creating polygons with separate outline/fill colors in OpenGL

Subject I am creating a terrain map with triangle strips and I would like to make the bodies of the triangles black, but have their outlines be colored. Problem The solution appears to be to draw ...
1
vote
1answer
74 views

Does glScissor affect stencil and depth buffer operations?

I know glScissor() affects glColorMask() and glDepthMask(), but does it affect the stencil and depth buffers? For example: glEnable(GL_DEPTH_TEST); glEnable(GL_SCISSOR_TEST); ...
0
votes
3answers
133 views

Is computing depth in a pixel shader bad? Can I reduce fillrate by moving depth calc to vertex shader?

I have a DX10 game that is fillrate bound. One of the things I've been realizing may be contributing to this is that I compute depth in the pixel shader (the game uses a logarithmic depth buffer to ...
0
votes
0answers
65 views

unity pass texture from one camera to another for shader

I'm working on a system where I have to get a texture from one camera to another (render a -> render b) is there an easy way to do this? For a simplified example this would be used to get the ...
0
votes
1answer
56 views

Wrong distance in Depth-buffer

I am currently trying to get the Depth Buffer as a texture to use it for edge detection algorithms. Since XNA4 does not allow direct access to the Depth Buffer as texture i have to render it into a ...
5
votes
1answer
486 views

unity 5 how to get a shadowmap

I'm writing a custom shader in unity 5 that requires a shadowmap (not just for drawing shadows but also for different computations involving scattering particles through fog). Does anybody know how to ...
0
votes
2answers
127 views

Z-Value of clip-space position is always 1.0

I render a lot of quads on the screen into z direction (20 x 2000). I want to get the depth value in a final render target. But it looks like z is always 1.0f. I checked the result with the OpenGL ...
0
votes
1answer
229 views

Getting the real fragment depth in GLSL

I am trying to write a simple GLSL shader that just renders the real (not normalized) depth of a fragment as a floating point value. So far, I've figured out how to get the depth of a vertex, and ...
1
vote
1answer
732 views

Discard Transparent Pixels in Z-Buffer

I am building a 2D game using sprites. I'd like to use the z-buffer to aid with shading. For that I need Unity to write only opaque pixels to the z-buffer (aka depth buffer). In Unity, sprites are ...
1
vote
1answer
2k views

Unity3D sprites vs Mesh Quads - Depth, Blending, Shadows

I'm new to unity but not new to game development. In my OpenGL ES 2.0 (mobile) games I create a vertex array of all my "sprites" and stuff it in a VBO. Then draw them as I need them one at a time, ...
0
votes
0answers
136 views

Directx9 engine Z-buffer problem with d3dimage

I am trying to integrate my Direct9 engine into my new WPF application via D3DImage. Everything is working except for the Z buffer. With the AutoDepthStencil at FALSE I can render my meshes but the ...
0
votes
1answer
270 views

How to disable depth buffer in Directx11

For now i know what i must use OMSetDepthStencilState. In the beginning i must create two states and change them every time i need another. For now i have this and it doesn't work, i.e. objects ...
4
votes
1answer
170 views

How to compute point in view space from depth?

I am trying to implement do some screen space rendering but after looking over the web I still don't find answers to some doubts. First, I need to compute the point in view space from a value in the ...
3
votes
1answer
181 views

Modifying depth values in PixelShader (SharpDX)

I'm relatively new to DirectX, and am currently converting some WPF 2D graphics code that displays geo-located sonar returns. I am using SharpDX, and rendering via a D3DImage. I've got the basics ...
1
vote
1answer
352 views

Triangles go missing as Z changes

I'm rendering a height map using shader-based OpenGL (3.3 to be precise). The height map data is from a grayscale bitmap (2D array of bytes). The dimension of the bitmap is 256 x 256. With this data, ...
3
votes
1answer
201 views

Shadow mapping. I don't understand what to do after creating the depth texture

I'm taking an intro to computer graphics course, so this is something we haven't touched on. I am reading this tutorial ...
0
votes
0answers
27 views

Artefact in VSM as if GL_DEPTH_TEST disabled

I am trying to implement VSM and I incurred in a strange issue. I render them as follow: glUseProgram(shadowMapProgramID); glEnableVertexAttribArray(0); glBindFramebuffer(GL_FRAMEBUFFER, ...
0
votes
2answers
753 views

How do I sample a Depth/Stencil Texture in HLSL?

I am shadow mapping in Direct3D 9. I'm trying to avoid rendering depth to a 32-bit render target. So, I've created a depth/stencil texture( a texture w/usage Depth/Stencil ). When I render I do this: ...
0
votes
0answers
38 views

OpenGL: What's the best way to convert a screen coordinate to a world coordinate? [duplicate]

For example, suppose I'm building a first-person shooter and the player pulls the trigger. I want to convert the screen coordinate (x, y) into a world coordinate (x, y, z) to know what they've hit. ...
0
votes
0answers
139 views

Depth texture white in shader

I am trying to implement shadow mapping into my project and am stuck at this problem: If I'm reading the shadow map values with glReadPixels and linearize those values, I am getting exactly the value ...
1
vote
0answers
191 views

Unity Free Inverse Depth Mask?

How would it be possible to create an inverse depth mask? In this case, I refer to a depth mask as a shader attached to a mesh that 'pokes a hole' through the current camera layer to let you see the ...
2
votes
1answer
376 views

OpenGL ES draw pre-rendered background onto depth buffer

I want to create a scene with 2D pre-rendered background and 3D models for characters (like those classic Final fantasy games). For the background, I have 2 textures: one to be displayed, with ...
2
votes
2answers
103 views

Dealing with back to front drawing with alpha blending and z buffer for a list of 2d quads

I'm using depth buffer as a layering system for my 2d render and I have to draw them from back to front to make semi-transparent quads work out. The problem is I have to sort my quads vector based on ...
1
vote
1answer
124 views

Obtain linear depth values on FBO and deal with small differences

I've a render target on which I have both a color and a depth attachment. In a second pass I need to run a filter whose width depends on the derivative and values of the depth. Now, if I try, in the ...
1
vote
2answers
325 views

How to determine the visibility of a single vertex, given a viewpoint?

I have a 3D triangle mesh, and I want to know, given a viewpoint (defined by a model, view and projection matrix), if a certain vertex is visible or not. My approach was to render the mesh using ...
2
votes
1answer
220 views

Use different values for Depth Test and Depth Write in OpenGL

Is there a way to use something similar to PolygonOffset to make a depth test more permissive (move fragment depth towards eye) but still write the original depth value to the depth buffer? The only ...
0
votes
1answer
65 views

DepthStencilView and alphaBlendState

I have create a 2D game with directx11 and i want to use a depth buffer instead of a painter's algorithm to draw the sprites but i have a problem since i'm not really good with directx 3d programming. ...
2
votes
1answer
116 views

Disable depth testing for only some faces

I have some meshes and I need to be able to draw some part of them without depth test. Is it possible to turn off depth testing from within shader, wo that some parts will be rendered no matter what ...
3
votes
1answer
440 views

Self occluding object and alpha blending

Look at the object I've rendered with my app: It's the same screen twice, above the original and below I've drawn (by hand :P) the shape of the mesh of one of plant's leaves. You can clearly see ...
1
vote
2answers
239 views

Layer depth problem

I try to create Puzzle JigSaw,and I want to display the selected piece on the first layer, the pieces that are on the original positions(solved) on the last layer and the others on the middle. I ...
0
votes
1answer
1k views

OpenGL Reconstructing Position from Depth

I know this has been asked a lot of time before but none of those answers fixed my problem. I try to implement deferred shading and to do so I need to reconstruct the world space position from the ...
0
votes
0answers
46 views

OpenGL - How to use depth checking and alpha blending at the same time? [duplicate]

Suppose I have a semi-transparent object (let's call this "bubble"), a solid object (let's call this "wall"), and the bubble is closer to the camera compared to the wall behind it. If I draw the ...
6
votes
1answer
345 views

overlapping 3d particles not blending nicely when at the same z

I'm working on a 3d particle emitter. It's going pretty good but I'm still having a problem with triangle sorting. As you can see in the photos, there are some particles that are not blending ...
1
vote
2answers
608 views

Depth write and depth test in Unity

Scenario: several objects (o1, o2,.., on) have to be rendered with the z test disable, but the z values must be written to the depth buffer. In another pass, some other objects (t1, t2,..., tm) need ...
2
votes
2answers
629 views

IsoMetric Map draw: sort with Topological Sort, Z-Buffer and anchor point

I'm writing an IsoMetric renderer for my html5 isometric game. The isometric renderer should be able to render objects with floating point coordinates. DEMO: http://matt93.altervista.org/game/ ...
2
votes
1answer
876 views

How to best utilize depth buffer precision

Are there strategies to minimize depth buffer precision problems with hyperbolic depth buffers, such as the ones resulting from perspective projection matrices, or depth buffers in general? For ...
0
votes
1answer
143 views

Changing the maxDepth of viewport

Whenever I change the maxDepth of the viewport from 1.0 to say 300.0f (just for kicks), everything on my screen disappears. Why is that? Is there anywhere else I have to account for this change in ...
1
vote
1answer
572 views

Why does switching to fullscreen produce this graphical glitch?

I followed this tutorial and things were looking good. However, when switching to Fullscreen from 800x600 using alt-enter, I noticed an error in debug output: DXGI WARNING: IDXGISwapChain::Present: ...
0
votes
1answer
311 views

Creating a 2D texture array for depth view

Following my question here, I decided to create an 2D texture array for all of my depth screen texture so that I can use them for shadows for all my lights. I'm having an issue setting it up, I'm ...
0
votes
1answer
131 views

XNA DepthBias increases performance even when EarlyZ is turned off. Why?

My 3d scene consists of three main polygons: The first and the second polygons overlap each other (have the same World matrix and use the same geometry), the third one is perpendicular to the first ...
0
votes
1answer
702 views

How to print Depth to a Texture2D and then read it in the next pass on a shader in DirectX11

I'm programming a two-pass effect in DirectX 11 (SharpDX). It's supposed to write the depth to a texture in the first pass and then use that texture to extract data on the second one in the pixel ...
2
votes
1answer
1k views

Use depth bias for shadows in deferred shading

We are building a deferred shading engine and we have a problem with shadows. To add shadows we use two maps: the first one stores the depth of the scene captured by the player's camera and the ...
0
votes
2answers
160 views

Accesing depth buffer from shader

I read this presentation and on 6th slide I found that is not need to use multiple render targets and depth can be taken directly from depth buffer. From which version of DirectX or OpenGL can be ...