DepthTex
uniform sampler2D depthtexN;
There are three samplers for accessing the depth buffer.
depthtex0
includes all geometrydepthtex1
excludes transparent geometrydepthtex2
excludes transparent and heldheld geometry
These buffers can be read from any program, but will contain garbage data until the respective gbuffers
shader has executed. For example, depthtex1
will first contain meaningful data in the deferred
stage.
Writing
These buffers are automatically written to by gbuffers
programs, and store the screenspace z coordinate at each pixel. You can manually write to this buffer by setting the gl_FragDepth
variable in any gbuffers
fragment shader. If gl_FragDepth
is used in a shader, the automatic writing will be disabled and the shader is responsible for writing all depth values.
Size
These buffers are the same resolution as the Minecraft window. This cannot be configured.
Format / precision
These buffers only store information in a single channel, the r
component. The depth buffer precision is hardware / driver dependent. However, most hardware uses either 24-bit or 32-bit (R24
or R32
) precision.
Clearing
All these buffers clear to vec4(1.0)
. This cannot be configured.
Flipping
These buffers do not flip.
Legacy
Aliasesdepthtex0
can be accessed through the legacy alias gdepthtex
.