ShadowColor
uniform sampler2D shadowcolorN;
layout (<format>) uniform image2D shadowcolorimgN;
The shadow pass supplies two color attachments for outputing color/data, shadowcolor0
and shadowcolor1
. These samplers can be read from any program, and can be written to from the fragment stage of the shadow
and shadowcomp
programs.
Writing to ShadowColor buffers
Any shadow
or shadowcomp
program can write to a shadowcolor buffer, the buffers to write to can be selected with the RENDERTARGETS
or DRAWBUFFERS
directive.
Additionally, you can read and write to shadowcolor0
and shadowcolor1
using the image bindings shadowcolorimg0
through shadowcolorimg1
in any program. This is the only way to write to shadowcolor buffers from compute shaders. For more information on image load/store, see the Khronos Wiki.
Buffer size
These buffers default to the shadow pass resolution, which can be controlled with the shadowMapResolution
constant.
Buffer format/precision
These buffers default RGBA
format (which defaults to RGBA8
on most systems), but this can be configured as described in the Texture Formats section.
Buffer clear
By default these buffers clear their values after each frame to solid white (all 1s including alpha) This clearing behavior can be configured with the shadowcolorNClear
directive, and the clear color can be configured with the shadowcolorNClearColor
directive.
Ping-Pong buffers
Each colortex sampler actually contains two buffers, which allows you to read and write to the same buffer in a composite/deferred pass. The buffer flipping behavior can be controlled with the flip.<program>.<buffer>
directive.
Legacy Alias
The sampler shadowcolor0
is also accessible through the legacy shadowcolor
alias.
Extended Shadowcolor
The Feature Flag HIGHER_SHADOWCOLOR
enables additional shadowcolor buffers, shadowcolor2
through shadowcolor7
. These are identical to the other shadowcolor buffers outside of their name.