Shaders and Materials
This is a short guide of everything related with adding new materials and shaders. If you want an example, check this tutorial.
First, we must clarify the two concepts:
Shaders: The actual HLSL code that is run when rendering an object. There are two types: the
vertex shaders, which are executed for ever vertex of a model, and the
pixel shaders, which are executed for every pixel.
- Materials: They define how an object is rendered, that is, which shader they use, textures, how glossy it is, etc
It is important to remember that distinction: imagine you want to change the creature shader. Well, actually you will have to change the creature material, because the shader is used by many other things, and if you replace the shader directly it will change things you don't want.
Materials are stored either inside
.rw4 models, or inside material packs in the
materials_compiled_states_link~ folder. Mods can define their own material packs with either new materials or replacements of existing ones; if you have the latest version of the ModAPI dlls, they will load automatically.
Shaders are stored inside shader packs in the
materials_sahders~ folder. Mods can define their own shader packs with either new shaders or replacement of existing ones; if you have the latest version of the ModAPI dlls, they will load automatically.
It is important to notice, however, that some complex shaders require using
shader fragments. Basically, they are pieces of shader code that Spore uses to generate multiple variations of a same shader. Unfortunately, only one mod at a time can use them, so if you want to make it compatible with other shader mods you will have to contact the other mod developer.
This is how the workplace of a custom shaders mod might look like: