ShadowColor
uniform sampler2D shadowcolorN;
layout (<format>) uniform image2D shadowcolorimgN;
The shadow pass supplies two color attachments for outputing color/data, shadowcolor0
and shadowcolor1
. These buffers can be read from any program, and can be written to from the fragment stage of the shadow
and shadowcomp
programs.
Writing
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.
Size
These buffers default to the shadow pass resolution, which can be controlled with the shadowMapResolution
constant.
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.
Clearing
By default these buffers clear their values after each frame to solid white (vec4(1.0, 1.0, 1.0, 1.0)
). This behavior can be configured with the shadowcolorNClear
directive, and the clear color can be configured with the shadowcolorNClearColor
directive.
Flipping
Each shadowcolor sampler actually contains two buffers, which allows you to read from and write to the same buffer in the same pass. The buffer flipping behavior can be controlled with the flip.<program>.<buffer>
directive.
Legacy
AliasesThe sampler shadowcolor0
is also accessible through the legacy alias shadowcolor
.
Iris Exclusive
Extended shadowcolorThe Feature Flag HIGHER_SHADOWCOLOR
enables additional shadowcolor buffers, shadowcolor2
through shadowcolor7
. These are identical to the other shadowcolor buffers outside of their name.