Built-in Shaders
- builtin_material
- builtin_constant_color
- builtin_directional_light
- builtin_point_light
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 fast, and 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.
Note:Textures, global illumination, and
final gathering are not supported by built-in shaders. They 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.
builtin_material
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")
Parameters
- ambient
- A constant ambient color component. Set only the ambient color,
in order to get constant color shading. Note that when this is set
to something other than zero, energy in the scene is no longer
preserved, which can lead to unrealistic and undesirable
results.
- diffuse
- The diffuse color of the material.
- specular
- The specular color of the material
- shininess
- This parameter specifies the shininess of the material, similar
to the well-known Phong exponent. The higher the value is, the
sharper and "more shiny" are the specular highlights. A useful
range is between 10 and 1000, but any strictly positive number is
valid. The default is 100.
- anisotropy
- If this is set to a value other than zero then shading will be
anistropic, that is, the shininess of the
surface varies depending on the surface orientation.
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.
- reflect
- The reflective color of the material. If this is set to
something else than black and if ray tracing is enabled then a
reflection ray will be shot and added filtered by this color. The
ray is shot in the ideal reflection direction, and does not
simulate any glossiness or speculariy off the ideal reflection
direction.
- transparency
- The transparency color of the material, similar to reflections,
except that no index of refraction is used, and the ray continues
straight through the material.
- lights
- An array of references to light instances which are used to
illuminate the material. If it is not set, then only the ambient
color is used.
builtin_constant_color
This shader returns a constant color. Its declaration is:
declare "builtin_constant_color"(
color "color")
Parameters:
- color
- The color returned by the shader.
builtin_directional_light
declare "builtin_directional_light"(
color "color",
boolean "shadow",
scalar "factor")
Parameters:
- color
- The color of the light source
- shadow
- This flag indicates whether shadows should be computed for the
light source. Shadows are turned off by default.
- factor
- The shadow factor determines how dark shadows cast by this
light source are. A value of 0.0 renders black shadows, and a value
of 1.0 uses full illumination without any shadowing. A useful range
is between 0.0 and 1.0, the default is 0.0.
builtin_point_light
declare "builtin_point_light"(
color "color",
boolean "shadow"
scalar "factor",
boolean "attenuation",
scalar "start",
scalar "stop")
Parameters:
- color
- The color of the light source
- shadow
- This flag indicates whether shadows should be computed for the
light source. Shadows are turned off by default.
- factor
- The shadow factor determines how dark shadows cast by this
light source are. A value of 0.0 renders black shadows, and a value
of 1.0 uses full illumination without any shadowing. A useful range
is between 0.0 and 1.0, the default is 0.0.
- attenuation
- This flag indicates whether light is attenuated with distance.
It is turned off by default.
- start
- The distance from the light source at which light begins to be
attenuated if attenuation is set.
- stop
- The distance from the light source at which light is fully
attenuated to black if attenuation is set.
Copyright © 1986-2009 by
mental images GmbH