Saturday, July 19, 2008

MOSAIC feature ramblings - part 11

Part 11 - The Materials Setup tab and raytrace attributes:


MaterialsThe "Materials Setup" tab allows you to control different aspects of how MOSAIC exports Blender materials.

MOSAIC uses Blender materials as the place to apply RenderMan shaders and attributes related to surface shading, in particular you can apply surface, displacement, interior volume, exterior volume and area light shaders as well as both integer and string based raytrace attributes.

Since MOSAIC exports all material associations to geometry including multiple materials per object and datablock, there is a wide range of possibilities.

Traditionally RenderMan shaders are applied to individual objects, but with MOSAIC you can apply shaders to materials and assign multiple materials to portions of the same mesh allowing much more complex setup and rigging. The exporter automatically separates the mesh into different objects to be shaded, when using an area light shader the geometry is placed with the light declarations before any other geometry (area light shaders are for true geometry based illumination and is not the same as the area light type which is only a light array).



The "Materials Setup" tab also has a set of attribute menus for setting the material's raytracing behavior. In RenderMan you can use these attributes to define whether a surface is visible to specular (shadows), diffuse (occlusion) and photons (caustics). There are two forms of these settings with varying support by different renderers, the older string type and the newer integer type (see your renderer's documentation for detailed instructions on how these attributes work). MOSAIC uses your renderer preset selection (in "MOSAIC Settings" tab) to automatically setup all new material settings to use the type best suited for your renderer. By default all options are on so you can immediately begin using raytraced shadows, occlusion and caustics :)

Since MOSAIC provides tokens that can hook Blender controls to shader parameters (see "Shader Parameters" in the "MOSAIC Utilities" tab) the built in shaders automatically use the most common Blender material controls. At the moment only the most important controls are linked, and not all of them behave the same as Blender... but after this series of blogs my next big project is to add almost all light, material and world controls into the shader system with near identical behavior :)

Here's a list of which material controls are currently hooked to the default shaders:

  • Halo (this will turn all geometry including hairs into point clouds)

  • HaloSize (this not only controls point size but also the base width for hairs)

  • Add (this controls hair tip width relative to base width)

  • HaloPuno (if enabled MOSAIC attempts to export normals for hairs to create ribbons)

  • Shadeless

  • Shad A

  • Col RGB

  • Spec RGB

  • Mir RGB

  • A (Alpha)
  • Ref

  • Spec

  • Hard

  • GR: (light groups do not use "Exclusive")

  • Tralu

  • Amb (this controls both hemi light and raytraced and mapped occlusion)

  • Emit

  • Ray Mirror (this will enable raytraced reflections but if "Enable Environment Mapping" is enabled on any object using this material it will be used for reflections regardless of this toggle)

  • RayMir (this controls both raytracing and environment maps)

  • Fresnel (this controls both raytracing and environment maps)

  • Ray Transp (this will enable raytraced refractions but if "Enable Environment Mapping" is enabled on any object using this material it will be used for refractions regardless of this toggle)

  • IOR (this controls both raytracing and environment maps)

  • Fresnel (this controls both raytracing and environment maps)

  • Sub Surface Scattering (this enabled a depth map based sss effect therefore it's recommended you use this with shadow mapped lights, however you can manually adjust the SSSWidth parameter for ls_MOSAIClight to get similar result with raytracing)

  • Scale (adjusts the SSS strength)

  • Radius R

  • Radius G

  • Radius B

  • IOR (adjusts the sss map blurring)

  • Error (adjusts the sss map bias)

  • Scattering color

  • Col

  • Tex

  • Front

  • Back

  • Also the world "Ambient Occlusion" toggle enables a non cached raytraced occlusion using the worlds HorRGB color (mapped based occlusion is enabled in the "Scene Setup" tab independently of this toggle.

The surface shader also support texture channels. All "map to" channels are currently supported and work similar to Blender with one exception, only one texture of each channel type can be used for each material (I intend on changing this to match Blender's behavior by using arrays of texture names in the future). Something else to keep in mind with textures is that MOSAIC only supports the "image" texture type not any of the procedurals (that's what RSL is for), and that when loading an image you should probably stick with .TIFF since most RenderMan systems have problems with anything else. Also remember to use the "Texture Export Options" in the "Project Setup" tab to disable any textures you're not using.

Here's a list of which material texture controls are currently hooked to the default shaders:

  • UV (only uses this coordinate type, any other is default to primitives type)

  • ofsXYZ

  • sizeXYZ

  • All "Map To" channels supported

  • Col

  • Nor

  • Disp (controls displacement map height)

That covers most of the high points of the materials tab so let's go ahead and list its groups and controls:

Navigation and RIBset management:Materials Setup
This group of controls is at the top of the tab and allows you to select available cameras, updating all controls and Blender selections accordingly. It also has controls for creating, deleting and selecting RIBsets for this tab.

Here's a breakdown of the controls in this group:

  • Select Material - This will show a list of available materials for selection, once selected it will update all controls in this tab.

  • Select RIBset -This will show a list of available RIBsets for selection, once selected it will update all controls in this tab.

  • Create New RIBset -This will create a new RIBset from the current RIBset control settings and select it.

  • Delete This RIBset - This will delete the currently selected RIBset and select the DEFAULT RIBset.


Code management:
This group of controls is for attaching user created code fragments (text files with the "cf_" prefix in their names) to the beginning and end of different RIB blocks. As with the previous group, this group of settings is available in various configurations for all the remaining tabs.

Here's a breakdown of the controls in this group:

  • Material Archive -This menu allows you to specify whether the exported RIB code for cameras is exported into separate RIB archives or inlined into the object RIB.

  • Material Begin Code - This allows the insertion of custom code fragments into the beginning of the material block before anything MOSAIC exports.

  • Material End Code - This allows the insertion of custom code fragments into the end of the material block after anything MOSAIC exports.


Shader management:
This group of settings is available in various configurations for all tabs and is for selecting shaders for the selected material.

Here's a breakdown of the controls in this group:

  • Surface Shader - This allows you to select a surface shader from a list of available system or loaded shaders.

  • Notes - This will display a popup of any notes attached to shader fragments by the author (usually containing information about which Blender controls are used by this shader).

  • Displacement Shader - This allows you to select a displacement shader from a list of available system or loaded shaders.

  • Int Volume Shader - This allows you to select an interior volume shader from a list of available system or loaded shaders. Volume shaders are similar to atmosphere shaders but for filling volumes of space.

  • Ext Volume Shader - This allows you to select an exterior volume shader from a list of available system or loaded shaders. Volume shaders are similar to atmosphere shaders but for filling volumes of space.

  • Area Light Shader - This allows you to select an area light shader from a list of available system or loaded shaders. Area light shaders are for turning geometry into true area lights, but are only supported by a few renderers and usually require special shader ops.


Options and attributes:
This group of controls is for setting material related options and attributes for this material.

Here's a breakdown of the controls in this group:

  • transmission - Is this material visible to transmission rays (casts shadows)? This control uses both the new integer style (on or off) and the older string style (sets how shadows cast through material such as "transparent", "opaque", "shader", "Os").

  • specular - Is this material visible to rays created by trace() (receives shadows)? This control uses both the new integer style (on or off) and the older trace command.

  • diffuse - Is this material visible to color bleeding and occlusion (new integer style)?

  • photon - Is this material visible to photons such as caustics (new integer style)?

  • camera - Is this material visible to the camera (new integer style)?

  • Shading Model - Which shading model to use when scattering photons (newer style)?

  • transmissionhitmode - How is opacity for transmission rays determined?

  • specularhitmode - How is opacity and color for specular rays determined?

  • diffusehitmode - How is opacity and color for diffuse rays determined?

  • camerahitmode - Allows you to control culling of geometry behind camera's visibility.

  • Use Material in Animations - This option allows you to manually take advantage of a "speed hack" in MOSAIC. This option can drastically improve export times in an animation for any material that is not animated. If enabled then MOSAIC will only export this material on the first frame of this animation and will then just re-use it without recalculating any of its data.

  • Flip "U" Tex Coor - This allows you to manually flip the exported "U" UV value for this material (handy when certain image formats are working but inverted in the U direction on your renderer).

  • Flip "V" Tex Coor - This allows you to manually flip the exported "V" UV value for this material (handy when certain image formats are working but inverted in the V direction on your renderer).

  • Shader MBlur - This enables the motion blurring of the material's parameters. This is particularly helpful for blurring displacement animations (if your renderer supports this).

  • frames - This specifies the number of frames to blur across.

    Note : MOSAIC begins the blur by this number before the current frame so blur leads to current frame.


Well, that's it for the materials tab... next up a deeper explanation of using the mapping utilities :)

Thanks for reading, WHiTeRaBBiT

No comments:

Post a Comment