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.

Filter by
Sorted by
Tagged with
0 votes
1 answer
30 views

Why do I still get values from _CameraDepthTexture even if I didn't set depthTextureMode?

I forgot to write this C# code to enable depth from my camera: ...
user avatar
2 votes
0 answers
54 views

Depth func LESS EQUAL not working as expected

How is it possible that a fragment is generated, passes the depth test but isn't written to the current render target? This is the pixel history I see if I capture a frame in RenderDoc: The fragment ...
user avatar
0 votes
0 answers
18 views

Trouble calculating position from depth buffer

Position can be reconstructed from depth but I did not succeed in achieving the correct calculation. I've found these two pieces of code for view/world pos, but can't make it work. For getting view ...
user avatar
  • 37
0 votes
1 answer
118 views

How to modify the z depth value inside the vertex function of a surface shader?

I wrote the following surface shader. The idea is to increase the Z depth value of vertices, after projection. ...
user avatar
  • 3,132
-1 votes
1 answer
92 views

Drawback of painters algorithm:

We know that to scan convert any polygon first we need to pass any 4 tests of Painter's algorithm. Suppose I have two polygon S1 and S2, which order is S1->S2.we see that all 4 tests are failed. ...
user avatar
2 votes
1 answer
86 views

How to get rid of intersections between terrain and road strip drawn on top?

When I draw a road as is (stencil:off, depth:on,less), the results are like this - ; Then I tried adding stencil a test for the road: ...
user avatar
1 vote
0 answers
41 views

Z-Fighting mitigation performance overhead

Which of following approaches will have less performance overhead(using threejs renderer)? I am currently have an issue with z-fight for distant objects, while my near/far plane is already set to most ...
user avatar
3 votes
1 answer
86 views

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

I'm not a game developer, but a researcher working on improving video quality in various contexts. For my current problem, I need to collect videos which have both RGB data as well as depth data. ...
user avatar
0 votes
0 answers
278 views

For drawing many layered 2D tiles, should one use the painter's algorithm, or Z-buffering?

Sorry if this question doesn't make sense, I'm still very new to WebGL / OpenGL. Basically, I'm trying to draw a tilemap similar to the one in Stardew Valley. Here's a screenshot from that game: https:...
user avatar
0 votes
1 answer
174 views

Why does reading my depth texture in GLSL return less than one?

I've created a depth texture in OpenGL (using C#) as follows: ...
user avatar
  • 529
0 votes
1 answer
1k views

Howto use the depth buffer in DirectX 12

To make things short: I am trying to bind and use a depth buffer in D3D12, but it is not working. The depth buffer gets created and bound properly (I can see it in nsight graphics) but does only take ...
user avatar
1 vote
0 answers
59 views

OpenGL ES - render to texture - how to preserve original depth buffer

I render to texture and attach my own depth buffer that has texture target. However, after I finish rendering I would like to set original depth buffer back. To start rendering to texture I do: ...
user avatar
  • 1,086
1 vote
1 answer
1k views

How to write depth texture and read values from it

I am new in Unity and specializing in another field. But now I have to rapidly study it for a new project. I will be very thankful if anyone explain me how to read values of the depth buffer. I wrote ...
user avatar
0 votes
0 answers
43 views

Punching holes through a texture and making them regenerate back again in an efficient way

I'm working on a prototype where the user can use the mouse to punch holes through a texture, making this texture see-through in that area for a certain amount of time. After that time, the hole will "...
user avatar
  • 331
0 votes
0 answers
65 views

Implementing W-buffering in modern GPU

I was trying to figure out how perspective projection matrix works, and somehow I ended up in this rabbit hole of depth buffer precision. It seems to be some interest in a depth buffer where the ...
user avatar
  • 153
0 votes
0 answers
29 views

How to always draw a child mesh in front of its parent mesh

I need to display a gizmo-like mesh at runtime, and it must be always in front of its target mesh. How can I achieve that?
user avatar
2 votes
0 answers
30 views

Cheap way to soften contactpoint of character with ground

The view of my game is always semi topdown. I'm trying to make the contactpoint between characters and the floorplane more grounded without rendering hundreds of sprites. One thing that I think could ...
user avatar
  • 121
0 votes
0 answers
76 views

How to get depth buffer from PUBG?

I have no any experience in game development, I'm doing some research on machine learning tasks and for my project I need to know how to get depth buffer. I tried to google but haven't found relevant ...
user avatar
2 votes
2 answers
218 views

z ordering in directx11

Hi recently i am trying to implement z ordering system into my directx framework. So every object will have z order property(int), and this value will have higher priority than depth checking for ...
user avatar
0 votes
0 answers
111 views

Part of the back side of a transparent object disappears

I did some blending and culling to get the image below. As you can see, it is messed up. On the right side of the image, only the front side of the mesh shows. On the left side of this image, it ...
user avatar
1 vote
1 answer
235 views

Can't get Direct3D11 depth buffer to work

I can't get the depth buffer to work correctly. I am rendering 2 cubes in a single Draw function, and from one angle it looks great But swing the camera around to view the opposite sides, and I ...
user avatar
1 vote
1 answer
671 views

glReadPixels with GL_DEPTH_COMPONENT into PBO is slow

I need to read depth buffer back to cpu memory. It may be few frames old, so I use glReadPixels with a buffer bound to GL_PIXEL_PACK_BUFFER. I use several buffers and ping-pong them. Finally, I read ...
user avatar
  • 53
0 votes
1 answer
218 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 ...
user avatar
0 votes
1 answer
99 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 ...
user avatar
  • 690
0 votes
1 answer
140 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 ...
user avatar
  • 591
1 vote
3 answers
702 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 ...
user avatar
  • 125
0 votes
1 answer
243 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 ...
user avatar
  • 172
0 votes
1 answer
194 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 ...
user avatar
  • 197
1 vote
2 answers
877 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 ...
user avatar
1 vote
1 answer
42 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 ...
user avatar
0 votes
3 answers
2k 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 ...
user avatar
1 vote
0 answers
298 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 ...
user avatar
  • 1,102
3 votes
1 answer
2k 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 ...
user avatar
  • 979
0 votes
1 answer
2k 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"...
user avatar
  • 135
1 vote
1 answer
580 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: ...
user avatar
  • 529
4 votes
3 answers
3k 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 ...
user avatar
3 votes
0 answers
314 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 ...
user avatar
  • 103
0 votes
1 answer
3k 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 ...
user avatar
0 votes
1 answer
678 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 ...
user avatar
  • 11
0 votes
1 answer
1k 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 | ...
user avatar
  • 1
2 votes
1 answer
5k 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 ...
user avatar
0 votes
2 answers
1k 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.
user avatar
  • 138
4 votes
2 answers
3k 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 ...
user avatar
0 votes
1 answer
242 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 ...
user avatar
1 vote
0 answers
459 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 ...
user avatar
  • 442
1 vote
1 answer
515 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 ...
user avatar
0 votes
2 answers
225 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. ...
user avatar
0 votes
1 answer
308 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? ...
user avatar
  • 203
2 votes
2 answers
1k 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 ...
user avatar
  • 1,102
2 votes
3 answers
398 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 "...
user avatar
  • 129