Sie sind auf Seite 1von 5

TUTORIALS | Dynamic fluids

ON THE WEB
● Full supporting
files for this article
www.3dworldmag.com

REALFLOW
ON THE CD
● RealFlow 4 Special

Make a splash
Who needs high-speed macro photography when you’ve got RealFlow? Discover how to use the Special Edition
Edition (exclusive
to 3D World)
SEE PAGE 66

of this powerful fluid simulator on the CD to capture the microscopic world shown above BY GUSTAVO SÁNCHEZ PÉREZ

ome time has passed since Next Limit package and render it to achieve a water-like appearance. We’re

FACTFILE
FOR
S released RealFlow 3. Now a new version of
this multi-platform fluid and dynamics
simulator, used on Ice Age 2: The Meltdown
using XSI, but the .obj file is included in the supporting files, so
you could render it in any application you prefer.
The Special Edition has a maximum particle count of
and Poseidon, has arrived – and it comes loaded with cool 50,000, limiting the fine detail that can be achieved, so we will
RealFlow 4
features. A revamped interface, integrated Python also provide some tips for refining the simulation in the full
DIFFICULTY
Elementary / Intermediate scripting and a massive improvement in stability are just commercial edition of the software: to upgrade and claim a
a few of the many good things in this new version. These special 3D World reader discount, turn to page 65.
TIME TAKEN
45 minutes features make RealFlow 4 the ideal solution for studios Full supporting files for the tutorial are available for
faced with the complex task of simulating liquids. download from our website, www.3dworldmag.com. To find
ON THE WEBSITE
• Full-size screenshots In this tutorial, we are going to use the exclusive Special them, click the Stop Press link from the left-hand menu of the
• RealFlow scene files Edition of RealFlow 4 on the CD to recreate a high-speed homepage. Further tutorials can be found on the CD itself, and
• Final OBJ file
photograph of a water droplet falling into a larger body of in the user guide that comes with the software. Consult these
• Bonus RealFlow script
• Final XSI scene file water, controlling the simulation – within limits – to generate a if you get stuck at any point in the walkthrough.
classic crown-shaped splash. We will start by exploring the
ON THE CD
RealFlow 4 SE basics of fluid simulation, then refining the parameters that Gustavo Sánchez Pérez is a Spanish VFX artist. Formerly
control the effect that we want to achieve. Once the initial employed at the Moving Picture Company, he now works
ALSO REQUIRED
Softimage XSI (optional) particle-based simulation is complete, we will generate a mesh for Bren Entertainment, and is co-founder of Barna VFX
to export. Finally, we will import this mesh into a 3D software www.barnavfx.com

060 | 3D WORLD Christmas 2006

TDW85.t_realflow 060 24/10/06 16:29:10


Dynamic fluids | TUTORIALS

STAGE ONE | Setting up the simulation

drop

gravity force

splash crown

stillWater
container

The first thing to do when starting with a new Now that you have the environment set up, think Start by creating the emitters. Begin with a Sphere
01 package is set up the environment to suit your 02 about what other basic elements are needed to 03 emitter: select Edit > Add > Emitters > Sphere.
requirements. Start by changing a few basic create the simulation. A drop, a volume of still liquid, Rename it ‘drop’. Modify its Scale to 0.5, go to the
parameters. Go to the File menu and create a New Project. a container, and a gravity force should be enough to get Sphere tab and set ‘Fill sphere’ to Yes. Position the drop high
Call it dropSplash. Go to File > Preferences and set up your things moving. The final simulation may end up more complex in Y: around 9 units is appropriate.
Scenes Folder path, then configure ‘Axis setup’ for the 3D than this, but it’s best not to start from a complicated set-up,
package you are going to use later. since this may lead you in the wrong direction.

Create a Fill Object emitter in the same way and If you hit Simulate, you will see that nothing Although you can play cached simulations, it’s easier
04 rename it stillWater. Add a Cube to the scene (Edit > 05 happens. That’s because at this stage the scene 06 to export a series of images, then play them in real
Add > Objects > Cube) and rename it ‘container’. contains fluid emitters, but no external forces to time. To export screen captures of the simulation,
Make it 10 units long in every axis, then move it six units in Y. make them move or interact. It’s time to add some daemons. hit [F12] to go to Export Central and activate Preview. Rename
You need to connect the container to the water that fills it, so First, add a Gravity daemon (Edit > Add > Daemons > Gravity). it ‘stage_1’ so that you can compare the results to those of
go to the Fill Object tab and click the ‘-’ next to Object. Select Rename it ‘globalGravity’. future simulations. Set ‘Image formats’ to .jpg or .png. Set the
the container from the pop-up window. Set ‘fill Y ratio’ to 0.05. end frame in the timeline to 50 and run the simulation.

Open the captures from the ‘/preview’ folder of your Begin by getting rid of all the elements in the Global Sort things out by dragging elements into the
07 RealFlow project in an image viewer that enables 08 Links panel. Go to Edit > Add and uncheck Add to 09 Exclusive Links tab. First, move the drop itself.
you to view image sequences. Problems quickly Global Links. This ensures that new elements are Then parent under it everything that affects it:
become apparent. First of all, you can see that the stillWater not connected to anything else. Create four groups in the globalGravity, container, and stillWater. Now drag and drop
is not that still. Second, while there is a splash, it’s really Nodes panel: Emitters, Daemons, Objects and Meshes. Place the stillWater element and parent drop, globalGravity and
shallow, and dissipates too quickly. It isn’t a bad start, but we all the elements into these groups according to their type. container under it.

can refine the simulation to improve on it. Do this from now on whenever you create a new element.

Christmas 2006 3D WORLD | 061

TDW85.t_realflow 061 24/10/06 16:29:21


TUTORIALS | Dynamic fluids

STAGE ONE (Continued) | Setting up the simulation

EXPERT TIP i
Playing with time
Time shifting can make it easier to
fine-tune a simulation. If you want to
save some time while waiting for the
simulation to get to a crucial point that
is not working properly, you can
reduce the time steps in order to get
some ‘extra’ speed: click the arrow
next to the Simulate button, select
‘Options...’ and reduce the value of
‘Max substeps’. This can be handy
when relaxing fluids. Just remember
To avoid simulations going haywire, it is wise to add The impact of the drop on the stillWater surface isn’t
that by doing this, the accuracy of the
10 a k Volume daemon. This confines the simulation to
simulation will decrease: try to strike a 11 violent enough yet. To fix this, add a Gravity daemon
a particular area: if any particle strays outside the that only affects the drop while it is falling. It needs to
balance between speed and accuracy.
confines of this area, it is destroyed. Create a k Volume be Bounded and have a Strength of 100, as in the image above.
Wrong time steps can also lead to the
daemon and connect it under both emitters in the External Set it to be Inactive for now. Make the drop denser by setting
entire simulation becoming unstable.
Links tab. Under Node Params, select ‘Fit to object’ and the Scale of the sphere to 0.3. Change Int Pressure to 0.1 and
choose the container. Surface Tension to 20. Set Resolution to 10 and hit Reset.

You need to adjust a few settings to make the static Add a k Speed daemon. Connect it to both emitters. Now it’s time to create an Initial State for both
12 fluid a bit ‘tighter’ but also to make it react more 13 Set the Min and Max speeds to 0, and turn on ‘Limit 14 emitters. Go to the Initial State tab in each emitter
quickly to the impact. Set Density to 500 and Ext & Keep’. The velocities of any elements it affects and activate Use Initial State. You will also need to
Pressure to 0.1. This will help the water surface react more will now converge to 0. Reset and press the Lock button. Run activate ‘Reset to Initial State’ from the Reset button, so that
naturally when hit by the drop. Set Viscosity to about 30, to the simulation, keeping an eye on the Max and Min speeds of when you reset the simulation it will go back to the saved
glue everything together. Set ‘fill Y ratio’ to 0.02 and increase the emitters in the Statistics tab. Once the values get close to state when the fluids are relaxed. Reset the simulation to the
the Resolution to 2. This will give you a large number of 0, stop the simulation, and unlock and deactivate the daemon. Initial State and press the Simulate button. You should now
particles in a small area. Press Reset to update. Now active the Gravity01 daemon. see a better looking ‘splash crown’ ready for the next step.

EXPERT TIP i
Ghost the simulation
When using low-resolution simulations
that don’t take long to load from disk,
a good way of keeping track of
changes is to use Binary Loader 1
emitters to load the previous
simulation in the background. This
2
way, you can compare the results of
the new simulation with the previous
one to check that your refinements
are taking it in the right direction. Just
make sure that you don’t export the
It’s time to create the mesh. It would be possible to Go to frame 15, or any frame that might give the
new simulation while comparing the
two and ensure you are exporting it 15 generate a render from the particles that you have 16 mesh a nice shape. Right-click on stillWater_mesh in
been generating already, but RealFlow offers the the Nodes panel and select Build. Unless you have
with a different name, so you don’t
more useful possibility of creating a polygonal mesh only one emitter in the scene, nothing will be connected to
overwrite the one loaded in the
surrounding those particles, so that is what we are going to the mesh and therefore no mesh will be calculated. As you
binLoader emitter.
do next. Go to the mesh icon on the icons bar or select Edit > have two emitters in the scene, you need to tell RealFlow
Add > Mesh to create a new one. which ones are going to be part of the mesh calculation.

062 | 3D WORLD Christmas 2006

TDW85.t_realflow 062 24/10/06 16:29:31


Dynamic fluids | TUTORIALS

STAGE ONE (Continued) | Setting up the simulation

Right-click again on the stillWater_mesh node and This is to do with the particle count: in general, the Now try generating a new mesh from the stillWater
17 select ‘Insert fluids’. A pop-up window will appear 18 higher it is, the closer the mesh will be to the particle 19 fluid with Interpolation set to Global. Again, go to
with all the emitters in the scene. You could hit the simulation. If you’re using the full version of RealFlow, Export Central and rename the mesh, this time to
All button, but you don’t really need the drop emitter, as it you can increase the Resolution of the emitter without having stillWater_globalInt. Build the mesh again. For a detailed
has been mostly dissipated under the surface of the still to resimulate: select the stillWater fluid, set Interpolation to explanation on how Local and Global parameters work,
water. Instead, just select the stillWater fluid and Build the Local, and double the Resolution. Go to Export Central and left-click the Interpolation parameter in the Node Params
mesh again. This time, a mesh appears, but it’s very blobby. rename the mesh ‘stillWater_localInt’. Build the mesh again. panel and hit [F1] to get the contextual help.

stillWater particles
EXPERT TIP i
Things to keep in mind
If you export hi-res simulations or
stillWater Resolution = 1 meshes while testing, you will quickly
fill up your disk space. By default,
stillWater Resolution = 2 every time an element is created, it is
Interpolation = Global configured for export. To solve this,
uncheck everything in Export Central
stillWater Resolution = 2 before you run the simulations, and
Interpolation = Local only export when you really need to.
You can also turn off elements by
modifying the Simulation parameter
from Active to Inactive, or save time by
Open your 3D application and find the three meshes You need to refine the mesh generated by adjusting
using the Cache simulation state if the
20 you have generated. Load them one by one and
elements of the simulation don’t have 21 some of the settings under the Mesh node in Node
place them side by side so you can compare them in Params. Go to the Filters tab and set ‘Filter method’
to change. All three are options from a
shaded mode. You can immediately see that increasing the to Yes. Leave the default values for now. Right-click the Mesh
drop-down menu in the Simulation
resolution may be a good idea for certain types of node and select Build. The generated mesh looks smoother,
parameter on each node.
simulations, but that it probably won’t be the only thing you but it is still quite blobby.
have to do in order to get the result you want.

Select the stillWater fluid under the Meshes node Ultimately, an ‘acceptable’ result is a matter of The final touch while refining a mesh is to activate
22 and set ‘Blend factor’ to 80. This parameter helps to 23 personal taste. If you want extra detail, lower the 24 the Optimize tab. Open it and activate it by setting
add detail by separating particles if they are more ‘Polygon size’ to 0.01 in the Mesh tab. Build the Optimize to Curvature. This will help to reduce the
than a certain distance apart. You could also modify the mesh once again. A more detailed mesh is always welcome, number of polygons in the geometry, which will help when
Radius parameter – but be careful: if it’s decreased too much but bear in mind that since the meshes must be loaded from importing it in your 3D package. Build the mesh once more.
with Filter on, the mesh will almost disappear. Set the value disk at each frame, poly count may become an issue. Now that it is as good as it’s going to get, you can finally

to 0.03. Build the mesh again to see the detail it has gained. export the file!

Christmas 2006 3D WORLD | 063

TDW85.t_realflow 063 24/10/06 16:29:39


TUTORIALS | Dynamic fluids

STAGE ONE (Continued) | Setting up the simulation

EXPERT TIP i
Try Python
If you are an adventurous coder, you
may find that writing your own export
formats suits your needs better than
using the standard RealFlow ones.
This is where Python scripting comes
into its own. There is an in-depth
section in the User Guide that covers
most of the areas you will need to
explore, plus an official RealFlow
scripting site (www.nextlimit.com/
nlscript) and forum. Don’t be scared:
Open Export Central and check the stillWaterMesh To see how much space the files take up, and what
even if you don’t know anything about
25 box. (If you want to preserve any meshes you 26 kind of format you might need if you were exporting
programming, you can easily pick up
exported earlier, rename the node, but bear in mind a long simulation, open the \meshes folder in your
the essentials. Learning Python
that the files quickly eat up disk space.) Check ‘Mesh cache RealFlow project. It’s worth noting that .bin files have two
scripting will improve your workflow
(.bin)’ and ‘Mesh sequence (.obj)’ and close the tab. Go to the advantages over .obj files: first, they’re smaller in size, and
and make life easier.
frame that you want to render and build the mesh. This will second, if you need to use the mesh UVs, they’re preserved
be exported in RealFlow .bin format and also as an .obj file. by default.

STAGE TWO | Rendering the mesh

Your 3D app Your 3D app

Your 3D app

Open the mesh in your 3D package. In XSI, if you are


27 using the .obj file rather than RealFlow’s native .bin
file, all you need to do is to select File > Import > Obj
File. For details of how to import a .bin file, or for information
relating to the other 3D applications RealFlow supports,
check the Help documentation.

Even in the final render, you will notice that the as the lo-res one. The second option is to generate multiple
29 result is not as close to reality as it could be. low-resolution simulations and combine them together using
Inevitably, the full version of the software – which an NBinary Loader emitter to generate the mesh. This way,
would enable more particles to be used in the simulation – you can ensure that the original look remains when building
would produce a better result. Only high particle counts can the mesh. If you want to try it, the emitterMultisim.rfs script
generate the fine detail that tricks the eye into believing that (included in the supporting files for the tutorial, available
Apply XSI’s Water_Stuff Shader Preset to the mesh. what it is seeing is real. from the Stop Press section of www.3dworldmag.com) will
28 This is the easiest way to get a watery-looking If you are using the commercial version of the generate these multiple simulations.
result. Your software will probably have an software, there are two ways to increase the number of To get finer detail, you will have to be prepared to face
equivalent, but if not, you could try to find a preset online. particles used to calculate the mesh. The first option is long simulation times, so the more processing power you can
You can simplify the shading by using Phong materials and to increase the Resolution of the emitters before running muster, the better. It would also be a wise move to check the
playing around with incidence and transparency, while a good the simulation – although this will mean that the new recommended specifications for RealFlow 4 before you start,
Xx
HDRI environment map will help add detail to the render. simulation does not necessarily maintain the same look unless you want to risk simulations that go on forever... ●

064 | 3D WORLD Christmas 2006

TDW85.t_realflow 064 24/10/06 16:29:50

Das könnte Ihnen auch gefallen