Shaders
 
 
 

Like materials and textures, shaders control the surface appearance of models. Unlike a texture, which is simply an image file stretched or tiled across an object, a shader gives your objects descriptive properties like shadowing or reflectivity.

Shaders are real-time shading plugins, altering the appearance of models in the scene. With Open Reality you can add new shaders to MotionBuilder.

To build the samples cgshader and cgshaderfractal you need the Cg header files and libraries provided by the Cg Toolkit 1.1. The DLLs are provided in the MotionBuilder bin folder, or they can be downloaded from NVIDEA.

The project files will need to be modified to reflect the location of the headers and library files. For the linker step you will also need to add cg.lib and cgGL.lib as additional dependencies under the input tab.

To see a shader:

  1. Add a model to the scene, e.g. Asset Browser > Elements > Primitives > Cube.
  2. From Asset Browser > Shaders, drag a shader onto the model.

Sample shaders:

cgshader

Simple Cg vertex shader. Requires Cg Toolkit 1.1.

cgshaderfractal

More complex Cg shader.A pixel shader that uses the Mandelbrot set fractals. Requires Cg Toolkit 1.1.

shader_template

Simple template for creating new shaders. It is a simple lit shader, the same as the default shader used in the software.

shaderscreen

Draws triangles at model vertices. Draws triangles in screen coordinates at model vertices.

shadertexmat

Term text

Texture material shader. Simple shader that applies textures and materials with OpenGL.