Shadow Generations Standard Shader Behaviors
Basically all material shaders in Shadow Generations follow a set of behaviors that can be assumed to be used unless specified otherwise
Mesh Layers
Unless specified otherwise, a shader should have support for all 3 mesh layers
Punch-through
Despite materials having an alpha clip threshold property, it is not used in any shader. Instead, the game uses a global threshold property that is always set to 0.5
.
Similarly, noise dither shaders always use a clip threshold of 0
.
Pixel Shader
These are standard behaviors for pixel shaders, the stage at which the color of a pixel gets determined.
Shader Models
All material shaders make use of one of those shader models, which loosely determine how a shader interacts with lightning and more.
Index | Name | Description |
---|---|---|
0 | Clear | Technically, this is the "no shader model" shader model, and so far no shader has been discovered that uses it. It is used to determine where to draw the skybox |
1 | Unlit | These shaders do no interact with lighting at all, but just render out the emission channel and use that as is. These shaders allow for custom lighting behavior. |
2 | Standard (PBR) | The "default" shading model, which is used by the majority of all material shaders. It uses the standard physically based rendering lighting model.
This shading model is also affected by weather effects |
3 | Subsurface Scattering (PBR) | Identical to the standard PBR model, with added subsurface scattering lighting.
TODO: document how vertex colors are used |
4 | Anisotropic Reflections (PBR) | Identical to the standard PBR model, with one exception: Reflections are rendered using with anisotropic distribution.
![]() TODO: document how vertex colors are used |
5 | Unknown | |
6 | Unknown | |
7 | Unknown |
Noise
Many shaders implement a "noise" overlay and dither effect, internally referred to as u_model_user_flag_0
.
Unfortunately, it is currently unknown how this is used.
Unless specified otherwise, a shader should implement this.
Global Illumination
There are several types of global illumination (GI), most of which are mutually exclusive:
- Baked lighting ("Just" GI) + baked shadows
- Spherical Guassian GI (SGGI) + baked shadows
- Baked Ambient occlusion (AOGI)
Unless specified otherwise, a shader should have support for all types of GI.
Vertex Shader
These are standard behaviors for vertex shaders, the stage at which the position, color, etc. of a model-vertex gets determined.
Billboards
By adding the TrnsType
SCA parameter to a material and setting its value to 1
/true
, you can enable billboard mode, making a model face the camera. Additionally, by adding the boolean parameter u_enable_billboard_y
and setting it to true
a model will only rotate around its Y axis.
TODO: add gifs showing the effect
Unless specified otherwise, a (vertex-)shader should support billboard mode.
Bone Weights
These make it possible to deform a model using a bone armature, like character models do. While this is usually limited to 4 weights per vertex, a model can use 8 weights by adding the boolean parameter enable_max_bone_influences_8
to a material and setting it to true
.
Unless specified otherwise, a (vertex-)shader should support bone weights & 8-weights.
Multiple Tangents
Shaders with more than one normal map may support using a second set of normal-tangents, which is useful when using a different UV map for the second normal map that is "rotated" differently from the one used by the first normal map. This behavior is enabled by adding the boolean parameter enable_multi_tangent_space
to a material and setting it to true
.
Whether this is available is specified per-shader.
Other
Instancing
By using instancing, a model can be rendered multiple times in the same call.
Unless specified, every (vertex-)shader should support instancing.
If a shader is noted to not use instancing, then it could produce unexpected behavior, although a shader without instancing support has yet to be found.
Compute instancing
A different type of instancing that allows for minor modifications to the visuals of a model per instance; Most shaders allow for HSV modifications to the albedo color, as well as separate, per-instance dithering.
It is currently unknown whether this feature is used at all, especially since it has a very inconsistent implementation in the pixel shaders.