-
Notifications
You must be signed in to change notification settings - Fork 11
Standard Shaders (.shader, .shader.hlsl)
Standard Shaders are the most simple type of shaders in the game: just plain HLSL code. They are stored in the material_shaders~
(0x40212004) folder, in a .smt
file; when unpacked, they finish with the extension .shader
Unfortunately, it's impossible to recover the original code of these shaders. The best SporeModderFX can do, if you have FXC properly configured, is show you the disassembled instructions.
You will notice that unpacked shaders have special names, something like 0x700000a1(skpColorCopyShader).shader
. The real ID that must be used to reference this shader on a material is the one outside the parenthesis, that is, 0x700000a1
. When you create your custom shader you don't need to do that: to reference MyShader.shader.hlsl
just use MyShader
.
It is possible to create your custom shader packs. Like Shader Builders, you can have your own MyShaders.smt.unpacked
folder (where MyShaders is whatever name you want, unique to your mod) containing standard shaders.
Shaders are split in two: vertex and pixel shaders. To make SporeModder FX compile you hlsl code, you have to create two files with the extensions .vshader.hlsl
and .pshader.hlsl
. If any of the files is missing for a shader, SporeModder FX will not compile it. This i an example of how this looks in the Project view:
To be able to compile them, you must have FXC properly configured.
These shaders can contain any code you want (functions, uniforms, samplers, etc), as long as it uses the vs_3_0
and ps_3_0
shader versions. What they are forced to contain, though, is the main
method which is executed when the shader is used. Also, keep in mind these shaders can use the Shader Data available.
An example of pixel shader:
Spore has a special feature called render types: a single shader can have multiple versions of the code depending on the current render type. For example, there's one shader for rendering creatures (generic_skinning
), but it has different code for the hologram render type (15
). The only known render types are:
-
0
: the base and default render type -
15
: hologram
In your custom sahders you can provide the different versions on the code by adding their number at the extension. For example, to make the code for MyShader
at render type 15
you must use MyShader.15.vshader.hlsl
(and same for .pshader
). When no number is specified, the sahder will be packed for the default render type.