Phenomena

The supplied Phenomena are documented first since they are sufficient for most practical usage. Expert users can create their own Phenomena using these as templates or use the component shaders as described in Advanced Topics. These Phenomena use structures to group the input parameters in logical groups, which are automatically grouped by the user interface of different OEM integrations of mental ray.

Fast Simple Phenomenon

This Phenomenon automatically (unless explicitly specified) generates the required lightmaps, fills in the lightmap data, and shades the objects as a general, translucent object with subsurface scattering. The scattering is divided into two parts, one for the front side of the object and one for the back.

In a sense, the shader works by layering several light contributions on top of each other (see misss_fast_shader) to get a final result. What is important to keep in mind are these rules of thumb:


The flow of color
misss_fast_simple_phen
material "misss_fast_simple_phen" (
    color texture   "lightmap",
    color texture   "depthmap",
    string          "lightmap_group",
    scalar          "lightmap_size",
    integer         "samples",
    shader          "bump",
    struct "d" {
        color       "ambient",
        color       "overall_color",
        color       "diffuse_color",
        scalar      "diffuse_weight",
        color       "front_sss_color",
        scalar      "front_sss_weight",
        scalar      "front_sss_radius",
        color       "back_sss_color",
        scalar      "back_sss_weight",
        scalar      "back_sss_radius",
        scalar      "back_sss_depth"
    },
    struct "s" {
        color       "specular",
        scalar      "exponent"
    },
    struct "a" {
        scalar      "lightmap_gamma",
        boolean     "indirect",
        scalar      "scale_conversion",
        scalar      "scatter_bias",
        scalar      "falloff",
        boolean     "screen_composit"
    },
    integer         "mode",
    array light     "lights")
lightmap
depthmap
are normally not specified. These are special parameters the shaders use to communicate the name of the automatically created lightmaps between themselves. Expert users can pass writable textures and leave the lightmap_group and lightmap_size parameters undefined. See Automatic lightmap generation.
lightmap_group
is the scatter group name. A lightmap/depthmap pair will be created internally and given this name. All objects that should scatter light into each other should be in the same scatter group. To conserve memory, use as few scatter groups as possible. A person's hands, face, etc. can use the same scatter group; even hands and faces of different people. In general, different scatter groups should be used only when using the same group would cause visible problems due to objects incorrectly scattering into each other. Two characters shaking hands, for instance, would need to have their hands in different scatter groups. (Also see the technical note on Network Rendering.
lightmap_size
is size of the lightmap expressed in percent of render size. The lightmap is created in render space, and is related to final rendered screen pixels. 50% or less is often quite enough (and is the default), but if edge artifacts appear, increase this value.
samples
sets how many samples from the lightmap are considered (maximum) per rendered ray, ideally, a power of two. 32 is probably the lowest useful value, 128 is plenty. However, if the scattering radii are large the sample count may need to be increased to avoid image noise.
bump
allows passing any shader that perturbs the normal for bumps. The shader's color output (if any) will not be used.
ambient
is the ambient component or any additional diffuse light added by any shader. This light will also be included in the lightmap and get scattered like any other light source and is hence the perfect place to add any HDRI light. The HDRI light can be based on environment and occlusion maps.
overall_color
is the overall diffuse color. All diffuse colors that follow below are multiplied with this global color to yield the final result. This parameter is useful for tinting the final computed diffuse color in a desired way or to apply maps that attenuate all diffuse light. Moles in skin, for example, block almost all underlying light (even scattered) and would make sense applied here, as would dirt, textured-on eyebrows, and such.
diffuse_color
diffuse_weight
color and weight (a simple multiplier for easier tweaking) of the normal Lambertian diffuse lighting, which is layered on top of any underlying scattered diffuse light.
front_sss_color
front_sss_weight
are the color and weight for the front surface scattering.
front_sss_radius
is the scatter radius in the front surface. Light will scatter this distance along the surface, in whatever units the model is made, divided by the scale_conversion parameter along the surface.
back_sss_color
back_sss_weight
are the color and weight for the back surface scattering, i.e. light going through the object.
back_sss_radius
back_sss_depth
are the scatter radius and depth for which light from the back surface is visible in the front surface. Normally, the radius and depth are set to the same value (and if the depth is not specified, it defaults to the radius) but can be set separately for increased control.
specular
exponent
specular color and Phong exponent for the specular highlight.
lightmap_gamma
is the gamma curve of the light stored in the lightmap. If this is 1.0, normal Lambertian diffuse light is stored. If it is less than 1.0, the curve is 'flattened' causing the light to spread out towards areas perpendicular to the incoming light. If it is higher than 1.0, the curve is 'narrowed' causing the light to concentrate in areas directly facing the light source. In most cases, a value between 0.4 and 0.8 is sufficient.
indirect
if true, includes any indirect lighting (photons, final gathering, etc) in the lightmap to be scattered. This takes additional render time and one should judge on a case-by-case basis if the indirect light is significant enough that seeing it scattered or not makes a big difference to justify the extra rendering time.
scale_conversion
is a simple utility function allowing linear division of all distances. Since scattering is distance dependent, loading a material designed for a model made in inches will not work on a model where the unit is meters, and vice versa. Here one can pass the conversion factor.
scatter_bias
if set to 0.0 the scattering is completely uniform. Positive values favor forward scattering, and negative values favor back scattering. The allowed range is -1.0 to 1.0, but the useful range is much smaller. A value of 0.1 (a slight favoring of forward scattering) is a good start.
falloff
sets the shape of the distance falloff along the scatter radius. Higher values yield a sharper falloff, and lower values a smoother falloff, but also make the perceived scatter distance shorter, so one must compensate by increasing the actual scatter distance for a slightly 'softer' look. For high values (1.0 to 10.0), almost all samples within the scatter radius are weighted equally. For low values (0.1 to 1.0), the samples near the edge of the scatter radius are weighted less.
screen_composit
when turned on, chooses Screen compositing. When simply adding together the contribution of many layers of light, it is very easy to quickly blow out and over-expose into white, but the human eye is inherently nonlinear and perceives intensities in a different way. This option allows use of what is known in many compositing applications as a screen transfer mode between the layers, which yields a softer, more pleasing result. If it is turned off, normal addition is used. If rendering in a high dynamic range and a proper tone-operator is applied in the final output stage already compressing the final luminance this should be turned off.
mode
is the mode selector for the light lists.
lights
is the direct light list.

Fast Skin Phenomenon

A more advanced Phenomenon for skin shading includes three-layer scattering and skin-specific specularity functionality. It shares many parameters with misss_fast_simple_phen.


The structure of the skin shader

Skin is simulated in layers as follows: A top reflective sheen layer (for specularity and surface non-scattered Lambertian diffuse reflections), a dual-layer subsurface scattering (simulating both the scattering in the epidermis and the layers below, here collectively named "subdermal"), and "through" scattering from the backside.

misss_fast_skin_phen
material "misss_fast_skin_phen" (
    color texture   "lightmap",
    color texture   "depthmap",
    string          "lightmap_group",
    scalar          "lightmap_size",
    integer         "samples",
    shader          "bump",
    struct "d" {
        color       "ambient",
        color       "overall_color",
        color       "diffuse_color",
        scalar      "diffuse_weight",

        color       "front_sss_color",
        scalar      "front_sss_weight",
        scalar      "front_sss_radius",
        color       "mid_sss_color",
        scalar      "mid_sss_weight",
        scalar      "mid_sss_radius",
        color       "back_sss_color",
        scalar      "back_sss_weight",
        scalar      "back_sss_radius",
        scalar      "back_sss_depth"
    },
    struct "s" {
        scalar      "overall_weight",
        scalar      "edge_factor",
        color       "primary_spec_color",
        scalar      "primary_weight",
        scalar      "primary_edge_weight",
        scalar      "primary_shinyness",

        color       "secondary_spec_color",
        scalar      "secondary_weight",
        scalar      "secondary_edge_weight",
        scalar      "secondary_shinyness",

        scalar      "reflect_weight",
        scalar      "reflect_edge_weight",
        scalar      "reflect_shinyness",
        boolean     "reflect_environment_only",
        shader      "environment"
    },
    struct "a" {
        scalar      "lightmap_gamma",
        boolean     "indirect",
        scalar      "scale_conversion",
        scalar      "scatter_bias",
        scalar      "falloff",
        boolean     "screen_composit"
    },
    integer         "mode",
    array light     "lights")

The parameters lightmap, depthmap, lightmap_group, lightmap_size, samples, bump, ambient, lightmap_gamma, indirect, scale_conversion, scatter_bias, falloff and screen_composit all work identically to their counterparts in misss_fast_simple_phen.

overall_color
is the overall coloration of all diffuse components. This color will affect all the underlying layers (unscattered, epidermal, subdermal, back) and is good for overall color tweaks, or texture mapping surface features that should block out underlying light, such as skin moles, textured eyebrows, dirt, etc.
diffuse_color
diffuse_weight
color and weight of the normal Lambertian diffuse component. This represents the very top layer of the skin where all the tiny bumps are located. For caucasian skin the color would be mostly white with perhaps a small amount of blue and an appropriate diffuse weight would be around 0.3.
front_sss_color
front_sss_weight
front_sss_radius
are the color, weight and scatter radius within the Epidermal skin layer, which is the whiteish/yellowish layer just under the surface. Good values are a slightly yellowish color, a weight of 0.5, and a radius of around 5 to 10mm (0.2 to 0.4 inches).
mid_sss_color
mid_sss_weight
mid_sss_radius
are the color, weight and scatter radius of the underlying subdermal skin layer. The functionality of the parameters is the same as those beginning with front_ but is for yet another layer below the top layers, representing the deeper, reddish "meaty" scattering. A reddish/orangeish color with a weight of around 0.5 and a radius of 10 to 25mm (0.4 to 1.0 inches) is a good starting point for experimentation.
back_sss_color
back_sss_weight
back_sss_radius

back_sss_depth
represent light going straight through the flesh (for example for the "red ears" look).
overall_weight
is the overall level of specularity and reflections. Generally, any specularity map is included here and will affect the level of all specularity options that follow below.
edge_factor
sets the "edge width" of the edge reflection effects. Skin reflects more when watched in angles nearly perpendicular to it (known as a "Fresnel effect") and this parameter sets the narrowness of this edge. Higher values yield a thinner edge. This edge width applies to all the edge weights listed below.
primary_spec_color
primary_spec_weight
are the color and base weight for the first layer of specularity. The skin specularity functions are two-layered, allowing simulation of both the broad soft specularity of skin and any near-reflective specularities of top layer oiliness and wetness.
primary_edge_weight
sets the additional multiplier for the edge, where final specularity at the edge is the sum of weight and edge weight.
primary_shinyness
is the specular exponent (higher values yield a smaller and sharper specular highlight, which is a modified Phong model with edge softening).
secondary_spec_color
secondary_spec_weight

secondary_edge_weight
secondary_shinyness
work exactly like the parameters that begin with primary_ and are for the second layer of specularity. For skin, a good rule of thumb is to have a 1st specular layer with a very low shinyness (3.0 to 8.0) and a low level (0.1 to 0.3) but a rather high edge weight (0.5 to 1.0) and a slightly blueish color, and a 2nd layer that has high shinyness (20 to 100) and a medium level (0.3 to 0.6) and no edge enhancement. Introducing mapping into the specularity channels enhances realism greatly.
reflect_weight
reflect_edge_weight
weight and edge weight for reflections. If it is nonzero, actual (glossy) reflections are added.
reflect_shinyness
is the shinyness value for glossy reflections. When it is 0.0, standard raytraced mirror reflections are used, but for nonzero values glossy reflections are generated, which increases render time.
reflect_environment_only
if true then only the current environment map is sampled for reflections, and no actual rays are traced.
environment
specifies a local environment shader.
mode
is the mode selector for the light lists.
lights
is the direct light list.

Fast Skin with Displacement

This Phenomenon is an exact duplicate of misss_fast_skin_phen, but supporting displacement mapping. This must be a separate Phenomenon because a Phenomenon with displacement will always attempt to displace the object.

misss_fast_skin_phen_d
material "misss_fast_skin_phen_d" (
    color texture   "lightmap",
    color texture   "depthmap",
    string          "lightmap_group",
    scalar          "lightmap_size",
    integer         "samples",
    shader          "displace",
    shader          "bump",
    struct "d" {
        ...
    }
    integer         "mode",
    array light     "lights")
displace
is a shader that displaces the surface.

All other parameters are identical to misss_fast_skin_phen.

New Fast Skin 2

This Phenomenon is similar to misss_fast_skin_phen with two important differences:
misss_mia_skin2_phen
material "misss_mia_skin2_phen" (
    color texture  "lightmap",
    color texture  "depthmap",
    string         "lightmap_group",
    scalar         "lightmap_size" default 50,
    integer        "samples" default 64,
    shader         "bump",
    struct "d" {
        color   "ambient"           default 0 0 0 0 ,
        boolean "ao_on"             default on,
        scalar  "ao_distance"       default 1.0,
        integer "ao_samples"        default 16,
        color   "diffuse_color"     default .95 .95 1 ,
        scalar  "diffuse_roughness" default 0.3,
        scalar  "diffuse_weight"    default 0.5 ,

        color   "epi_sss_color"         default 1 0.85 0.6 ,
        scalar  "epi_sss_weight"        default 0.5 ,
        vector  "epi_sss_radius"        default 20 10 5,
        color   "epi_sss_radius_mod"    default 1 1 1,

        color   "front_sss_color"       default 1 0.85 0.6 ,
        scalar  "front_sss_weight"      default 0.5 ,
        vector  "front_sss_radius"      default 20 10 5,
        color   "front_sss_radius_mod"  default 1 1 1,

        color   "back_sss_color"        default 0.7 0.1 0.1 ,
        scalar  "back_sss_weight"       default 0.5,
        vector  "back_sss_radius"       default 20 10 5,
        color   "back_sss_radius_mod"   default 25,
        scalar  "back_sss_depth"        default 25,
        scalar  "sampling_radius_mult"  default 5
    },
    struct "r" {
        scalar  "reflectivity"        default 0.5,
        color   "refl_color"          default 0.75 0.9 1,
        scalar  "brdf_90_degree_refl" default 1.0 ,
        scalar  "brdf_0_degree_refl"  default 0.025 ,
        scalar  "refl_gloss"          default 0.25,
        integer "refl_samples"        default 16,
        scalar  "refl_falloff_dist"   default 0.0,
        scalar  "hl_vs_refl_balance"  default 1.0,
        boolean "refl_hl_only"        default off,
        boolean "single_env_sample"   default off,
        shader  "environment",
        boolean "refl_interpolate"    default off
    },
    struct "s" {
        scalar  "overall_weight" default 0.8,
        scalar  "edge_factor" default 5.0, 
        color   "primary_spec_color" default 0.75 0.9 1,
        scalar  "primary_weight" default 0.3,
        scalar  "primary_edge_weight" default 0.8 ,
        scalar  "primary_shinyness" default 5.0 ,

        color   "secondary_spec_color" default 0.9 0.95 1.0 ,
        scalar  "secondary_weight" default 0.3,
        scalar  "secondary_edge_weight" default 0.0,
        scalar  "secondary_shinyness" default 33.0
    },
    struct "i" {
        integer "intr_grid_density"   default 2,
        integer "intr_refl_samples"   default 2
    },
    struct "a" {
        scalar  "lightmap_gamma"   default 0.75,
        boolean "indirect" default on,
        scalar  "scale_conversion" default 1.0,
        scalar  "scatter_bias"     default 0.12,
        boolean "screen_composit"  default off,
        color   "additional_color" default 0 0 0
    },
    integer     "mode",      
    array light "lights")

The following parameters are used:

lightmap
depthmap
lightmap_group
samples
bump
all work identically to misss_fast_skin_phen
ambient
ao_on
ao_distance
ao_samples
are parameters from the included mia_material. It allows a built in ambient occlusion that is applied as detail enhancement to any indirect light (or to the supplied ambient lighting term). For more details review the mia_material documentation.
diffuse_color
is the diffuse color from mia_material. This is functionally equivalent to the unscattered_diffuse from the misss_fast_skin_phen.
diffuse_roughness
is the diffuse Oren-Nayar roughness. Range of 0.0 to 1.0. When zero lambertian diffuse shading is used.
diffuse_weight
is the amount of unscattered diffuse contribution.
epi_sss_color
epi_sss_weight
is the color and weight of the "epidermal" scattering, as described above.
epi_sss_radius
epi_sss_radius_mod
is a vector describing the scatter radii for red, green and blue respectively, and a color value to apply a modification to these radii. For more details of how these three radii and the modification color work, see misss_fast_shader2 documentation.
sub_sss_color
sub_sss_weight
sub_sss_radius
sub_sss_radius_mod
are the equivalent parameters for the subdermal scattering.
back_sss_color
back_sss_weight
back_sss_radius
back_sss_radius_mod
back_sss_depth
are the equivalent parameters for back (through) scattering. It has an additional depth parameter, which if set to zero, applies the same depth as the red radius.
sampling_radius_mult
sets the radius (as a multiple of the largest of the previous radii) within which actual samples are taken. For technical detail how this parameter works w.r.t. the scatter radii, see misss_fast_shader2 documentation.
reflectivity
refl_color
the overall reflectivity and color of the material. All reflectivity is handled by the included mia_material.
brdf_90_degree_refl
brdf_0_degree_refl
reflectivity at 90 degrees (grazing angles) and 0 degrees (incident angles) to the normal. Allows a customized fresnel effect, similar to the "edge" reflectivity parameters of the old misss_skin_specular shader
refl_gloss
refl_samples
is the reflectivity glossines and number of samples (rays) used to render it (from mia_material).
refl_falloff_dist
when nonzero allows reflections to be limited in ray length for performance. This is similar to the reflect_environment_only in the old Phenomenon, but allows a distance within which real reflections are rendered, rather than a crude on/off switch.
hl_vs_refl_balance
refl_hl_only
single_env_sample
refl_interpolate
are all advanced reflectivity parameters from the included mia_material. See the documentation of that shader for details - these are for advanced use, and the defaults are suitable for the most physically plausible result.
refl_interpolate
intr_grid_density
intr_refl_samples
are parameters for the mia_material interpolated (smoothed) glossy reflections. Note that the interpolation is not optimized for animations, because the algorithm isn't guaranteed to be frame-to-frame coherent, but is more indended for high-resolution stills.
overall_weight
edge_factor
primary_spec_color
primary_weight
primary_edge_weight
primary_shinyness
secondary_spec_color
secondary_weight
secondary_edge_weight
secondary_shinyness
Most of the specularity of this Phenomenon comes from the mia_material, but for greater control, an instance of misss_skin_specular is also included. These are the parameters from that shader, allowing two more layers of specularity to be added.
additional_color
is an additional input that is simply added to the overall output of this shader. This can be used e.g. for adding emissive areas of the surface, or to connect other shaders in a cascading fashion.
lightmap_gamma
indirect
scale_conversion
scatter_bias
screen_composit
mode
lights
all work identically to misss_fast_skin_phen

Fast Skin 2 with Displacement

This Phenomenon is an exact duplicate of misss_mia_skin2_phen, but supporting displacement mapping. This must be a separate Phenomenon because a Phenomenon with displacement will always attempt to displace the object.

misss_mia_skin2_phen_d
material "misss_mia_skin2_phen_d" (
    color texture   "lightmap",
    color texture   "depthmap",
    string          "lightmap_group",
    scalar          "lightmap_size",
    integer         "samples",
    shader          "displace",
    shader          "bump",
    struct "d" {
        ...
    }
    integer         "mode",
    array light     "lights")
displace
is a shader that displaces the surface.

All other parameters are identical to misss_mia_skin2_phen.

Split Phenomena

All the above examples are material Phenomena, which is great if you only want to use what they provide, since the automatically package all the features into an easy-to-use package, connect the lightmaps automatically, etc.

However, sometimes one need to combine shaders for better control of the look, and then the pre-packaged Phenomena are not enough. For this, split Phenomena are available. This simply means that there is a separate Phenomenon for the lightmapping part, and a separate Phenomenon for the surface shading part, and these must be connected via a writable texture to function.

misss_lightmap_phen
        struct {
                vector      "point",
                vector      "normal"
                }
        "misss_lightmap_phen" (
                color texture "lightmap",
                boolean       "indirect"       default off,
                scalar        "lightmap_gamma" default 0.75,
                scalar        "scatter_bias"   default 0,
                color         "ambient"        default 0 0 0,
                integer       "mode"           default 4,
                                               #: property "lightmode"
                array light   "lights"         #: property "lightlink"
        )
This is a very simple Phenomenon simply connectting the lightmapping shader with the default lightmapping sampling shader. This Phenomenon must be connected in the lightmapping slot of a material.
lightmap
is the writable texture that the shader writes its output to. Since the shader stores different data in adjacent side-by-side textures, it should be twice as wide as the resolution at which you want to sample the light, e.g. a 1000x500 texture will actually store a 500x500 resolution of data, but both for the front- and backside.
lightmap_gamma
is the curve to apply to the normal cosine falloff of lambertian shading, allowing to widen or narrow the diffuse light. Generally this is set to 0.75 which allows the subsurface light to bleed a little further than standard lambertian shading.
scatter_bias
if set to 0.0 the scattering is completely uniform. Positive values favor forward scattering, and negative values favor back scattering. The allowed range is -1.0 to 1.0, but the useful range is much smaller. A value of 0.1 (a slight favoring of forward scattering) is a good start.
ambient
is the ambient component included in the lightmap and get scattered like any other light source.
mode
is the mode selector for the light lists.
lights
is the direct light list.
misss_mia_skin2_surface_phen
This is the surface shading counterpart to the above lightmapping shader, and it goes into the surface shading slot of a material, or in a shade tree that emanates in the surface shading slot, if combined with other things.
    "misss_mia_skin2_surface_phen" (
        color texture  "lightmap",
        integer        "samples" default 64,
        vector         "bump"           default 0 0 0,
        
        color   "ambient"               default 0 0 0 0 ,
        boolean "ao_on"                 default on,
        scalar  "ao_distance"           default 1.0,
        integer "ao_samples"            default 16,
        color   "diffuse_color"         default .95 .95 1 ,
        scalar  "diffuse_roughness"     default 0.3,
        scalar  "diffuse_weight"        default 0.5,

        color   "epi_sss_color"         default 1 0.85 0.6 ,
        scalar  "epi_sss_weight"        default 0.5 ,
        vector  "epi_sss_radius"        default 20 10 5,
        color   "epi_sss_radius_mod"    default 1 1 1,

        color   "front_sss_color"       default 1 0.85 0.6 ,
        scalar  "front_sss_weight"      default 0.5 ,
        vector  "front_sss_radius"      default 20 10 5,
        color   "front_sss_radius_mod"  default 1 1 1,

        color   "back_sss_color"        default 1 0.85 0.6 ,
        scalar  "back_sss_weight"       default 0.5,
        vector  "back_sss_radius"       default 20 10 5,
        color   "back_sss_radius_mod"   default 1 1 1,
        scalar  "back_sss_depth"        default 0,
        scalar  "sampling_radius_mult"  default 5,

        scalar  "reflectivity"          default 0.5,
        color   "refl_color"            default 0.75 0.9 1,
        scalar  "brdf_90_degree_refl"   default 1.0 ,
        scalar  "brdf_0_degree_refl"    default 0.025 ,
        scalar  "refl_gloss"            default 0.25,
        integer "refl_samples"          default 16,
        scalar  "refl_falloff_dist"     default 0.0,
        scalar  "hl_vs_refl_balance"    default 1.0,
        boolean "refl_hl_only"          default off,
        boolean "single_env_sample"     default off,
        shader  "environment",
        boolean "refl_interpolate"      default off,

        scalar  "overall_weight"        default 0.8,
        scalar  "edge_factor"           default 5.0, 
        color   "primary_spec_color"    default 0.75 0.9 1,
        scalar  "primary_weight"        default 0.3,
        scalar  "primary_edge_weight"   default 0.8 ,
        scalar  "primary_shinyness"     default 5.0,

        color   "secondary_spec_color"  default 0.9 0.95 1.0 ,
        scalar  "secondary_weight"      default 0.3,
        scalar  "secondary_edge_weight" default 0.0,
        scalar  "secondary_shinyness"   default 33.0,

        integer "intr_grid_density"     default 2,
        integer "intr_refl_samples"     default 2,

        scalar  "lightmap_gamma"        default 0.75,
        boolean "indirect"              default on,
        scalar  "scatter_bias"          default 0.12,
        boolean "screen_composit"       default off,
        color   "additional_color"      default 0 0 0,

        integer "mode"                  default 4, 
        array light "lights"
    )
The parameter set is exactly the same as in the material Phenomena above, with the exception of not being gather into structs. See documentation of misss_mia_skin2_phen for more details.

Copyright © 1986, 2015 NVIDIA ARC GmbH. All rights reserved.