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.
28 questions with no upvoted or accepted answers
5
votes
0
answers
2k
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 ...
3
votes
0
answers
410
views
Avoiding z-fighting when reimplementing Freescape games
I need to avoid z-fighting in exactly co-planar surfaces that are too close to the other solids. I'm re-implementing the Freescape engine in ScummVM (all my code is open-source, available here), and ...
3
votes
0
answers
384
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 ...
3
votes
1
answer
3k
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 ...
2
votes
0
answers
350
views
Is it possible to extract both the color and the depth texture from one RenderTexture and use it in a Shader?
I can access the same with duplicating the cameras AND the rendertextures, but that seems like a lot of overkill of just getting the depth buffer.
I don't need a very precise depth buffer, so it can ...
2
votes
1
answer
264
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 ...
2
votes
0
answers
35
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 ...
2
votes
0
answers
710
views
How do you tell OpenGL ES 2.0 to use a texture as the depth buffer?
I want to render a scene with an outline post processing effect in OpenGL ES 2.0.
First I render all the opaque objects. Then I use a post processing shader
for silhouette detection that uses the ...
2
votes
0
answers
280
views
Get Specific depth values in Kinect (XNA)
I'm currently trying to make a hand / finger tracking with a kinect in XNA. For this, I need to be able to specify the depth range I want my program to render. I've looked about, and I cannot see how ...
1
vote
0
answers
96
views
How to pass two RenderBuffers into one RenderTexture?
I have a Unity URP project and in the Scriptable Render Pipeline, I would like to create a RenderTexture and pass the depth and color buffer of the camera object as ...
1
vote
0
answers
259
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 ...
1
vote
0
answers
147
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:
...
1
vote
0
answers
355
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 ...
1
vote
0
answers
838
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
0
answers
1k
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 ...
1
vote
0
answers
986
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 ...
0
votes
0
answers
300
views
Order-independent rendering of 2D sprites
I am using OpenGL to render sprites, using an orthographic projection.
Each sprite has a position: (x, y, ...
0
votes
1
answer
154
views
How to change layer depth according to player location?
I would like to change the layer depth of objects, so that the player can go behind them. Right now it looks like this when the player is behind the object:
The problem is that the layer depth doesn'...
0
votes
0
answers
104
views
Is it possible to activate/deactivate depth writes in geometry shader?
I'm trying to achieve rendering to multiple targets with multiple viewports. Currently it does not work possibly because I have a single depth buffer so a first write to it with a specific viewport ...
0
votes
0
answers
930
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:...
0
votes
0
answers
115
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 "...
0
votes
0
answers
230
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 ...
0
votes
0
answers
71
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?
0
votes
0
answers
143
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 ...
0
votes
0
answers
140
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 works,...
0
votes
1
answer
199
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
0
answers
334
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 ...
0
votes
1
answer
985
views
How to update "dynamicVertexBuffer" correctly with "setdata" on XNA?
I developed a small 3d games xna and uses a "DynamicVertexBuffer" and "DynamicIndexBuffer" to store and draw my vertices. Everything works fine, but my problem is the "Update" function where I update ...