home | << prev | next >> | contents |
Perform Lambertian illumination, given ambient and diffuse RGB colors (alpha is ignored), and a light list.
color "mib_illum_lambert" ( color "ambience", color "ambient", color "diffuse", integer "mode", array light "lights")
ambience is a multiplier for the ambient color. The idea is that ambient and diffuse color can be derived from the same subshader result (a texture mapper, for example) and the ambient brightness can be reduced to avoid losing the effect of illumination.
ambient is a constant color offset.
diffuse is added to the result for each light, after multiplication with the color returned by the light and a weight based on the dot product of the incident ray direction and the light direction.
mode controls the meaning of the light list, see light lists below.
lights is a list of light instances to loop over. If the mode is 0, use every light in the light list parameter. If the mode is 1, use all lights in the global light list that correspond to the lights in the light list parameter (inclusive mode). If the mode is 2, use all lights in the global light list that do not correspond to the lights in the light list parameter (exclusive mode). If the mode is 4, then the lights are ignored, see the description of light lists below.
Perform Phong illumination, given ambient, diffuse, and specular RGB colors, a specular exponent, and a light list.
color "mib_illum_phong" ( color "ambience", color "ambient", color "diffuse", color "specular", scalar "exponent", integer "mode", array light "lights")
ambience is a multiplier for the ambient color. The idea is that ambient and diffuse color can be derived from the same subshader result (a texture mapper, for example) and the ambient brightness can be reduced to avoid losing the effect of illumination.
ambient is a constant color offset.
diffuse is added to the result for each light, after multiplication with the color returned by the light and a weight based on the dot product of the incident ray direction and the light direction.
specular provides the color of specular highlights.
exponent controls the width of the specular highlight. Smaller values increase the size.
mode controls the meaning of the light list, see light lists below.
lights is a list of light instances to loop over. If the mode is 0, use every light in the light list parameter. If the mode is 1, use all lights in the global light list that correspond to the lights in the light list parameter (inclusive mode). If the mode is 2, use all lights in the global light list that do not correspond to the lights in the light list parameter (exclusive mode). If the mode is 4, then the lights are ignored, see the description of light lists below.
Perform Ward illumination, given ambient, diffuse, and glossy RGB colors, two shinyness parameters, two direction vectors, and a light list.
color "mib_illum_ward" ( color "ambience", color "ambient", color "diffuse", color "glossy", scalar "shiny_u", scalar "shiny_v", vector "u", vector "v", integer "mode", array light "lights")
ambience is a multiplier for the ambient color. The idea is that ambient and diffuse color can be derived from the same subshader result (a texture mapper, for example) and the ambient brightness can be reduced to avoid losing the effect of illumination.
ambient is a constant color offset.
diffuse is added to the result for each light, after multiplication with the color returned by the light and a weight based on the dot product of the incident ray direction and the light direction.
glossy is also added per light. It is the glossy color computed according to Ward's anisotropic glossy reflection model.
shiny_u and shiny_v controls the width of the glossy highlight in the u and v directions, respectively. Smaller values increase the size of the highlight.
u is the brushing direction in the anisotropic material. They must be perpendicular to the surface normal and be of unit length.
v is a direction perpendicular to u and to the surface normal. It must have unit length.
mode controls the meaning of the light list, see light lists below.
lights is a list of light instances to loop over. If the mode is 0, use every light in the light list parameter. If the mode is 1, use all lights in the global light list that correspond to the lights in the light list parameter (inclusive mode). If the mode is 2, use all lights in the global light list that do not correspond to the lights in the light list parameter (exclusive mode). If the mode is 4, then the lights are ignored, see the description of light lists below.
Perform Ward illumination, given ambient, diffuse, and glossy RGB colors, two shinyness parameters, and a light list. The only difference from mib_illum_ward is that the brushing directions are taken from the surface derivatives.
color "mib_illum_ward_deriv" ( color "ambience", color "ambient", color "diffuse", color "glossy", scalar "shiny_u", scalar "shiny_v", integer "mode", array light "lights")
ambience is a multiplier for the ambient color. The idea is that ambient and diffuse color can be derived from the same subshader result (a texture mapper, for example) and the ambient brightness can be reduced to avoid losing the effect of illumination.
ambient is a constant color offset.
diffuse is added to the result for each light, after multiplication with the color returned by the light and a weight based on the dot product of the incident ray direction and the light direction.
glossy is also added per light. It is the glossy color computed according to Ward's anisotropic glossy reflection model.
shiny_u and shiny_v controls the width of the glossy highlight in the u and v directions, respectively. The u direction is the first derivative of the surface (read from the state), and v is perpendicular. Both u and v are in the plane that is perpendicular to the surface normal.
mode controls the meaning of the light list, see light lists below.
lights is a list of light instances to loop over. If the mode is 0, use every light in the light list parameter. If the mode is 1, use all lights in the global light list that correspond to the lights in the light list parameter (inclusive mode). If the mode is 2, use all lights in the global light list that do not correspond to the lights in the light list parameter (exclusive mode). If the mode is 4, then the lights are ignored, see the description of light lists below.
Perform Cook-Torrance illumination, given ambient, diffuse, and specular RGB colors, a roughness, index of refraction for three wavelengths, and a light list. Cook-Torrance illumination has an off-specular peak and a color shift with angles.
color "mib_illum_cooktorr" ( color "ambience", color "ambient", color "diffuse", color "specular", scalar "roughness", color "ior", integer "mode", array light "lights")
ambience is a multiplier for the ambient color. The idea is that ambient and diffuse color can be derived from the same subshader result (a texture mapper, for example) and the ambient brightness can be reduced to avoid losing the effect of illumination.
ambient is a constant color offset.
diffuse is added to the result for each light, after multiplication with the color returned by the light and a weight based on the dot product of the incident ray direction and the light direction.
specular is a factor that the reflected color is multiplied with.
roughness is the average microfacet slope of the surface. It controls the width of the specular highlight.
ior is the index of refraction of the material at three different wavelengths (red, green, blue). Metals typically have a higher index of refraction than glass. Values must be 1.0 or greater; smaller values are clamped to 1.0.
mode controls the meaning of the light list, see light lists below.
lights is a list of light instances to loop over. If the mode is 0, use every light in the light list parameter. If the mode is 1, use all lights in the global light list that correspond to the lights in the light list parameter (inclusive mode). If the mode is 2, use all lights in the global light list that do not correspond to the lights in the light list parameter (exclusive mode). If the mode is 4, then the lights are ignored, see the description of light lists below.
Perform Blinn illumination, which is a like Cook-Torrance illumination but without the color shift with angles. It only requires one index of refraction.
color "mib_illum_blinn" ( color "ambience", color "ambient", color "diffuse", color "specular", scalar "roughness", scalar "ior", integer "mode", array light "lights")
ambience is a multiplier for the ambient color. The idea is that ambient and diffuse color can be derived from the same subshader result (a texture mapper, for example) and the ambient brightness can be reduced to avoid losing the effect of illumination.
ambient is a constant color offset.
diffuse is added to the result for each light, after multiplication with the color returned by the light and a weight based on the dot product of the incident ray direction and the light direction.
specular provides the color of specular highlights.
roughness is the average microfacet slope of the surface. It controls the width of the specular highlight.
ior is the index of refraction of the material. Metals typically have higher index of refraction than glass.
mode controls the meaning of the light list, see light lists below.
lights is a list of light instances to loop over. If the mode is 0, use every light in the light list parameter. If the mode is 1, use all lights in the global light list that correspond to the lights in the light list parameter (inclusive mode). If the mode is 2, use all lights in the global light list that do not correspond to the lights in the light list parameter (exclusive mode). If the mode is 4, then the lights are ignored, see the description of light lists below.
All illumination shaders above have a mode parameter and a lights parameter to control the set of lights which is used for illumination. Illumination is performed either using the light instances given in the lights parameter, or the light list of the goemetry instance to be shaded. Lists of light instances have been added to geometric instances in mental ray version 3.5 in order to provide easier control over the lights used for illumination. The lights are used according to the following possible values for the mode parameter:
Occlusion is a fast and simple method to simulate the effects of global illumination. Occlusion is the extent to which the area above a point is covered by other geometry. This is achieved by tracing a number of probe rays inside the hemispherical area above the point and testing to what extent this region is blocked.
Occlusion may also be used for external compositing by assigning the shader to each object in the scene.
Occlusion has several uses. One of these is ambient occlusion, where the shader is used to scale the contribution of ambient light (which in turn may come from a diffuse environment map shader). For this use, the shader works well when assigned to the ambient parameter of a material like mib_illum_phong.
Another use of occlusion is reflective occlusion, where the shader is used to scale the contribution from a reflection map. For this use, the shader is generally plugged into an environment or reflection shader slot of a material, and the actual environment map image is plugged into the bright parameter. An alternative is to allow the return value of the occlusion shader to modulate the strength attribute of a reflection map shader.
This shader is a simple implementation of occlusion mapping that handles both reflective occlusion and ambient occlusion.
A third use is to create files for external compositing, where the occlusion shader is assigned to every material in the scene. The output can be used to modulate other render passes to achieve proper compositing in post-production.
Finally, the shader may be used as a light shader. The light source must be an area light of the user type. This generates an "ambient" lightsource with built in occlusion.
color "mib_amb_occlusion" ( integer "samples" default 16, color "bright" default 1 1 1 1, color "dark" default 0 0 0 0, scalar "spread" default 0.8, scalar "max_distance" default 0, boolean "reflective" default off, integer "output_mode" default 0, boolean "occlusion_in_alpha" default off # Version 2 parameters scalar "falloff" default 1.0, integer "id_inclexcl" default 0, integer "id_nonself" default 0, ) version 2 apply texture, light
samples is the number of probe rays that will be sent. More rays yield a smoother image. Occlusion mapping will never be as smooth as well-tuned final gathering or photons, but is computationally cheap.
bright is the color used when no occluding objects are found and dark is the color used when total occlusion occurs. In most practical cases it is set to black. For partial occlusion, a gradual mix between the two colors is returned.
spread defines how large an area of the hemisphere above the point is sampled. The value defines a cone around the sampling direction which is narrower for small values and wider for large values. It ranges from 0.0, for a cone that is a single direction, to 1.0 for a cone that covers the entire hemisphere.
max_distance is the range within which geometry is probed. If it is zero, the entire scene is sampled. If it is a nonzero value, only objects within this distance will be considered (which makes sampling much faster) where objects outside this range do not occlude at all and objects that are closer occlude more strongly as the distance approaches zero.
If reflective is off sampling is performed in a cone area based around the surface normal. If reflective is on, the samples are instead distributed around the reflection direction. This generates reflective occlusion which can enhance the realism of reflection mapping greatly.
output_mode defines what the returned color is: 0 enables standard occlusion behaviour; 1 enables environment sampling. This changes the behavior of the shader slightly. As directions are probed for occlusion, the current environment is also sampled and weighted based on how occluded that particular direction is. In mode 1 the output of the function is the gathered weighted environment colors multiplied by the bright color, and as a convenience the dark color is added.
Setting output_mode to 2 enables bent normals. The average unoccluded world space normal direction is calculated and returned encoded as a color where red is x, green is y and blue is z. Setting output_mode to 3 is the same as 2 but the normals are encoded in the camera coordinate space instead.
When occlusion_in_alpha is on, the scalar occlusion value is put in the returned colors alpha component, regardless of what output_mode is set to. The other color components remain as before.
The falloff parameter only matters when max_distance is nonzero and defines the speed at which the occlusion is attenuated by distance. Technically, it is a power function applied to the normalized distance from 0 to max_distance. The default value of 1.0 is a linear falloff. Values below 1.0 makes the falloff more rapid. Practically this means that for lower values occlusion is stronger for short distances (in small corners and crevices) and softer over larger distances.
id_inclexcl defines an object instance label (set with the tag keyword of the object instance in the .mi file) to be included (or excluded) from being considered occluding by the shader. Set to 0 the parameter has no effect. A positive integer means that only object instances with a label that matches this number will cause occlusion. A negative reverses the condition and includes all object instances except those with a matching label.
id_nonself works similar to id_inclexcl in that it is an object instance label determining which objects do not self- occlude. Set to 0 it has no effect. Set to a positive integer will prevent any object with that label from occluding other objects with the same label. This is useful for "matte" or "stand-in" objects that represents existing geometry in a photographic background since any inter-occlusion between such objects are already present in the background photo. Simple exclusion by id_inclexcl cannot be used in this case because occlusion cast by "stand-in" background geometry onto foreground geometry and vice versa is both desired - only background-to-background occlusion needs to be prohibited.
Ambient Occlusion using Final Gathering
In mental ray 3.4 the final gathering algorithm can return the scalar occlusion value. This utitily shader simply returns this value as a grayscale result.
color "mib_fg_occlusion" ( color "result_when_fg_is_off" default 1 1 1 1 ) version 1
The single parameter result_when_fg_is_off becomes the return value when final gathering is off. When final gathering is on, the occlusion value is returned as a grayscale value, and the parameter is never evaluated at all or used in any way.
Hence, if one puts mib_amb_occlusion into the result_when_fg_is_off parameter, the result will be occlusion calculated by final gathering when it is on, and occlusion calculated by mib_amb_occlusion when final gathering is off.
"Bent normal" is a term used for the average un-occluded direction vector from a surface point. For completely un-occluded surfaces this is the same as the normal vector, but for surfaces occluded by other geometry it points in the direction in which the least amount of occluding geometry is found. Bent normals are used as an acceleration technique for ambient occlusion, allowing very fast rendering that look like global illumination or final gathering lit by an environment at a small fraction of the rendering time.
Ambient occlusion as done by the mib_amb_occlusion shader (see mib_amb_occlusion) is a ray tracing technique that casts potentially large numbers of probe rays to determine to which extent a surface point is occluded. The speed of this operation depends on the number of rays (samples), the reach of the rays (max_distance) and the complexity of the scene.
When rendering an animation (or multiple views of the same scene), any object that does not move, does not change shape, or has no moving occluding object nearby will yield the same result for every frame. Therefore one can "bake" (render to a file) the ambient occlusion solution once in a first rendering pass, and re-use this result in subsequent rendering passes for any number of frames, with potentially huge performance gains. If one also "bakes" the average un-occluded direction (the bent normal) to a texture, the entire process of lighting the object based on an environment is moved to this second rendering pass, without having to trace a single ray.
By setting the output_mode parameter to 2, 3, or 4 on the ambient occlusion shader mib_amb_occlusion, bent normals are returned with the vector being encoded as a color where x is red, y is green, and z is blue. If occlusion_in_alpha is enabled, the scalar occlusion value is returned in the alpha channel. This color can be baked into a texture, for example with the help of mib_lightmap_write (mib_lightmap_write) by putting mib_amb_occlusion into its input parameter and rendering.
Once the texture file is generated, mib_bent_normal_env can be assigned to a surface shader (for example to the ambient parameter of mib_illum_phong) to look up an environment to light the object based on the baked bent normal texture, which is placed in the bent_normals parameter of mib_bent_normal_env.
This allows an extremely low-overhead simulation of global illumination-like effects for rigid objects and is especially suitable for animations. The technique does not work on deformable objects since their occlusion, shape, and normals can vary from frame to frame. For deformable objects, it is better to apply the occlusion shader directly, without baking its output.
color "mib_bent_normal_env" ( color "bent_normals" default 0 0 0 1, boolean "occlusion_in_alpha" default on, color "occlusion" default 1 1 1, scalar "strength" default 0.2, shader "environment", integer "coordinate_space" default 2, integer "env_samples" default 1, scalar "samples_spread" default 0.0, transform "matrix" default 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 )
bent_normals is the bent normal data output by the occlusion shader. It should be baked to the object. This is usually attached to a node that does the texture lookup such as mib_lookup_color_texture. The texture mapping used for generating the texture must match with the one used for lookup.
occlusion_in_alpha specifies whether the scalar occlusion value is already baked into the alpha channel of the "bent normals" pass. This uses slightly less memory but many "bake to texture" functions of OEM integrations of mental ray do not bake the alpha channel.
occlusion is the separate occlusion channel, to be used if it was not already baked into the alpha channel.
strength is a simple scalar multiplier for the effect.
environment is the environment shader to look up. If none is provided, the environment from the material is used. To avoid image noise, it is often desirable to use a separate, highly blurred environment map with no high-resolution detail.
coordinate_space defines the coordinate space of the bent normal:
The coordinate space numbers match the output_mode parameter values of the ambient occlusion shader, where 2 is world space, 3 is camera space, and 4 is object space.
env_samples is the number of samples to take from the environment map. Normally, a highly-blurred environment map is used where only one sample is sufficient, but it is possible to multi-sample the environment map by setting a non-zero value.
sample_spread is the spread factor for each individual environment sample. The range is from 0.0 (infinitely thin rays -- a single sample) to 1.0 (the entire hemisphere is sampled).
matrix is an explicit transformation matrix applied to the normal data when coordinate_space is 1. This allows arbitrary transformations.
Glossiness
The shaders described in this section are a way to generate glossy (blurred) reflections and refractions. The following points illustrate the performance and usability differences between these shaders and the physics DGS shaders:
Multi-sampled glossiness
The DGS shaders shoot a single glossy ray for reflection and refraction, relying on the oversampling of the entire image (with the associated performance penalty) to average out the samples for an attractive blur. Every ray is a new independent sample. In contrast, the mib_glossy_* shaders take multiple glossy ray samples, causing oversampling only on the glossy surfaces rather than the whole image. Samples are created using mental ray's strictly deterministic sampling engine and is hence able to create a more attractive sample pattern yielding a "better looking" blur with the same number of samples.
DGS (left) vs. mib_glossy_reflection (right)
The image above is rendered with samples 0 1 and one can clearly see the grainy result on the left. To get a smooth result one would need to increase the sampling of the entire image. In contrast, mib_glossy_* handles it's own oversampling (in the example, 8 samples) and applies it only on the glossy surfaces themselves.
Distance bounded reflections/refractions
While strictly non-physical in the case of reflections, the mib_glossy_* shaders allow one to limit the reach of both reflected and refracted rays. This helps eliminate image noise caused by distant reflected/refracted objects, and can vastly improve performance.
Unlimited reflections (left) vs. distance limited (right)
Undersampling of environment
One of the goals of the mib_glossy_* shaders is to avoid distant image noise by filtering out distant objects and replacing with a material (in the case of refraction) or the environment (in the case of reflection). But to avoid excessive noise from sampling said environment, the reflection shader can intentionally single-sample the environment (and can even be passed an explicit pre-blurred environment) to remove noise.
Anisotropy without need for explicit UV vectors
The shaders can use explicitly-passed UV vectors for anisotropic glossy reflections/refractions, but will attempt to calculate sensible vectors themselves if these are missing (set to 0,0,0).
Normal vector perturbing
The DGS shaders calculate a specular reflected or refracted direction, and then perturb this direction within the range determined by the shiny.parameter. In contrast, the mib_glossy_* shaders simulate glossiness as if the microfaceting is in the surface before the reflection or refraction.. This means the reflected and refracted directions are calculated by actually perturbing the normal vector (simulating a rough surface on a microscopic level), and calculating the new reflected or refracted direction based on the changed normal.
It is notable that this yields different results and makes the glossiness view direction dependent. As an example, the glossiness pattern of reflections in a floor will be stretched vertically. This is the same effect one can see at a sunset over water, when the reflection of the sun seems stretched vertically into a long streak of sunlight.
DGS shader (left) vs. mib_glossy_reflection (right)
Fresnel effect
Most reflective materials reflect more at glancing angles, and transparent materials transmit more at facing angles. This rebalancing between reflectance and transmittance was discovered by Augustin-Jean Fresnel in the 19:th century and is known as a "fresnel effect". These shaders allow different weights to be set for "edges" (glancing angles) and "base" (facing angles) to emulate this effect. In the mib_glossy_* shaders, this effect is calculated per sample instead of as a global weighting of the entire reflection for greater realism.
No fresnel effect (left) vs. Exaggerated fresnel effect (right)
Notice how the edges (surfaces at a glancing angle) in the right image reflect more than in the left image.
Chromatic aberration
The mib_glossy_* shaders have a dispersion parameter, which sets the amount of "faux chromatic aberration". The effect is not physically correct and only an emulation of the real phenomena.
This is the shader for glossy reflection.
declare shader "mib_glossy_reflection" ( shader "base_material", color "reflection_color", scalar "max_distance", scalar "falloff" default 2.0, color "environment_color", scalar "reflection_base_weight" default 0.2, scalar "reflection_edge_weight" default 1.0, scalar "edge_factor" default 5.0, shader "environment", boolean "single_env_sample" default true, integer "samples" default 16, scalar "u_spread" default 0.5, scalar "v_spread" default 0.5, vector "u_axis", vector "v_axis", scalar "dispersion" default 0.0, array color "spectrum" ) apply material, texture version 3 end declare
This shader is only concerned with reflections - nothing else. The base_material parameter is the base surface onto which the reflections are added. One can, for example, apply mib_illum_phong, or any other surface shader, here.
The reflection strength (and coloration) is defined by the reflection_color parameter. The calculated reflections are simply multiplied by this value.
If max_distance is zero, the reach of the reflection rays are infinite. For values greater than zero, the reach of the reflection rays are limited to this distance (with a huge performance gain), and the color of the reflection is faded toward the environment color as the length of the ray approaches this distance. Use this parameter to improve performance and to avoid excessive noise due to distant high-contrast objects.
The rate for fading into the environment is set by the falloff parameter, which is a power function. The default of 2.0 means the falloff is by distance squared; 3.0 means distance cubed, and so on. This parameter has no effect if max_distance is zero.
environment_color is the multiplier for when the ray misses any object and hits the environment. For physical accuracy, this should be exactly the same as the reflection_color, but is provided separately to give greater control in balancing the brightness between reflection of objects and reflection of the environment.
reflection_base_weight is a scalar multiplier for the reflection at surfaces facing the camera, and reflection_edge_weight at surfaces perpendicular to the camera (i.e. edges), and edge_factor the narrowness of this "edge". Generally there are more reflections at edges (glancing angles) than on facing surfaces, known as a "fresnel effect".
The environment parameter allows passing an explicit environment shader that only applies to this shader. If none is passed, the material's environment shader is used, with the global camera environment as a fallback. This allows the use of a specially prepared pre-blurred environment map for environment reflections.
If the environment map is already sufficiently blurry, it may be wasteful (performance wise), and it may also introduce unnecessary sampling noise when sampling the environment multiple times. When single_env_sample is off, an environment sample is made for each reflection ray that misses an object or needs to be mixed with the environment due to the use of max_distance. When on, the environment is sampled only once for these reflection rays.
samples sets the number of samples used, and is ideally a power of two. If zero, the shader reverts to single sample mirror reflection only.
u_spread and v_spread is the amount of normal vector perturbation performed in the U and V direction. If these values are identical, isotropic glossy reflection is generated. Upon any difference between the two values, the anisotropic mode is enabled.
u_axis and v_axis are optional parameters for specifying the directions of anisotropy. These only apply in anisotropic mode. If u_axis is 0,0,0 the shader attempts to generate a default vector based on the first derivative vector of the surface, and if such is missing, based on object-space X axis. If u_axis is given a value it is utilized as the U direction of anisotropy. If v_axis is also specified it is used as the V direction, but if left unspecified the V direction is calculated as the cross product of the original surface normal and the U direction.
The dispersion parameter reaches from 0.0 (no chromatic aberration) to 1.0 (full spectrum chromatic abberation).
Finally the spectrum is an array of colors defining the "rainbow" into which colors are broken when the dispersion parameter is nonzero. It defaults to a default red-yellow-white-cyan-blue-indigo colors but can be anything.
This shader is very similar to mib_glossy_reflection but has a few differences. Since it deals with refraction, it has a "deep material" rather than an environment.
Fading towards a gray-ish "deep material"
declare shader "mib_glossy_refraction" ( shader "top_material", shader "deep_material", shader "back_material", boolean "render_reverse_of_back_material", color "refraction_color", scalar "max_distance", scalar "falloff" default 2.0, scalar "refraction_base_weight" default 1.0, scalar "refraction_edge_weight" default 0.2, scalar "edge_factor" default 5.0, scalar "ior" default 1.0, integer "samples" default 16, scalar "u_spread" default 0.5, scalar "v_spread" default 0.5, vector "u_axis", vector "v_axis", scalar "dispersion" default 0.0, array color "spectrum" ) apply material, texture version 2 end declare
The shader is only concerned with refractions. Any additional material characteristics come from the two *_material parameters.
top_material is the surface characteristics of the very top layer. Like the base_material in the reflection version of this shader, this is simply added to the result. An example use would be mib_illum_phong with only specularity and very little to no diffuse component.
deep_material is only used if max_distance is nonzero. It is the surface characteristics of the "interior" of the object, and the color to which refractions fade as they reach the max_distance. While the color is still calculated at the surface, it will "appear" to be behind any refraction of internal objects. For interesting pseudo-volumetric simulations one can suggest using the misss_fast_* subsurface scattering shader here.
back_material is the material used for rays that hit the inside of the object from within (i.e. any ray that hits the object from the back as defined by the geometry normal). It defines what the "inside" of the object looks like, and should just like the preceeding parameters be assigned to a surface shader, e.g. mib_illum_phong or similar. By default mental ray flips the normal to the side of the incoming ray, which would render the inside of the objects surface. But sometimes it is desirable to simulate a translucency effect by letting the light hitting the outside of the object define its shading. This is accomplished by turning render_reverse_of_back_material on, which causes the shader to use the original direction of the surface normal when evaluating back_material.
Simulating translucency by intentionally flipping the normal
vectors of the back material.
refraction_color is simply a multiplier for the refracted rays.
max_distance limits the reach of refracted rays, and fades them toward the deep_material as their length approaches the max_distance. This gives the appearance of a semi-transparent material into which one can only see so far.
The rate for fading into the deep_material is set by the falloff parameter, which is a power function. The default of 2.0 means the falloff is by distance squared; 3.0 means distance cubed, and so on. This parameter has no effect if max_distance is zero.
refraction_base_weight is a scalar multiplier for the refraction at surfaces facing the camera, and refraction_edge_weight, at surfaces perpendicular to the camera (i.e. edges). edge_factor is the narrowness of this "edge". Generally, there is less refraction at edges (glancing angles) than there is on facing surfaces. This is known as a "fresnel effect".
ior is the index of refraction. Since the perturbation of refraction is calculated based on a perturbed normal vector, it is very important that this value defines a sensible index of refraction... otherwise an index of 1.0 causes no change in the ray direction, generating no blurriness whatsoever! As a special case, one may set ior to 0.0 which will switch to a "direction perturbing mode" rather than a "normal perturbing mode".
samples sets the number of samples used, and is ideally a power of two. If zero, the shader reverts to single sample refraction only.
u_spread and v_spread is the amount of normal vector perturbation performed in the U and V direction. If these values are identical, isotropic glossy refraction is generated. Upon any difference between the two values, the anisotropic mode is enabled.
u_axis and v_axis are optional parameters for specifying the directions of anisotropy. These only apply in anisotropic mode. If u_axis is 0,0,0 the shader attempts to generate a default vector based on the first derivative vector of the surface, and if such is missing, based on object-space X axis. If u_axis is given a value it is utilized as the U direction of anisotropy. If v_axis is also specified it is used as the V direction, but if left unspecified the V direction is calculated as the cross product of the original surface normal and the U direction.
The dispersion parameter reaches from 0.0 (no chromatic aberration) to 1.0 (full spectrum chromatic abberation).
Finally the spectrum is an array of colors defining the "rainbow" into which colors are broken when the dispersion parameter is nonzero. It defaults to a default red-yellow-white-cyan-blue-indigo colors but can be anything.
home | << prev | next >> | contents |
Copyright (©) 1986-2006 by mental images GmbH