Prev | Next



Maya Fluid Cache Implicit Field Plugin

January 2006


1 Introduction

PRMan 13 ships with an Implicit Field plugin that interprets Maya Fluid Cache files as level-set surfaces.


2 Usage

The plugin is called impl_mfc, and should be located in ${RMANTREE}/etc, which prman will search if your rendermn.ini file contains something like
/proceduralpath @:${RMANTREE}/etc
or if your RIB file includes the appropriate directory via Option "searchpath" "procedural" [...].

The impl_mfc plugin expects 23 float arguments and two strings. The first string argument must be "mfc". (In the future other values may be used to signify other volume file formats.) The second string is the name of the Maya Fluid Cache file.

The floating point arguments are described in this table:

Index Meaning
0-15 A transformation matrix that maps coordinates in the fluid field to object-space coordinates of the Blobby.
16 Frame time. Maya Fluid Cache files can contain multiple frames, and the plugin needs to know which one you want to sample. The time stored with each frame in a Maya Fluid Cache file is an integer whose units are 1/6000 second. At 24 frames/sec, frames are normally numbered in multiples of 250. (Presumably 6000 was chosen because its the smallest multiple of 24, 25 and 30 that gives 1/10 frame accuracy at all those frame rates.)
17-19 The x, y, and z size of the fluid volume. The center of the fluid cache grid is placed at the origin, with corners at (±x/2, ±y/2, ±z/2).
20 The timestep used for motion blur. This is only used if the Blobby is in a MotionBegin...MotionEnd block. It is used as a multiplier for the velocity information in the Maya Fluid Cache file.
21 The presumptive minimum value of the samples in the fluid file. This value will be mapped to a Blobby field value of zero.
22 The surface threshold value in the fluid file. This value will be mapped to the default Blobby field threshold value, which is 0.40535371318524.

Here is a complete RIB file for the example above:

FrameBegin 0
Display "mfc1.tif" "tiff" "rgba"
Quantize "rgba" 0 0 0 0
PixelSamples 4 4
Format 200 200 1
Clipping 1e-3 1e5
Projection "perspective" "fov" 6
LightSource "distantlight" 1 "from" [-7 12 -14] "intensity" [0.7]
LightSource "distantlight" 2 "from" [7 10 -14] "intensity" [0.7]
LightSource "ambientlight" 3 "intensity" [0.1]
Translate -.26 .52 11
WorldBegin
Imager "background" "color" [1 1 1]
Surface "plastic"
ShadingInterpolation "smooth"
Sides 2
Rotate 10 0 1 0
Rotate 10 1 1 1
Blobby 1 [
    1004 0 23 0 2 1
  ]
  [
    1 0 0 0             # transform
    0 1 0 0
    0 0 1 0
    0 0 0 1
    1500                # frame time in fluid file
    2 2 2               # size of fluid volume
    .1                  # h
    0 0.40535371318524  # min & level
  ]
  ["impl_mfc" "mfc" "test.mcfp"]
  "varying color Cs" [.2 .3 .9]
WorldEnd
FrameEnd

If one wishes to use data from the Maya Fluid Cache file for shading (for example, Maya Fluid Cache files store temperature data), it can be done by declaring the data after calling the plugin with ["impl_mfc" "mfc" "test.mcfp"]. Note that the data must be called as vertex-type variables.

For example, to use the temperature data in shading the above example, one could call:

["impl_mfc" "mfc" "test.mcfp"]
  "varying color Cs" [.2 .3 .9]
  "vertex float temp" []

The float variables available are:

And the color or vertex variables available are:

nCache Files

With the release of PRMan 17.0, the impl_mfc plugin now supports the newer nCache file format for fluid caches, introduced in Maya 2009.

In order to use nCache files, the plugin expects three string arguments to be passed in: 1) the first argument must be "mcc"; 2) the name of the XML description file for the cache; 3) the .mc cache filename. Ex:

FrameBegin 1
    Option "ribparse" "string varsubst" ["$"]
    Format 512 512 1
    Display "flame.tif" "framebuffer" "rgba" 
    Projection "perspective" "fov" [54.4322]
    ScreenWindow -0.5625 0.5625 -0.75 0.75
    Translate 0 0 100
    ConcatTransform [ 0.999935 -0.0043814 -0.0105109 0  
                      0 0.923019 -0.384754 0  
                      -0.0113875 -0.384729 -0.922959 0  
                      0 -2.4846 10.6085 1 ]
    WorldBegin 
        Surface "fire" 
        Translate 0 5 0
        Scale 5 5 5
            Blobby 1 [8 1004 0 23 0 3 1]
                     [1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
                     50000
                     10 10 10 0.1 0 0.0446]
                     ["${RMANTREE}/etc/impl_mfc" "mcc" "flame.xml" "flame.mc"]
                     "varying color Cs" [] "varying float density" []
                     "varying float temp" []
    WorldEnd
FrameEnd
The 23 float arguments have the same meaning as described in the table above. The plugin supports both "OneFilePerFrame" and "OneFile" cache types. In the case of "OneFilePerFrame", the frame number (argument 16) is ignored. Below is a render of Maya's "flame" example using the the plugin. The "fire" shader is the same one as described in the volume rendering app note.



Prev | Next


Pixar Animation Studios
Copyright© Pixar. All rights reserved.
Pixar® and RenderMan® are registered trademarks of Pixar.
All other trademarks are the properties of their respective holders.