What is a DataShader
A shader that passes vec4 and float data up the chain instead of material properties.
A DataShader is used in a DataMaterial. It has its own setup macros and layer variables. See DataShader reference.
A DataShader doesn't output material properties. Instead it outputs up to 16 vec4 and 16 float values that are passed up the chain. Every layer above it can read these values, regardless of its type.
A DataShader uses the LAYER_OUT_TEX_* and LAYER_OUT_MASK_* layer variables to output values, and the LAYER_BELOW_TEX_* and LAYER_BELOW_MASK_* layer variables to read values from layers below. See the DataShader reference for the full list, or Writing DataShaders for a practical example.
Because the data is computed once per chain instead of per layer, DataShaders are a good place for work that all layers share, like sampling textures and passing them up the chain.