Hardware Shader Implementation
Deprecated
Hardware shader names can be explicitly specified in materials,
or automatically constructed from software shader names by adding a
vendor prefix like migl_. Once the shader name is known,
mental ray will perform two operations:
- First, mental ray will attempt to call a software function
whose name is constructed by adding the prefix to the shader name.
For example, if the hardware shader name is myphong and the
hardware shader is implemented in Cg,
mental ray will try to call the
software function micg_myphong. This is not a hardware or
software shader but a C/C++ function that can be used to do special
setup operations needed for the shader, such as copying data to the
graphics board or calling special GL functions needed by the
shader. This function is optional and rarely necessary.
This function is normally implemented in the shader support
library. For example, the software shader library base.so
might have a support library migl_base.so for
Cg hardware shaders.
- Second, the actual shader is loaded from files on disk into the
graphics board. Files are searched for with the hardware search
path configured with the _MI_REG_HARDWARE registry key in
the startup file, or the
-hardware_path command-line option. The file name must
exactly match the shader name, plus a postfix:
Either one may be missing if the shader does not require this
type of shader. (Most shaders do not require a
vertex shader and provide only a
fragment shader.) For example,
for NVIDIA hardware, if the
hardware shader name is myphong, mental ray will load the
Cg files myphong_v.cg
and myphong_f.cg.
- If no such Cg shader can be
found, or -hardware native or -hardware fast is
specified on the command line to turn off all programmable shaders,
mental ray will use plain hardwired OpenGL shading. This requires a
C/C++ function that performs the necessary OpenGL calls to load
colors etc. This function follows the same conventions as the
support functions in the first item: the shaders get the prefix
migl_, for example migl_myphong, and they are loaded
from the library migl_base.so. The only difference is that
they are loaded instead of, rather than in addition to, any
hardware shaders.
Copyright © 1986-2009 by
mental images GmbH