Professional Documents
Culture Documents
1 INTRODUCTION
The RealFlow RenderKit 2.0 (RFRK) is a set of tools that has been designed to facilitate
the complex task of rendering RealFlow™ fluids.
For the past decade, simulation tools like RealFlow™ have been used to achieve realistic
fluid simulations. Nowadays RealFlow™ can be used to compute fluid dynamics shots
at a wide range of scales, from a big piece of ocean of several hundreds of meters to
millimetrical water drops. For example, if we simulate a stormy sea near the coast we will
have a mass of sea, splashes, spray, mist, foam, etc... and for each one of these elements
the water behaviour should be simulated at different scales.
The next task after the simulation is the shading process. At this stage we have to use and
combine all the fluid elements inside our simulation, choose a shading strategy for one of
them and pass them to the renderer.
Due to the renderer’s limitations, right now we cannot use the same material for all the
fluids of our simulation. So it is very important to have all these elements separated for
shading purposes. The appearance of a big ocean surface is very different from that of a
mist water drop, while both are made of water.
For the stormy sea scene that we have described above RealFlow will output the following
fluid elements: a big mesh with the sea dynamics with an animated displacement texture
to capture the high frequency and choppy waves; fluid particles or meshes for splashes
and foam; and water density fields for mist effects.
As said before: the shading strategy is not trivial and it can be done in several ways. For
example, splash particles can be render as meshes with a dielectric shader, as sprites with
semitransparent textures, or as a self shadow volume cloud. There are a lot of factors that
affect which approximation we should choose, such as the distance of the splash to the
camera, the velocity of the splash, etc.. The key idea is that each approximation will give
our fluids a different look.
The RealFlow RenderKit can help us in this complex task with different tools:
RFRK Mesher: this procedural tool has two main features. It can create a mesh, which
will represent the surface of our fluid, from our particles bin files at render time. Once the
fluid surface is computed it will be sent directly to the renderer. The second function is the
possibility to import our BIN or MD precomputed meshes and pass them to the renderer
directly. Using these features we skip the problem of having to load a huge geometry
mesh in our 3D platform viewport with all the consequences this brings. Also, with the
first feature we avoid saving all our meshes to disk because they are computed on the fly.
These features will greatly improve our current pipeline.
RFRK Particler: this tool can be of much help if we want to use our particles as different
primitives types like points, spheres, sprites, instances of certain geometry, etc... This
tool offers a lot of possibilities such as changing the particle size according to the camera
distance or according to a particle magnitude, multipoint clouds with velocity deformation,
camera frustum clipping, etc..
RFRK Cloud: we can use this shader to render our fluid particles and our mist density
fields and obtain a volumetric cloud as an object.
2 FLOWMESHER OVERVIEW
RFRK Mesher can extract a geometry fluid surface mesh implicitly contained inside our
fluid particles. It offers the possibility to be configured with a lot of parameters like
polygon size, smoothness, radius of the particles, etc… All these parameters must be set
accordingly to obtain the fluid surface shape that we are looking for.
If we have already precalculated our meshes in RealFlow, we can use RFRK Mesher to
insert them into our rendering engine directly. Normally a 3D platform viewport cannot
work very well with thousand or millions of polygons. With RFRK Mesher we can override
this issue and do all the shading tasks in an easy way.
One of the properties of the particles that we can configure is their volume ( or radius).
Depending on how much volume we give them we will obtain a more or less coarse mesh.
The images below give you some examples of the same fluid with different values for its
particles radius.
Boolean operations are possible with the RenderKit. You can add as many fluids to the
scene as you want. The appearance of continuity will be created by mixing the different
fluids in the scene so that they make up the same mesh. In the next image we have two
F.01 Radius = 0.025 F.02 Radius = 0.05 F.03 Radius = 0.1
fluid emitters working together.
Another interesting property of these particles is the possibility to filter them according to
their number of neighbours. In this way we can obtain only the core or splashes of our
fluids. In the images below we see how these filters act with fluid particles.
RealWave objects exported in RealFlow can also be meshed by the RenderKit, in the
same way as RealFlow fluid particles. The RFRK Mesher tessellates the RealWave mesh
The result is a uniform and smooth mesh without discontinuities and edges. internally, inserting particles inside each polygon, transforming RealWave meshes in
particle emitters, and could be used to obtain the same smooth and continuity behaviour
Next we can see how the subtractive fluids option works. that we have described above.
Another way to include fluids inside RFRK Mesher is loading precalculated and saved
RealFlow meshes. Before being able to shade and render them, we have to import them
into our 3D platform viewport. As described above this gives a lot of workflow problems.
With RFRK Mesher we skip these issues and pass the mesh to the renderer directly.
2.02 Meshing
Once we have decided which fluid elements will form our final fluid surface, we must
determine what we want our mesh to be like. Several global mesh properties can be set
up like its detail, smoothness, field type, etc…
The detail of our mesh is related to its resolution and the resolution is related to the size
of our polygons and finally to the total number of polygons. When decreasing the size of
our polygons we will get meshes with more resolution and all the fine features of our fluid
will be captured. However the meshes will also get more polygons. Below we have some
examples of the same fluid with different polygon sizes.
F.04 Smooth = 0 F.05 Smooth = 80
F.01 Polygon Size = 0.025 F.02 Polygon Size = 0.05 F.03 Polygon Size = 0.1
Some filters, like surface tension and surface relax, can be applied to our surface to get,
finally, the fluid surface shape that we are looking for.
Another key aspect involved in the final appearance of the mesh is the level of smoothness
used – i.e. whether you are looking for smooth- or blobby-looking fluid. To obtain a specific
look you will have to configure the mesh. The smoothness tells the algorithm how far it
should go to gather environment information to compute a given point of the mesh.
Sometimes our meshes have million of polygons and the renderer can have difficulties to
work with them. RFRK Mesher offers the possibility to remove polygons and redundant
information in several ways: removing polygons in areas where the mesh isn’t ever going
to be displayed ( like the internal or external side of objects ), moreover, we can discard
2.04 The magnitudes
the particles outside the camera frustum to compute a mesh that adjusts to the camera
projection. Fluid solvers not only compute the position and velocity of our fluids, there is information
of other physical magnitudes in our simulations too. Magnitudes like velocity, age, and
vorticity, which can be very important for shading purposes, are stored inside our BIN
fluid particles files. RFRK Mesher can access this information and export these magnitudes
to the vertices of the polygons of our fluid surface. Now, the magnitudes can easily be
connected to texture ramps and shader parameters, and can be included quickly in our
shader networks.
Another ways to reduce the number of polygons is according to the curvature of the mesh.
This way the algorithm will keep the high curvature areas and will start removing high
flat areas. You can also do this according to the distance of the polygon from the camera.
This means that polygons that are further away than a given distance will be removed
according to the surface curvature and closer polygons will be kept.
F.06 Shading Velocities F.07 Shading Pressures
There may be certain cases where we don’t want to render the fluids of our scene as
fluid-like surfaces and we are more interested in a more chaotic and blurred surface, as
with high speed and sparse fluids. Other times the fluid could be so far away from us that
we would never notice the difference between a fluid geometry mesh and any other low
cost geometry.
RFRK Particler uses the fluid particle positions to place other geometry primitives like
points, sprites, spheres or other geometry instances (* points primitive only available for
RenderMan and instances only available for mental ray).
With the multipoint option we can multiply the number of particles. We can generate a
spherical cloud of particles around each particle. There is an option to deform the spherical
cloud of particles along the velocity vector of the particles.
Motion blur depends on several camera and scene properties. Moreover, there is an option
to clamp the max velocities of the particles to have more control over motion blur.
We can decrease the number of particles with camera clipping, so all the particles that are
outside the camera frustum projection will be removed.
And finally we can filter our particles according to the number of neighbors, as we do with
RFRK Mesher.
3.05 Magnitudes
The RFRK Particler can also read the particle properties from RealFlow fluids. As said
above in the RFRK Mesh section, you can read them in your materials (for instance,
mapping the opacity based on the age of the particle) to have more control over shading.
It often happens that we cannot create a specific fluid look using just geometry, and we
need to find other solutions. For example, creating the effect of the splash of a breaking
wave or the water colliding against the rocks is very hard to achieve with just geometry
and a surface shader. One of the main difficulties is with the material displaying light
scattering and attenuation when it travels inside a volume.
This effect can be handled easily with volumetric approximations. RFRK Cloud is a
volumetric shader that we can use for this purpose.
F.04 Radius Scale = 0.02 F.05 Radius Scale = 0.04 F.06 Radius Scale = 0.09
We can easily increase the density of our density fields, obtaining a more opaque volume.
As we have previously explained with the other tools, we can modify the input fluids and
F.07 Density Scale = 1 F.08 Density Scale = 3 F.09 Density Scale = 6
control their contribution to our density clouds to render.
These fields are saved to memory in a voxelization structure, so the size of the voxels is
decisive for our final cloud appearance. (**the Cell Size and radius are only configurable 4.02 Lighting and Shading
for BIN particle files. For mtc files these properties are defined in RealFlow).
RFRK Cloud doesn’t only allow us to control the shape and density of our fluid cloud field.
We can also manage how much and in what way the light of our scene will interact with it.
Some basic changes can be made, like increasing the intensity of the light that reaches our
fluid, or adding ambient lighting to remove hard shadows areas.
F.01 Cell Size = 0.06 F.02 Cell Size = 0.03 F.03 Cell Size = 0.01
Light anisotropy can also be controlled. The light anisotropy tells us in which direction the
light is scattered according to two vectors. The first vector is the camera to the point of the
cloud that we are sampling, and the second vector is from that point to the light position.
We can control the amount of light that is scattered and absorbed as the light travels
through the cloud. F.06 Anisotropy = -0.5 F.07 Anisotropy = 0.1
Cloud colored
It is important to understand how the shader interprets the RGB channels: the green
channel indicates the displacement in the normal direction of the surface. The red and
blue channels will displace the geometry in the two other directions, as explained above.
For example, you can specify that a color with RGB values 0.5 0.5 0.5 is equal to no
displacement. This means that values below 0.5 give a negative displacement and above
0.5 a positive displacement. To just get a displacement in the normal direction, the red
and blue channels should be set to 0.5.
You can use the displacements exported from RealFlow or combine them with textures
from your 3d platform.
a. Windows 64 bits
Let’s look into the “RFRenderKit_Max_ 2” plug-in made for the RFRK and 3D Studio Max.
The main areas that we have focused on are workflow and performance.
The plug-in has an installer wizard so that users are no longer required to manually copy
files into the 3D Studio Max directory. The installer auto-detects which 3D Studio Max
versions are installed and where. All versions of 3D Studio Max starting with v.8.0 to 2010
are supported, with 64-bit builds where applicable.
The wizard auto-detects 3D Studio Max versions and installation locations. b. RFRK Mesher Parameters
RFRK Mesher generates a geometry shader in the viewport so that you can select RealFlow
uu Note: The RFRK is designed to work with mental ray; therefore mental ray must be activated BIN particle files to generate a polygonal mesh at render time.
in 3D Studio Max in order to use the RFRK. To activate the mental ray render in 3dsMax, go When you click on the RFRK Mesher button, it will ask to you to select the BIN sequence
to the render dialog and select mental ray Renderer. files.
a. Toolbar
When you select a file sequence, the geometry shader will be represented by a rectangle
The RFRK functionalities are accessible via a floating/dockable toolbar and a menu.
in the viewport. If we move the timeline the particles will be drawn in the viewport. The
contents of the geometry shader will be rendered with mental ray.
The geometry shader generated by RFRK Mesher behaves in the same way as standard
geometry in 3D Studio Max. The geometry shader will be located in the same place as it
RFRK toolbar was in the original scene in RealFlow, but it can be moved, scaled or rotated if you want.
The function of the buttons (from left to right): If you select the geometry shader you can see its properties in the command panel.
• RFRK Mesher: Creates a geometry shader in the viewport to load the BIN sequence
to generate the mesh.
• RFRK Particler: Creates a geometry shader in the viewport to load the BIN sequence
to generate the particles.
• RFRK Cloud: Creates a cloud object to load the BIN and MTC sequences to generate
a volumetric cloud.
The Parameters tab is represented by a RFRK Mesher map button which shows the
parameters to control the properties of the fluid. There are two ways to modify these
parameters:
By default the geometry shader is created with a RFRK Mesher map. This map can be
modified by dragging it from the command panel into the Material Editor and creating an
instance. When you modify the map in the Material Editor, it will be modified automatically
in the geometry shader. (See image “instancing the RFRK Mesher map” above). The map
properties will be displayed when you select the map slot.
The second way is to create a map in the Material Editor by selecting the icon and choosing
the RFRK Mesher map (as shown in the image below).
F.03 Geometry shader parameters F.04 Instancing the RFRK_Mesher map in the command panel
Viewport representation gives you the option to view the particles in the viewport. If you
uncheck this option, a rectangle will show the position of the particles.
RFRKMesher map: In order to assign the new map to the geometry shader, drag the
map from the Material Editor to the map button in the command panel.
uu Note: In order to be able to choose the RFRK Mesher map in the Material Editor, the mental
ray Renderer must be active in the render dialog.
The parameters will appear if you click on the slot of the RFRK Mesher map in the Material
Editor.
• Max Velocity (new): Clamp the velocity to this value. Sometimes due to wrongly
defined simulation settings, the particles of the fluid can contain very high velocities.
To get good motion blur results it is necessary to clamp the velocities. This
parameter will clamp all the velocities higher than this value to the set value.
• Subtractive (new): Use if you want to use the sequence as a negative field.
• Wait (new): Wait until the next frame exists. Sometimes we are rendering while the
simulation is still being calculated. By activating this option, we tell the renderer to
wait until the next simulation frame is computed and written, to ensure that there will
be a file to render when launched.
• Mute (new): Ignore the sequence.
• Viewport Color (new): Allows the user to select the color to represent the
sequence’s particles in the viewport.
for this, the “Smooth” parameter and the particle emitter’s Field settings for “Radius” Clipping Parameters
can be adjusted to achieve a better result. Without smoothing and enough resolution
you can see the individual spheres around the particles. • Object Clip: Clipping is a very effective and convenient way to reduce a mesh’s size.
• Axis: Allows you to choose the axis coordinate system. Whenever there are invisible parts they should be clipped. Try to use simple objects
with even surfaces, for example cubes, because complex objects will only increase
mesh creation time.
Camera Parameters • Camera Clip: Cuts away everything that’s outside the currently adjusted field of
view.
• frame: Actual frame. • Out Inside: You can decide which “side” of the clipping object should be used.
• fps: Frame per second, very important to compute the correct motion blur. It should “Inside” uses the object’s volume and everything inside it will be cut away. “Outside”
be the same as in your simulation. clipping deletes all polygons outside the used node. Open parts or holes are filled with
polygons and the result is a closed mesh.
uu NOTE: In order to use Motion Blur, the Motion Blur option must be selected in the properties • Clip Files: Use if you want to activate clipping with geometry. You need to specify the
of the mental ray renderer. SD file where the geometry is stored. See the following parameter.
• Add File: An Sd file is needed to compute the clipping. This option shows a browser
to choose the file. All the geometry defined inside this file will be used for clipping.
Filters Parameters
• Filter Mesh: You can choose whether you want to apply the filters (“Yes”) or not Optimize Parameters
(“No”). Filtering is a very fast method and doesn’t increase meshing time too much. • Optimize: This entry provides three options: “No”, “Curvature” and “Camera”. “No”,
The result is always worth the slightly longer creation process. of course, disables any optimization. The “Curvature” and “Camera” settings unlock
• Relax: This type stretches and sharpens the mesh’s edges and gives a much more further settings to control the mesh quality. The “Camera” option depends on the
natural look. The result is a more watery and realistic appearance. “Relaxation” helps current view. Areas closer to the camera have a higher resolution, while distant parts
you to get quality meshes even from low resolution emitters. The default value is show reduced quality. “Curvature” analyses the mesh’s geometry and polygons in flat
a very good starting point and it’s very likely that you don’t have to alter it at all. areas will be removed first. In addition, higher values can be used to delete polygons
“Relaxation” is very sensitive and instead of changing the filter’s strength, it’s often from areas with more curvature.
better to lower or raise Steps. Though “Relaxation” is very effective, it has limits: • Merge QualityFactor: To specify a mesh’s quality, you can enter a value between 0
Emitters with just a few hundred or thousand particles are usually not suited to create and 1. Higher settings yield to better meshes, but decrease calculation speed.
a perfect mesh – even with filtering. • Polygon Reduction Percent: You can easily reduce the number of polygons
• Tension: If you can see unwanted high frequency structures on your mesh, then by determining a certain percentage. An example: By entering a value of 75, this
it’s a good idea to activate this filter type. “Tension” flattens the mesh surface and function keeps approximately 75% of the original polygons and deletes the remaining
removes these artifacts. Similar to “Relaxation”, this type is also very sensitive and 25%. So, a mesh with 100,000 faces will have around 75,000 polygons left after
strongly depends on the according “Steps” settings. High-frequency patterns don’t optimization.
occur very often, so the “Tension” filter is rarely used. • Camera Distance: This value represents the distance between the camera and
• Steps: Each filter is affected by this parameter. Higher settings strengthen the the area where the first polygons will be removed. With growing distance (= higher
influence of “Relaxation” and “Tension”, and they can lead to completely over-filtered values) the number of polygons decreases. The area with the highest resolution is
meshes. High values may produce unrealistic results, unless you want to achieve a
certain effect. Another issue is that very high settings will reduce the amount of detail.
always next to the camera. decreases a lot if we only use objects with a few thousand polygons.
System Parameters
These parameters configure certain operative system settings and the way we want to
pass the mesh to the renderer.
• Threads: Number of threads to use.
• Max Memory: Maximum size in megabytes of each subvolume of mesh.
• Number of Polygons Per Group: Number of polygons of each submesh. For mental
ray this is a critical parameter. It is not the same to send an object with a few million Render with Magnitude effect RFRKMesher Age channel mapped to Opacity channel
polygons than to send several objects with a few thousand polygons. The render time
To apply the magnitude to the opacity channel as the images show, select the Age channel
in the RealFlow Mesher map and then apply the RealFlow Texture Magnitude map to
the desired property.
F.03 RealFlow Texture Magnitude get the value in RFRK Mesher shader F.04 Texture Magnitude applied to Opacity
uu NOTE: Bear in mind that you should check if the particles have the correct normalized
values for each magnitude.
By default, the loaded particles will appear in the same place as in the RealFlow scene and
they can be moved, rotated and scaled as in the RFRK Mesher geometry shader.
When you have created the geometry shader, select it and go to its properties in the
command panel.
To assign the new map to the geometry shader, drag the map from the Material Editor to
the map button in the command panel.
uu Note: To be able to choose the RFRK Particler map in the Material Editor, the mental ray
renderer must be activated in the render dialog.
The parameters will appear when you click on the slot containing the RFRK Particler map
in the material editor.
F.04 Geometry shader in the command panel F.05 Instancing the RFRKParticler map
Max Particles indicates the maximum number of particles that can be viewed in the
viewport. It is a good idea to limit the number of particles in the viewport representation
when dealing with heavy scenes which could be costly for the system to manage.
The Parameters tab in the command panel is represented by a RFRK Particler map button
which contains the parameters to control the properties of the fluid. As in RFRK Mesher,
we can drag the map button into the Material Editor to be able to access the RFRK
Particler map properties. You can also create a new RFRK Particler map using the icon and
choosing the RealFlow RFRK Particler 2 map (as shown in the image below). RFRK Particler map properties in Material Editor
Particle Sequence Files • Axis: Select the coordinate system where you want to work.
• Filename: Path and prefix of the BIN sequence. • Percent Total Particles: It is possible to render just a percent of the total number
• Offset: Offset for this sequence. of particles.
• Wait (new): Wait until next frame exists.
• Mute(new): Ignore this file. Clipping Parameters
• Viewport color (new): Color to display the loaded sequence in the viewport. • Camera Clip: Remove all the particles that are outside the camera frustum.
By default, the box will appear in the same place as in the RealFlow scene and it can be
moved, rotated and scaled as in the RFRK Mesher or RFRK Particler geometry shader.
When you have created the volume geometry shader, select it and go to its properties in
the command panel
F.04 Volume shader in the command panel F.05 RFRK Cloud map
LOD indicates the percent number of particles that can be viewed in the viewport. It is
a good idea to limit the number of particles in the viewport representation when dealing
with heavy scenes which could be costly for the system to manage.
To get the shader in the material editor, we’ll select the “Pick material from Object” and
we’ll then click on the RFRK Cloud Object in the viewport.
F.02 Particles loaded in the viewport F.03 Viewport representation for particles
F.05 mental ray shader in the command panel F.06 Surface and Shadow parameters F.07 Cloud map from Volume parameter
We can also select a RealFlow Cloud map from the maps selector.
To assign the new RFRK Cloud map to the geometry shader, we must create a mental ray Sequence Files
map and include it into the Volume parameter and add a rfrk_cloud2_mat in the Surface We can import several emitters and mist fields to get an inhomogeneous participant
and Shadow Parameter. media in the space of our scene.
The parameters will appear when you click on the slot containing the RFRK Cloud map
included in the Volume parameter. • Filename: Name of the BIN or MTC file that you want to import for generating the
density field.
Parameters
• Light Intensity: Set your light intensity.
• Light Ambient: Set ambient light. This is useful to not get black self-shadow areas.
• VolumeColor: color of the cloud. RFRK Displacement using an RGB map
• Density Color: Color or texture scale factor for density field. In 3D Studio Max we can apply a displacement shader to the Displacement slot of a mental
• Ext Coeff: Extinction coefficient. The amount of light that is absorbed by the cloud. ray map.
• Albedo: Ratio between the extinction coefficient and the scattering coefficient.
• Anisotropy 1: Controls the shape of the first lobe that defines the scattering. Ranges
between [-1,1] A zero value means an isotropy scattering. Minus one full backward
scattering, and one full forward scattering.
• Anisotropy 2: Controls the shape of the second lobe that defines the scattering.
• Weight 1: Scale factor for anisotropy 1.
• Weight 2: Scale factor for anisotropy 2.
• Integ Start: Specify when you want to start integrating the ray.
• Integ End: Specify when you want to stop integrating the ray.
• Step Size: This is the integration step size which is related to the quality of the
volumetric. This parameter has a big influence on the render times.
uu Note: To render RFRKClouds, “Use Autovolume” must be checked in the mental ray renderer.
To assign the new RFRK Displacement map to the displacement, we must create a new f. RFRK Texture Magnitude
mental ray shader and click on Displacement Slot. The RealFlow Displacement can now
be selected.
The parameters will appear when you click on the slot containing the RFRK Displacement
map included in Displacement slot.
Parameters
Allows you to load multiple texture sequences.
Sequence
• Intensity: The height that the geometry will reach.
• Map: Map used for the displacement.
• Mute: Ignore this texture
All images in this book have been reproduced with the knowledge and prior consent of the artists concerned and
no responsibility is accepted by producer, publisher, or printer for any infringement of copyright or otherwise,
arising from the contents of this publication. Every effort has been made to ensure that credits accurately
comply with information supplied.