| home | << prev | next >> | contents |
As of version 3.5, mental ray has a small set of simple built-in shaders. These are intended for simple visualizations, where speed and simplicity of scene setup are more important than customization of shading elements. The shaders are designed to be flexible, but to offer only little control over shading details. Since the shaders are part of mental ray, their executation can be better optimized for performance by avoiding a few steps necessary when calling dynamically linked, external shaders.
Built-in shaders are used just like other (dynamically linked) shaders in a scene. They are referenced by name, and shader arguments may be specified which must conform to the declarations of the shader. However, built-in shaders do not need to be declared in the .mi input files or linked with mental ray using link statements. The shaders and their declarations are known to mental ray.
Textures, global illumination, and final gathering are not supported by built-in shaders at this time. This is likely to change in a later release of mental ray.
Note: built-in shaders can not be used in conjunction with any other (dynamically linked) shaders in this version of mental ray. A scene may contain either just built-in shaders or no built-in shaders at all, but not both.
mental ray provides a single material shader. It is similar to a typical Phong shader but uses a more realistic shading model which can model the characteristics of many actual materials better. In particular, the amount and directional characteristics of specular highlights at grazing angles are rendered more realistically. It also supports anisotropy for materials like brushed metals or velvet. The declaration of the built-in material in .mi syntax follows:
declare "builtin_material"(
color "ambient",
color "diffuse",
color "specular",
scalar "shininess" = 100.0,
scalar "anisotropy",
color "reflect",
color "transparency",
array light "lights")
For positive values there are more specular reflections in the u direction of the surface, and for negative values there are more specular reflections in the v direction of the surface. A useful range is typically between -1 and 1, although values outside this range can be used, too.
This shader returns a constant color. Its declaration is:
declare "builtin_constant_color"(
color "color")
Parameters:
declare "builtin_directional_light"(
color "color",
boolean "shadow",
scalar "factor")
declare "builtin_point_light"(
color "color",
boolean "shadow"
scalar "factor",
boolean "attenuation",
scalar "start",
scalar "stop")
| home | << prev | next >> | contents |
Copyright © 1986-2007 by mental images GmbH