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.
1
vote
1answer
52 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 ...
1
vote
0answers
21 views
Multiple Depth masks rendered individually [closed]
I'm using THIS shader to create some holes in walls to serve as windows and doors.the problem is that if I put a window on a wall and look through it, other walls won't be rendered like the wall with ...
0
votes
2answers
57 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.
const FLOAT clearColor[4] = { rand() / (float) RAND_MAX, 0.0F, 0.0F, 1....
0
votes
1answer
35 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?
...
1
vote
2answers
69 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
gluPerspective(60, (float)CONTEXT_WIDTH / CONTEXT_HEIGHT, 0.1f, 1.f);...
1
vote
3answers
104 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 "z" after leaving the vertex shader?
...
0
votes
1answer
40 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
106 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:
class GLWidget : public QOpenGLWidget, protected ...
4
votes
1answer
252 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 ...
1
vote
1answer
106 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 ...
0
votes
1answer
113 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 ...
1
vote
1answer
62 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.
...
1
vote
0answers
111 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
43 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
438 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
137 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
57 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
118 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
32 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
109 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:
glReadPixels(mousePosition.x, mousePosition.y, 1, 1, ...
2
votes
1answer
159 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
395 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
78 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 ...
1
vote
1answer
55 views
Write depth value to a render target
I want to write depth value to a render target, not depth buffer. So I output the clip space position from vertex shader and divide by w on pixel shader.
Here is the code of how I do this
// Vertex ...
0
votes
1answer
384 views
SSAO, depth buffer linearization (?)
I'm trying to implement SSAO in my application but it doesn't look as it should. I think that the problem is with depth buffer linearization but I tried almost all methods which I found on the Web and ...
3
votes
1answer
107 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 ...
3
votes
0answers
316 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
134 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 ...
3
votes
2answers
395 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
672 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 Z=...
1
vote
3answers
185 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
1k 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
136 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);
glEnable(...
0
votes
3answers
225 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
1answer
79 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
2k 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
302 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
2k 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
2k 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
5k 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
1answer
1k 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
648 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 ...
5
votes
1answer
478 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 ...
2
votes
1answer
871 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
285 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 http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-...
0
votes
0answers
32 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
2k 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
39 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.
I'...
0
votes
0answers
244 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
404 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 ...