Skip to content

Shader Builders (.shader_builder)

Emd4600 edited this page Mar 26, 2019 · 7 revisions

Many shaders in Spore are not coded in a single .hlsl file directly. Instead, they are generated by combining different pieces of code, known as Shader Fragments. These fragments are then combined under certain conditions in the Shader Builder files.

A shader builder contains two lists of references to fragments, with certain conditions that the game must meet for that fragment to be selected. When the game needs a shader, all these conditions are checked, the correct fragments are selected and merged, and a shader is generated.

For example, a builder list for a vertex shader might look something like this:

vertexShader
    add copyVertexColor -elements color
    add getAngle
    add toClipSpace
end

In this example, there are fragments that are always selected (getAngle and toClipSpace) and other that depend, in this case, on whether the model has vertex colors.

Clone this wiki locally