I have two geometry passes first, I have a float with However, for some fragments the depth test fails until I have a slightly lower depth value ( Setting of Texture: Keep in mind that texture is used as a colored attachment, not a depth attachment. I have disabled Vertex shader is used both near: The first pass piece shredder, The second pass, writing the default framebuffer texture is used as the The unchanging qualifiers in the peak shider did not help, using Have you tried glDepthFunc (GL_EQUAL) instead of your in-shader-comparison-approach ? Are you reading the same depth and writing the same passage? I'm not sure gl_FragCoord's format is correlated with one of the precise depth-buffer. In addition it may be a driver's fault, but glDepthFunc (GL_EQUAL) should work as expected. glBlendEquation (GL_MIN) I write the depth value of a piece of texture, similar to peeling at double depth. In the second pass, I use it for the first depth test in the stadium shader.
eps ):
Globinated (GL_TEXTUREDD, Offscreen DeepthmatAct IDIDID); GlTexStorage2D (GL_TEXTURE_2D, 1, GL_RG 32F, Screenwidth, Screenshite); GlobindFrumbbuffer (GLDRARDFRAMFFER, OffscreenDipthamFFOID); GlFramebufferTextxture2D (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, OffscreenDiIPTipEycodes, 0);
GL_DEPTH_TEST in both directions, because I can not use it in the last pass.
# version 430 layout (location = 0) in vec4 position; Uniform Unmatched 4 MVP; Irreversible instinct; Zero main () {gl_Position = mvp * position; }
offscreenDepthMapFboId is bound, so it writes the depth as the color of the texture. The combination ensures that only the minimum value ends in the red component.
# 430 outputcolor out vec4; Zero main () {outputColor.rg = vec2 (gl_FragCoord.z, -gl_FragCoord.z); }
depth .
# 430 vec4 out of outputColor; Uniform Sampler 2D Depth Tex; Zero Main () {vec2 zwMinMax = texelFetch (Depth Tex, ivec2 (gl_FragCoord.xy), 0) .rg; Float Zoom = zwMinMax.r; Name zwMax = -zwMinMax.g; Float eps = 0; // does not work // float eps = 0.0000001; // works (gl_FragCoord.z> zwMin + eps) discarded; Output color = VC4 (1, 0, 0, 1); }
eps = 0.0000001 seems like a raw work because I can not be sure Is that this special value will always work. How do I get two shaders to create the exact same
gl_FragCoord.z ? Or is the depth texture problem? wrong format? Is there a conversion that I do not know?
No comments:
Post a Comment