Hi, I'm wondering whether the quad mesh's depth during quad pass can be controlled.
I would appreciate it if someone could explain how the quad geometry is constructed during quad pass.
Thanks
Hi, I'm wondering whether the quad mesh's depth during quad pass can be controlled.
I would appreciate it if someone could explain how the quad geometry is constructed during quad pass.
Thanks
Do you mean per pixel or per vertex?
I would appreciate it if someone could explain how the quad geometry is constructed during quad pass.
PassQuad uses v1::Rectangle, which means the vertices are populated in Rectangle2D::_restoreManualHardwareResources
here.
The depth is hardcoded to z = -1 which, when multiplied against an identity projection matrix in the vertex shader (see Samples/Media/2.0/scripts/materials/Common/GLSL/Quad_vs.glsl
and HLSL/Metal equivalents), the Z value becomes either 0 (D3D11/Vulkan/Metal), -1 (OpenGL) or 1 (D3D11/Vulkan/Metal when reverse Z is enabled, aka the default).
Whether a quad or a triangle is used depends on the use_quad
compositor option (see Manual)
Code: Select all
Do you mean per pixel or per vertex?
Per Pixel. i have to do this on shader i assume.
Thanks for explaining how the quad geometry is constructed.
I forgot to reply per pixel.
See Samples/Media/2.0/scripts/materials/Common/GLSL/DepthDownscaleMax_ps.glsl which outputs to gl_FragDepth
(and its HLSL/Metal equivalents).
Please note that outputting to gl_FragDepth will disable various GPU HW optimizations for anything that is rendered afterwards (Hi Z, Early Z, depth compression, etc). See Depth In Depth. It's an old article, but most of what it says still holds for desktop GPUs.