-
Notifications
You must be signed in to change notification settings - Fork 12
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: