[size=200]Krakatoa SR Exporter from Maya[/size]
[size=200]Note: This exporter has been replaced by a full Maya Plugin and is no longer in use.[/size]
Document Started: 2011/10/12
Document Edited: 2012/06/05
WORK IN PROGRESS
This document describes the features and workflows of the Maya to Krakatoa SR Reference Exporter.
The latest version of the MEL source code of the Reference Exporter can be downloaded here.
Please note that ALL Krakatoa SR Exporters are currently provided as Reference Implementations and are not part of the Krakatoa SR product. In other words, they are not supported for production use and are meant merely as examples of possible Krakatoa SR connections from different 3D applications.
[size=150]Overview[/size]
The Maya To Krakatoa SR Exporter was developed as a Proof Of Concept during the early development stages of Krakatoa SR.
It is currently implemented in MEL, but there are plans for a Python version.
It requires the loading of Maya’s OBJExport plugin, and Thinkbox’s PRTExporter plugin. The PRTExporter plugin is included with the script download.
[size=150]User Interface[/size]
Maya2KSR_GUI_v003.png
[size=150]EXPORT TO KRAKATOA SR Button[/size]
Pressing this button will export the current frame to a Python scene file and will generate the necessary PRT and/or OBJ files.
The output will be directed to the current Project folder and will be saved in a hierarchy of folders inside the \scenes\Maya2KSR\ folder.
Depending on the settings in the “Python Export Settings” panel, the resulting PY file can be opened in a default editor, the renderer can be launched with or without frame buffer, and the final image could be opened in the default viewer for the output file type.
WARNING: In the current implementation, you MUST have saved the Maya scene to a file first for the exporter to build the output path correctly!
[size=150]Export Options[/size]
Render Frames
This drop-down list provides the following options:
- Current - exports the current frame only. If the Export options for showing the PY source, rendering the frame and Opening the Image Viewer are checked, these operations will be performed.
- Scene Segment - exports the frames of the scene segment. If the Export options for showing the PY source, rendering the frame and Opening the Image Viewer are checked, these operations will NOT be performed.
- Render Range - exports the frames defined by the Render Options dialog. If the Export options for showing the PY source, rendering the frame and Opening the Image Viewer are checked, these operations will NOT be performed.
Export Maya Particles
When checked, Maya particle systems will be exported to PRT files and rendered by Krakatoa SR. When unchecked, Maya particles will be skipped.
Export PRT Loaders
When checked, Maya objects tagged as Krakatoa PRTLoader via an Extra Attribute will be included in the scene description and rendered by Krakatoa SR. When unchecked, PRT Loader objects will be skipped.
Export Maya Hair
Not Implemented Yet
Export PRT Volumes
When checked, Maya geometry objects tagged as Krakatoa PRTVolume via an Extra Attribute will be saved out as OBJ and filled with particles by Krakatoa SR at render time. When unchecked, PRT Volume objects will be skipped.
[size=150]Global Render Values Panel[/size]
Override Background Color
When checked, the background color will be set to the color value specified by the Background Color swatch.
When unchecked, the background will default to black (0,0,0)
Override Color
When checked, the Scatter Color of all scene particles will be set to the color value specified by the Color Override swatch.
When unchecked, the particle’s Color channel will depend on the source and shaders applied to the particle objects.
Override Emission
When checked, the Emission Color of all scene particles will be set to the color value specified by the Emission Override swatch.
When unchecked, the particle’s Emission channel will depend on the source and shaders applied to the particle objects.
Override Absorption
When checked, the Absorption Color of all scene particles will be set to the color value specified by the Absorption Override swatch.
When unchecked, the particle’s Absorption channel will depend on the source and shaders applied to the particle objects.
[size=150]Render Passes Panel[/size]
Save Normal Pass
When checked, an additional output image will be saved with the Normal channel information.
When unchecked, no Normal pass will be generated.
Save Velocity Pass
When checked, an additional output image will be saved with the Velocity channel information.
When unchecked, no Velocity pass will be generated.
Save Z-Depth Pass
When checked, an additional output image will be saved with the Z-Depth information stored in R,G and B as positive system units values.
When unchecked, no Z-Depth pass will be generated.
[size=150]Shader Panels[/size]
These panels are shown and hidden dynamically depending on the current Shading Mode (Phase Function) selection in the Rendering Controls Panel.
[size=150]Rendering Controls Panels[/size]
Shading Mode
This drop-down list provides the currently supported Phase Functions:
- Isotropic - light is scattered equally in all directions.
- Phong Surface - light is scattered according to the particle’s Normal (X axis of orientation) and the light and camera directions.
- Henyey-Greenstein - light is scattered differently depending on the light and camera directions and a Phase Eccentricity factor.
- Schlick - light is scattered differently depending on the light and camera directions and a Phase Eccentricity factor.
- Kajiya-Kay - simple hair shading model with a single highlight control
- Marschner - advanced hair shading model using primary and secondary highlights, glint and diffuse controls.
Rendering Method
This drop-down list provides the currently supported rendering methods:
- Particles - particles are drawn as pixel-sized points by splatting from back to front in camera space.
- Voxels - particles are transferred to a grid and the voxels are rendered one slice plane at a time, one pass per light.
Ignore Scene Lights
When unchecked (default), point, spot and direct lights found in the Maya scene will be exported to the scene.
When checked, lights will not be exported with the scene. This is useful when rendering with Emission or with Force Additive Mode on.
Use Emission
When unchecked, the Emission channel will be ignored and no emission will be calculated.
When checked, the Emission channel will be taken into account if available.
Use Absorption
When unchecked, the Absorption channel per particle will be ignored and absorption will be calculated with a constant value for all particles, resulting in gray shadows.
When checked, the Absorption channel per particle will be taken into account.
Voxel Size
Defines the size of the voxel in system units. Default is 0.5.
Smaller values produce finer results at cost of performance.
Voxel Filter Radius
Defines the number of neighbor voxels to filter over.
A value of 1 produces no filtering.
Higher values produce smoother results at cost of performance.
Force Additive Mode
Switches the renderer internally to render additively.
The Color channel of the particles will be copied into the Emission channel, while Color and Absorption will be set to black (0,0,0).
The result is purely additive rendering in RGB without Alpha.
No sorting will be performed in the drawing pass, and turning off lighting using “Ignore Scene Lights” is a good idea to save render time.
Note that you can mix volumetric and additive rendering by providing respecive values for the Color, Emission and Absorption channels.
[size=150]Lighting and Drawing Pass Density and Filtering Panel[/size]
Self-Shadow Filter
The following options are available for the filtering of the Attenuation Map responsible for the particles self-shadowing:
- Nearest - The particle is drawn in the one pixel closest to it.
- Bilinear - The particle is drawn in 2x2 pixels using bi-linear filtering.
- Bicubic - default -
- The particle is drawn in 3x3 pixels using bi-cubic filtering.
Draw Point Filter
The following options are available for the filtering of the particles drawn into the final image:
- Nearest - The particle is drawn in the one pixel closest to it.
- Bilinear - default - The particle is drawn in 2x2 pixels using bi-linear filtering.
- Bicubic
- The particle is drawn in 3x3 pixels using bi-cubic filtering. This produces smoother final images and is slightly slower than Bilinear.
Lighting Pass Density
Defines the Base value of the optional Lighting Pass Density. Used together with the Lighting Pass Exponent (see below) to produce the actual density value as BaseValue10^ExponentValue. For example, a Base value of 5.0 and Exponent of -2 produces a Density value of 0.05, a Base value of 1.0 and Exponent of 3 produces a Density of 1000.0 and so on.
Lighting Pass Exponent
Defines the Exponent component of the optional Lighting Pass Density. Changing the Exponent up or down by one allows you to increase or decrease the Density value by an order of magnitude. For example, if the Base value is 2.0 and Exponent is -1 (resulting Density is 0.2) and you want to reduce the Density 10 times, just change the Exponent to -2 and you will get 0.02 without typing any zeros.
Use Lighting Pass Density
When unchecked, the Lighting Pass Density will be taken from the Final Pass Density. In other words, the behavior of light will be physically correct since the particles will have the same density from both the point of view of the light source and the camera.
When checked, the Lighting Pass Density controls will become available and will let you to decouple the Density for the two passes. This way, you can make the particles appear less or more dense to the light than the camera sees them, for example to let more light pass through the volume whole preserving the alpha contribution of the particle cloud to the final image.
Final Pass Density
Defines the Base value of the Final Pass Density multiplier. Used together with the Final Pass Exponent (see below) to produce the actual density value as BaseValue10^ExponentValue. See the Lighting Pass Exponent description above for fore details.
Final Pass Exponent
Defines the Exponent component of the Final Pass Density multiplier. See the Lighting Pass Exponent description above for more details.
Emission Strength Value
Defines the optional base Emission Strength value available when “Use Emission Strength” is checked. It is used with the Emission Strength Exponent to define the actual value as BaseValue*10^ExponentValue
Emission Strength Exponent
Defines the Exponent component of the optional Emission Strength. Changing the Exponent up or down by one allows you to increase or decrease the Emission Strength value by an order of magnitude.
Use Emission Strength
When unchecked, the Emission Strength will depend on the Density value.
When checked, the Emission Strength values will become available and can be used to scale the Emission up or down.
[size=150]Motion Blur and DOF Panel[/size]
Enable Motion Blur
When unchecked, no Motion Blur effects will be rendered.
When checked, the Motion Blur effects will be enabled.
Krakatoa SR supports several types of Motion Blur. All of them are supported by the Maya Reference Exporter:
- Particle Motion Blur from Velocities - particles are drawn multiple times along the velocity vector.
- Camera Motion Blur from animated Camera transforms - multiple samples of the camera transform are exported in a Motion() block.
- Object Motion Blur from animated PRT Loader object transforms - multiple samples of the object’s transforms are exported in a Motion() block.
- Matte Object Transform and Deformations Motion Blur - multiple samples of the object’s geometry are exported to OBJ files in a Motion() block.
Particle Segments
This value controls the number of passes to be drawn to produce the motion blur effect. Note that currently the lighting is performed once at the center of the interval and the drawing (Final Pass) is performed multiple times. A possible feature for the future would be to allow the relighting of the particles per pass (this is possible in Krakatoa MX via the 3ds Max Multi-Pass Camera effect).
A value of 1 will produce no motion blur, but if Jittered Motion Blur is enabled, it will jitter the particles along the velocity vector around the particle Position within the Shutter interval.
A value of 0 effectively disables the Motion Blur effect.
Jittered Motion Blur
When unchecked, the particles will be drawn at equal intervals within the shutter range, according to the Shutter Angle and Particle Segments values.
When checked, the particles will be drawn at random intervals within the shutter range. If the Particle Segments value is 1, a single sample will be drawn at a random location within the shutter interval.
Shutter Angle
Defines the Shutter Angle in Degrees. Default is 180.0 (half a frame).
Enable Depth Of Field
When unchecked, no Depth Of Field effect will be generated.
When checked, the Camera’s f-Stop value, the Focal Length in system units and the Focal Distance in system units will be exported and each particle will be drawn within the circle of confusion as multiple samples.
DOF Sample Rate
Defines the quality of the DOF effect by affecting the number of samples per particle to be drawn in the circle of confusion. Default is 0.1. Higher values increase the number of samples and thus the quality at cost of performance.
NOTE that rendering one million particles with high DOF settings can be equivalent to drawing many million particles due to the multiple samples per frame. Always start with low Sample Rate settings and adjust the value slowly to avoid long rendering times.
[size=150]PRT Objects Management Panel[/size]
Tag Selected Objects As PRT Volumes
When pressed, any selected objects in the scene will be tagged with Extra Attributes as “Krakatoa PRTVolume”.
Any geometry object tagged as PRT Volume will be exported to OBJ and its volume will be procedurally filled with particles at render time.
Disable Selected PRT Volumes
When pressed, unchecks the “Krakatoa PRTVolume” Extra Attribute in all selected objects, if available.
[size=150]Matte Objects Panel[/size]
Tag Selected Objects As Matte
When pressed, any selected objects in the scene will be tagged with Extra Attributes as “Krakatoa Matte”.
Any geometry object tagged as Matte will be exported to OBJ and will be converted to a Depth Map internally to determine the occlusion of particles.
Disable Selected Matte Objects
When pressed, unchecks the “Krakatoa Matte” Extra Attribute in all selected objects, if available.
Enable Matte Objects
When checked, matte objects tagged with the “Krakatoa Matte” Extra Attribute will be exported to OBJ and rendered as Depth Map to occlude particles. When unchecked, Matte Objects will be skipped.
Super-Sampling
This value controls the resolution of the Depth Map generated from the Matte Objects. Default is 1 which produces the same resolution as the output image and thus one pixel to one pixel correspondence between Depth Map and particle. Increasing this value will increase the size of the Depth Map and thus provide more pixels per particle to filter by.
Save Multiple Passes
Not Implemented Yet. When supported, this option will allow the saving of two output files - one containing foreground particles, one containing partially or completely occluded particles.
[size=150]Python Export and Render Settings Panel[/size]
Exporter Log Level
This drop-down list controls the verbosity of the Exporter and has the following options:
- none - nothing will be written to the Maya Output Window.
- progress - basic progress information will be written to the Maya Output Window.
- debug - detailed information will be written to the Maya Output Window, including debug prints regarding implicit Partition handling. This can slow down the export of large number of Partitions significantly.
Render Log Level
This drop-down list exposes the Render-time log verbosity level.
No License Handling
This drop-down list exposes the Render-time behavior when no license can be acquired.
- When set to “Watermark”, the image will be rendered but watermarked.
- When set to “Fail”, no rendering will be performed. This is useful when having valid licenses but wanting to prevent license server failures from producing watermarked output in production.
Missing Seq. Handling
This drop-down list exposes the Render-time behavior for handling missing frames.
- When set to “Fail”, an attempt to load a missing frame will cause an error and the particles will not be rendered.
- When set to “Skip”, the requested frame will be searched for during export and if it is missing, it will be written out but remarked with #. This is useful when the particle files or partitions are being generated by a separate task, possibly on the network, and the file is expected to be available later. The remark could be removed once the frames are actually there.
- When set to “Ignore”, and only if loading frames for retiming with PlaybackGraph, the missing file will be ignored and the scene will still render without it. If rendering regular frames without retiming, the render will fail.
Open Scene File In Text Editor
When checked, the Python Scene File will be launched. If a default editor or Python IDE is assigned to open Python files, the scene file will open. NOTE that it currently blocks the Maya thread and must be closed before you can continue working in Maya.
Render Scene Using Krakatoa SR
When checked, the Python Scene File will be launched by invoking the BAT/bash file associated with the current frame.
Show Krakatoa Frame Buffer
When this options is checked, a dedicated Krakatoa Frame Buffer application will be launched to monitor the rendering process. This is Not Implemented Yet!
Open Render in Image Viewer
When this option is checked, the output RGB file will be launched with its viewer/editor specified in the “Path to Image Viewer” text field. For example, if fcheck is listed as the application to open images, saving to OpenEXR from Krakatoa SR will launch fcheck when rendering finishes.
[size=200]Using the Krakatoa SR Reference Exporter[/size]
[size=150]Creating and Rendering a PRT Loader[/size]
The Krakatoa SR for Maya plugin comes with a PRT Loader object. There is an icon under the KrakatoaSR shelf that allows users to create PRT Loader objects. This would require an existing PRT or RealFlow BIN file or file sequence.
- Start Maya or start a new scene
- Create a PRT Loader object using the icon under the KrakatoaSR shelf.
- Using the newly created object, select an existing PRT or BIN file.
- Create a light (Point, Spot or Directional) to illuminate the particles.
- Press the EXPORT TO KRAKATOA SR button.
RESULT: The sequence will be exported to the Python scene file. Normally the PRT file is referenced directly in the Python scene file. However if the user has requested changes to the particles (such as limiting the particle count), the PRT file will be modified and a new PRT will be written to disk.
[size=150]Defining and Rendering a PRT Volume[/size]
The simplest way to get a point cloud of Maya and render it in Krakatoa SR is by exporting a geometry object to OBJ and filling its volume with particles at render time.
The Krakatoa SR Reference Exporter provides some simple controls to turn any geometry object into a PRT Volume.
- Start Maya
- Create or import a geometry object into the scene (for example a Sphere, or a Stanford model like the Bunny or the Buddha)
- Create a light (Point, Spot or Directional) to illuminate the object.
- Open the Krakatoa SR Exporter GUI (assuming you followed the installation instructions on the download page - if running under Linux, the script might require some tweaking)
- Select the geometry object to turn to particles and press the “Tag Selected Objects As PRT Volumes” button in the “PRT Objects Management” panel.
- Select the transform node of the object - under Extra Attributes, you should see a number of PRT Volume controls including spacing. Depending on the size of your mesh, you might want to decrease the default 1.0 spacing. For example, if you have a sphere with a radius of 1, you might need spacing of 0.01 to get anything reasonable at render time.
- Check the Override Background Color and Override Color options. Set the Background color swatch to a shade of blue and the Color Override to white.
- Press the EXPORT TO KRAKATOA SR button.
RESULT: If the OBJexport plugin is loaded, the scene will be saved in subfolders of the Maya2KSR folder in your current project’s \Scenes folder.
The Python file will be stored in a sub-folder called “SCENE”, the OBJ file will be saved under “MESHES”.
A BAT file will be created in the Maya2KSR folder with a command to launch c:\python26\python.exe with the scene file. (TODO: If running under Linux, this part of the exporter has to be modified to call Python correctly).
If running under Windows, calling the BAT file should launch the renderer and produce an OpenEXR output file in the “OUTPUT” sub-folder. This can be done automatically by checking the “Render Scene Using Krakatoa SR” in the Exporter UI before exporting the scene - the BAT file will be launched automatically.
[size=150]Rendering Maya Particles[/size]
The Krakatoa SR Reference Exporter can output your Maya particles to PRT files using the M2K PRT Saver plugin.
Assuming the plugin is compiled for and installed in your version of Maya, you can follow these steps:
- Open a Maya scene with Maya particles.
- Make sure there is at least one light, or switch the Krakatoa Explorer to “>Force Additive Mode” or alternatively enable “Override Emission” and “Use Emission” to render all particles as self-illuminated.
- Press the “EXPORT TO KRAKATOA SR” button.
RESULT: The Maya particles will be saved to a PRT file in the \PRT sub-folder of the Maya2KSR folder.
[size=150]Tutorial video for importing deep images and holdout masks from RenderMan into Krakatoa SR using Maya[/size]
The following video is a tutorial of how to set up Krakatoa SR and export particles from Maya to Krakatoa SR: