View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide


Adding a custom shader to Nebula2

Although Nebula2 ships with a bunch of shaders, writing your own is often necessary way, to introduce new effects and appearances.
The process can be split into four steps.
  • write the shader in HLSL (.fx format)
  • declare them and specify the use in a renderpath.xml
  • add it, to shaders.xml, the shader configuration file for 3dsmax.

After these steps, a shader can be used exactly the same way like the default ones.

Write the shader
DirectX Effect files (.fx) basicly consists of variables, functions, the pixel and vertex shaders and a section which specifies techniques. Each technique has exactly one pair of pixel/vertex shader and can be used by the application. At runtime the application sends several variables to the GPU like matrices, color values or textures. Depending on the needs, these a declared at the top of the .fx file.

To compile a shader, add this command as the custom build step
fxc.exe /T fx_2_0 /Fc ($InputName).txt "..\..\data\shaders\2.0\ambient_occ.fx"

The Output field typically consists of the name of the shader, with the file ending .fxo

Links to this Page