All Questions
Tagged with depth-buffer opengl
57
questions
3
votes
0
answers
309
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 ...
0
votes
0
answers
102
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
0
answers
120
views
Set depth value in fragment shader
I'm making a simple 2D renderer and I want to avoid redrawing as much as possible.
My Vertex layout has the 2d position and a float depth value.
I want to assign a depth value to each of them after ...
1
vote
1
answer
366
views
Graphical issue when using a depth pre-pass
I have implemented the Z pre-pass technique into my engine, leading to a 2x performance improvement in a test scene.
However, the technique darkens the objects (but not the skybox), introduces z-...
0
votes
1
answer
718
views
How to execute early depth test
I have trouble applying early depth test in my engine, to prevent fragment shader to be (fully) executed for fragments that will be overwritten anyway, because other fragments, drawn later, will be in ...
2
votes
1
answer
203
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:
...
0
votes
0
answers
757
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
1
answer
674
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:
...
0
votes
0
answers
142
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 ...
1
vote
1
answer
1k
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 ...
0
votes
1
answer
222
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 ...
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 ...
0
votes
1
answer
1k
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
1
answer
381
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
0
answers
675
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 ...