The mental ray Strings Options introduced in 3ds Max 2011 lets you toggle rendering options and set parameters not yet available in the UI using the Interface: mental_ray_string_options.
Traditionally, mental ray options are generated by the controls of the mental ray Renderer User Interface and sent to the renderer to control the rendering process.
Some features supported by the latest version of the mental ray Renderer might not be exposed to the 3ds Max User Interface for various reasons.
The String Options provide a way to access these features using MAXScript and experiment with them before they are officially supported.
Only one option of a given name can be taken into account with the last option encountered overriding any previous definitions.
Thus, it is a good idea to always remove previously set options before setting new ones.
Also, the String Options are written to the beginning of the 'options "SceneOptions|SceneOptions"' block. Thus, using String Options to specify an option that is exported natively by the 3ds Max mental ray connection will have no effect as it will be overwritten by the UI setting. For example, setting "finalgather" to "off" using String Options while Final Gather is enabled in the Render Scene Dialog will result in Final Gather being on in the scene.
An integer value might be specified in place of a float value, and some options might contain either Point3 or Point4 values to specify 3 or 4 floating point values.
Besides these exceptions, values of a wrong type are ignored, for example, specifying a Float value of 1.0 as String "1.0" will have no effect.
Also, misspelled or unknown options are silently ignored by mental ray (they can be options related to 3rd party shaders).
The String Options supported by mental ray, but not exposed to the 3ds Max mental ray User Interface are documented below:
By default, mental ray computes images by splitting them into rectangular buckets that are rendered as parallel as possible to their final quality. This is well suited for distributed rendering of larger scenes at highest quality. It has the disadvantage that final images are available only after all buckets have been finished.
In contrast, the progressive rendering mode computes and delivers images at full resolution with incrementally progressing quality. This supports implementations of interactive rendering applications with mental ray for computationally expensive effects like ray tracing and indirect illumination. Best performance can be achieved for medium size models that completely fit into the memory of the machine.
Certain advanced rendering features are not supported to gain speed:
Although, the traditional shading model is supported, certain advanced features implemented in shaders might not work.
Especially shaders that perform oversampling are generally not well suited for this rendering mode because sampling cannot be controlled and optimized by mental ray.
Turn Progressive Rendering on or off.
If not set, the default is off.
Enable and control coarse sampling of the first images.
If not set, the default is 0, which means subsampling is disabled.
Values greater than 1 activate subsampling in blocks of pixels.
The value specifies the size of pixel blocks (sizexsize) where initial samples are placed first, typically displaying as a coarse image with the impression of a lower resolution.
The larger the size, the coarser the initial image.
Values of 0 or 1 disable this feature.
A value of 2 computes samples for blocks of 2x2 = 4 pixels.
The task size has to be a multiple of this subsampling size, otherwise it will be automatically adjusted to the closest possible value.
The pixels in a block that are not rendered are filled with color values according to the setting of the subsampling mode (see below).
Controls the appearance of subsampling pixels that are not rendered.
"detail" (default) - pixels that have not been rendered are interpolated from the nearest surrounding finished samples. This displays as a smooth image of lower resolution.
"sparse" - pixels that have not been rendered are set to black.
Controls the sequence in which the samples are computed.
"scatter" (default) - pixels are rendered in a quasi-random order.
"linear" - pixels are computed in a line-by-line order within a pixel block.
Sets the minimum number of samples per pixel to render before considering any of the other criteria listed below.
Sets the number of samples per pixel that causes progressive rendering to stop.
If this number of samples per pixel has been rendered, progressive rendering will stop automatically regardless of any other stop criteria.
Sets the time in seconds after which to stop progressive rendering.
Sets the error threshold to stop progressive rendering.
If this relative error threshold is reached, progressive rendering will stop automatically.
A value of 0.0 targets perfect quality and will not stop rendering.
A value of 0.5 will stop rendering already at a very low quality.
Note that this setting has lowest priority to determine if progressive rendering must be stopped.
Importons are "virtual particles". In some aspects they are similar to photons: they bounce in the scene. There are significant differences though: unlike photons, importons do not distribute energy. Instead, they contain a color describing the factor an illumination at a certain location will contribute to the final image. This way, they provide information to the renderer on how the computational efforts must be distributed to get an image of best quality with limited computational resources.
Unlike photons, importons are emitted from the camera and bounce towards lights (in a direction opposite to the photons). However, the duality of lights makes it possible to apply photon shaders to importons. For simplicity reason, mental ray does not introduce a new type of shaders, but uses photon shaders for importons as well.
Importons are used as a supplementary mechanism that improves the rendering quality and performance. It is used as the primary mechanism to drive the quality of irradiance particles. Another usage in mental ray is improving the quality of the GI photon map. It allows for dramatic reduction of the photon map size with the help of merging within a variable merging distance that is determined with the help of importons. Such variable merging distance is superior to the constant merging distance.
If enabled, importons are shot before photon maps are created. They are used during the GI photon map creation. As they are not relevant to the GI photon map nearest neighbor lookups, importons are discarded once the photon map is created.
If set to true, the importons are emitted and an importon map is created.
The default value if not set is off.
Specifies the approximate number of importons shot from the camera per pixel.
The minimal value for this option in the current implementation is 0.02 (approximately 1 importon per 50 pixels).
The default and recommended value is 1.0.
Lower values will speed up importon emission, but can lead to a less optimal photon map and decrease the final image quality.
Specifies the world-space distance used to merge close importons.
The default value is 0.0, which means that merging is disabled.
Controls the diffusion of importons in the scene.
If set to 0.0 (default), importons will not scatter on the diffuse bounces.
In some cases it might be required to use more than a single diffuse bounce. This is the case if the combination with final gathering is used, or when the "importon traverse" option is switched off (see below).
Enables a special behavior of importons shot from the camera. Such importons will not be blocked by even completely opaque geometry. Instead, they will be stored for all intersections with geometry on the ray from the camera to infinity.
This leads to a significantly higher number of importons stored in the scene. However, it removes the discontinuity in the distribution of the importons originating from the visibility to the camera function.
This algorithm is a novel approach to computing global illumination based on importance sampling that tends to converge much faster to a desirable quality than the existing solutions like global illumination photon tracing combined with final gathering.
Before rendering starts, importons are shot from the camera into the scene and collected as a new kind of particle called an irradiance particle. They carry information about the amount of direct illumination coming in at their position (hence the name "irradiance") and, optionally, the amount of indirect irradiance incident at their position (if indirect passes are enabled). During rendering, the stored particles are used to estimate the irradiance at a shading point; if just direct illumination was collected for irradiance particles, this is equivalent to one bounce of indirect lighting.
The irradiance can also be interpolated from precomputed values at the particle positions.
The irradiance particle algorithm simulates some, but not all of the indirect lighting interactions of the traditional global illumination algorithms in mental ray. For this reason, if irradiance particles are enabled, then mental ray will turn off the global illumination photon tracing automatically if it was activated. This is a common situation when external applications are asked to generate mental ray scenes with photon shaders attached, which are needed for importons. Caustics can be used together with irradiance particles because they are used to capture indirect lighting effects that irradiance particles cannot simulate. If both final gathering and irradiance particles are enabled, then final gathering is preferred and irradiance particles will be switched off automatically. Thus, it is important to turn off FG explicitly when using String Options to enable Irradiance Particles.
Irradiance particles support a special Image Based Lighting-style functionality that can be enabled by setting the number of indirect passes to -1. In this case, only the environment map lighting, but no diffuse bounces are taken into account. If interpolation is disabled, then only an environment pre-sampling map is build and no further pre-computation steps are required. If interpolation is enabled, then particles are emitted in the pre-computation pass in the usual way, but used as interpolation points only.
If enabled, the irradiance particles are used to simulate indirect lighting, disabling global illumination photons if they were turned on.
If final gathering is enabled this setting is ignored.
The default value if not set is off.
Controls the number of rays to shoot while estimating the irradiance.
The number of possible passes of indirect lighting.
If this value is greater than 0, then a sequence of passes is performed to collect the irradiance coming at every particle position, so irradiance particles will have both direct illumination and indirect illumination information.
If this value is 0 (default), the irradiance particles will have only direct illumination information.
If the value is -1, only the environment map lighting, but no diffuse bounces are taken into account. If interpolation is disabled then only an environment pre-sampling map will be built and no further pre-computation steps will be required. If interpolation is enabled, then particles will be emitted in the pre-computation pass in the usual way, but will be used as interpolation points only.
This is the global scale factor for the intensity of the irradiance during rendering.
This is a global tuning option for artistic control.
It can be specified as a single Float value that is used to set R, G, and B at once, or as Point3 value for separate control of the three color channels.
mental_ray_string_options.AddOption "irradiance particles interpolate" {<Integer>index|<String>modeName}
This option is used to control the use of interpolation, and it can be either a numeric value or a string:
2 - interpolate only for secondary rays (no interpolation for eye rays, but interpolation for reflections, refractions, and so on).
Alternatively, it can be set to the strings "never", "always", or "secondary".
The number of nearest neighbor points to use for the interpolation (see above).
This flag enables the use of the environment maps for irradiance computation.
If enabled, a separate particle map is built for the environment (if an environment shader is present) and used during rendering.
mental_ray_string_options.AddOption "irradiance particles env scale" {<Float>Scale|<Point3>RGBScale}
The scaling factor for the irradiance contributed by the environment.
It can be specified as a single float or as a Point3 value.
This scaling factor is relative because it applies to the environment irradiance only; the environment irradiance can actually be further scaled if the user specifies a global scaling factor with the "irradiance particle scale" string option.
For example, if the env. scale is set to 2.0 and the global scale is set to 3.0, then the actual scaling factor for the environment irradiance will be 6.0 (2.0 x 3.0).
The number of rays used for the computation of irradiance coming from the environment map.
This number can be much higher than the number of rays used for normal irradiance computation, especially if most of the environment is covered by scene geometry (typical case is a room with just one or two windows).
For outside scenes, it must work fine with a smaller number of rays.
The default is taken from to actual value of "irradiance particles rays".
If the file exists, mental ray will try to read the particle map from it.
If it does not exist, the computed particle map will be saved to a file with the given name.
If set to true, mental ray will re-compute the particle map.
If set to false, an existing map will be re-used, either read from an existing file if specified, or taken from a previous frame of an animation.
This can be useful to avoid flicker in animations like for fly-throughs.
Note that the global illumination might become incorrect if objects are moving.
Because the particle map is essentially view dependent, it is possible that inaccuracies appear when the camera moves.
Enables the built-in IBL mode if the value is set to "light".
Controls the quality of the IBL contribution.
The value can range from 0.0 to 1.0 for lowest to highest quality.
Control the shadows cast by IBL.
"off" - disable shadow casting
"transparent" (default) - full shadowing using the shadow shaders.
Selects one of the available FG modes.
"automatic" (default) - targets primarily rendering of single still images. Uses the finalgather points argument for the approximate resp. minimal number of final gather points used in interpolation. All FG points are produced in the FG precomputing stage.
"multiframe" - targets rendering of camera fly-through animations. Uses the finalgather points argument for the approximate resp. minimal number of final gather points used in interpolation. All FG points are produced in the FG precomputing stage. The finalgather accuracy R_1 is used to limit the maximal validity distance of a finalgather point to avoid picking up illumination from remote objects if the density of finalgather points is insufficient.
"force" - disables final gather caching completely and always performs the full and accurate computation. This takes time, but yields superior quality.
"strict 3.4" - compatibility mode. Focuses on rendering images identical or very similar to mental ray 3.4.
"3.4" - compatibility mode. Focuses on usage of the same argument set, but with rendering improvements.