Realflow Splash

5
ome time has passed since Next Limit released RealFlow 3. Now a new version of this multi-platform fluid and dynamics simulator, used on Ice Age 2: The Meltdown and Poseidon, has arrived – and it comes loaded with cool features. A revamped interface, integrated Python scripting and a massive improvement in stability are just a few of the many good things in this new version. These features make RealFlow 4 the ideal solution for studios faced with the complex task of simulating liquids. In this tutorial, we are going to use the exclusive Special Edition of RealFlow 4 on the CD to recreate a high-speed photograph of a water droplet falling into a larger body of water, controlling the simulation – within limits – to generate a classic crown-shaped splash. We will start by exploring the basics of fluid simulation, then refining the parameters that control the effect that we want to achieve. Once the initial particle-based simulation is complete, we will generate a mesh to export. Finally, we will import this mesh into a 3D software package and render it to achieve a water-like appearance. We’re 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 50,000, limiting the fine detail that can be achieved, so we will also provide some tips for refining the simulation in the full commercial edition of the software: to upgrade and claim a special 3D World reader discount, turn to page 65. Full supporting files for the tutorial are available for download from our website, www.3dworldmag.com. To find them, click the Stop Press link from the left-hand menu of the homepage. Further tutorials can be found on the CD itself, and in the user guide that comes with the software. Consult these if you get stuck at any point in the walkthrough. Gustavo Sánchez Pérez is a Spanish VFX artist. Formerly employed at the Moving Picture Company, he now works for Bren Entertainment, and is co-founder of Barna VFX www.barnavfx.com S Make a splash Who needs high-speed macro photography when you’ve got RealFlow? Discover how to use the Special Edition of this powerful fluid simulator on the CD to capture the microscopic world shown above BY GUSTAVO SÁNCHEZ PÉREZ REALFLOW REALFLOW ON THE CD RealFlow 4 Special Edition (exclusive to 3D World) SEE PAGE 66 ON THE WEB Full supporting files for this article www.3dworldmag.com 060 | 3D WORLD 3D WORLD Christmas 2006 TUTORIALS | Dynamic fluids FACTFILE FOR RealFlow 4 DIFFICULTY Elementary / Intermediate TIME TAKEN 45 minutes ON THE WEBSITE Full-size screenshots RealFlow scene files • Final OBJ file • Bonus RealFlow script Final XSI scene file ON THE CD RealFlow 4 SE ALSO REQUIRED Softimage XSI (optional) TDW85.t_realflow 060 TDW85.t_realflow 060 24/10/06 16:29:10 24/10/06 16:29:10

Transcript of Realflow Splash

Page 1: Realflow Splash

ome time has passed since Next Limit

released RealFlow 3. Now a new version of

this multi-platform fl uid and dynamics

simulator, used on Ice Age 2: The Meltdown

and Poseidon, has arrived – and it comes loaded with cool

features. A revamped interface, integrated Python

scripting and a massive improvement in stability are just

a few of the many good things in this new version. These

features make RealFlow 4 the ideal solution for studios

faced with the complex task of simulating liquids.

In this tutorial, we are going to use the exclusive Special

Edition of RealFlow 4 on the CD to recreate a high-speed

photograph of a water droplet falling into a larger body of

water, controlling the simulation – within limits – to generate a

classic crown-shaped splash. We will start by exploring the

basics of fl uid simulation, then refi ning the parameters that

control the effect that we want to achieve. Once the initial

particle-based simulation is complete, we will generate a mesh

to export. Finally, we will import this mesh into a 3D software

package and render it to achieve a water-like appearance. We’re

using XSI, but the .obj fi le is included in the supporting fi les, so

you could render it in any application you prefer.

The Special Edition has a maximum particle count of

50,000, limiting the fi ne detail that can be achieved, so we will

also provide some tips for refi ning the simulation in the full

commercial edition of the software: to upgrade and claim a

special 3D World reader discount, turn to page 65.

Full supporting fi les for the tutorial are available for

download from our website, www.3dworldmag.com. To fi nd

them, click the Stop Press link from the left-hand menu of the

homepage. Further tutorials can be found on the CD itself, and

in the user guide that comes with the software. Consult these

if you get stuck at any point in the walkthrough.

Gustavo Sánchez Pérez is a Spanish VFX artist. Formerly

employed at the Moving Picture Company, he now works

for Bren Entertainment, and is co-founder of Barna VFX

www.barnavfx.com

S

Make a splashWho needs high-speed macro photography when you’ve got RealFlow? Discover how to use the Special Edition of this powerful fl uid simulator on the CD to capture the microscopic world shown above BY GUSTAVO SÁNCHEZ PÉREZ

REALFLOW REALFLOW ON THE CD● RealFlow 4 Special Edition (exclusive to 3D World)SEE PAGE 66

ON THE WEB● Full supporting

fi les for this articlewww.3dworldmag.com

060 | 3D WORLD3D WORLD Christmas 2006

TUTORIALS | Dynamic fl uids

FACTFILE

FORRealFlow 4

DIFFICULTYElementary / Intermediate

TIME TAKEN45 minutes

ON THE WEBSITE• Full-size screenshots• RealFlow scene fi les• Final OBJ fi le• Bonus RealFlow script• Final XSI scene fi le

ON THE CDRealFlow 4 SE

ALSO REQUIREDSoftimage XSI (optional)

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

Page 2: Realflow Splash

STAGE ONE | Setting up the simulation

The fi rst thing to do when starting with a new package is set up the environment to suit your requirements. Start by changing a few basic

parameters. Go to the File menu and create a New Project. Call it dropSplash. Go to File > Preferences and set up your Scenes Folder path, then confi gure ‘Axis setup’ for the 3D package you are going to use later.

01Now that you have the environment set up, think about what other basic elements are needed to create the simulation. A drop, a volume of still liquid,

a container, and a gravity force should be enough to get things moving. The fi nal simulation may end up more complex than this, but it’s best not to start from a complicated set-up, since this may lead you in the wrong direction.

02

Although you can play cached simulations, it’s easier to export a series of images, then play them in real time. To export screen captures of the simulation,

hit [F12] to go to Export Central and activate Preview. Rename it ‘stage_1’ so that you can compare the results to those of future simulations. Set ‘Image formats’ to .jpg or .png. Set the end frame in the timeline to 50 and run the simulation.

06

Begin by getting rid of all the elements in the Global Links panel. Go to Edit > Add and uncheck Add to Global Links. This ensures that new elements are

not connected to anything else. Create four groups in the Nodes panel: Emitters, Daemons, Objects and Meshes. Place all the elements into these groups according to their type. Do this from now on whenever you create a new element.

08

Create a Fill Object emitter in the same way and rename it stillWater. Add a Cube to the scene (Edit > Add > Objects > Cube) and rename it ‘container’.

Make it 10 units long in every axis, then move it six units in Y. You need to connect the container to the water that fi lls it, so go to the Fill Object tab and click the ‘-’ next to Object. Select the container from the pop-up window. Set ‘fi ll Y ratio’ to 0.05.

04If you hit Simulate, you will see that nothing happens. That’s because at this stage the scene contains fl uid emitters, but no external forces to

make them move or interact. It’s time to add some daemons. First, add a Gravity daemon (Edit > Add > Daemons > Gravity). Rename it ‘globalGravity’.

05

Start by creating the emitters. Begin with a Sphere emitter: select Edit > Add > Emitters > Sphere. Rename it ‘drop’. Modify its Scale to 0.5, go to the

Sphere tab and set ‘Fill sphere’ to Yes. Position the drop high in Y: around 9 units is appropriate.

03

Open the captures from the ‘/preview’ folder of your RealFlow project in an image viewer that enables you to view image sequences. Problems quickly

become apparent. First of all, you can see that the stillWater is not that still. Second, while there is a splash, it’s really shallow, and dissipates too quickly. It isn’t a bad start, but we can refi ne the simulation to improve on it.

07Sort things out by dragging elements into the Exclusive Links tab. First, move the drop itself. Then parent under it everything that affects it:

globalGravity, container, and stillWater. Now drag and drop the stillWater element and parent drop, globalGravity and container under it.

09

drop

gravity force

stillWater

container

splash crown

Christmas 2006 3D WORLD 3D WORLD | 061

Dynamic fl uids | TUTORIALS

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

Page 3: Realflow Splash

It’s time to create the mesh. It would be possible to generate a render from the particles that you have been generating already, but RealFlow offers the

more useful possibility of creating a polygonal mesh surrounding those particles, so that is what we are going to do next. Go to the mesh icon on the icons bar or select Edit > Add > Mesh to create a new one.

15Go to frame 15, or any frame that might give the mesh a nice shape. Right-click on stillWater_mesh in the Nodes panel and select Build. Unless you have

only one emitter in the scene, nothing will be connected to the mesh and therefore no mesh will be calculated. As you have two emitters in the scene, you need to tell RealFlow which ones are going to be part of the mesh calculation.

16

To avoid simulations going haywire, it is wise to add a k Volume daemon. This confi nes the simulation to a particular area: if any particle strays outside the

confi nes of this area, it is destroyed. Create a k Volume daemon and connect it under both emitters in the External Links tab. Under Node Params, select ‘Fit to object’ and choose the container.

EXPERT TIPPlaying with timeTime shifting can make it easier to fi ne-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 fl uids. Just remember that by doing this, the accuracy of the simulation will decrease: try to strike a balance between speed and accuracy. Wrong time steps can also lead to the entire simulation becoming unstable.

i

The impact of the drop on the stillWater surface isn’t violent enough yet. To fi x this, add a Gravity daemon that only affects the drop while it is falling. It needs to

be Bounded and have a Strength of 100, as in the image above. Set it to be Inactive for now. Make the drop denser by setting the Scale of the sphere to 0.3. Change Int Pressure to 0.1 and Surface Tension to 20. Set Resolution to 10 and hit Reset.

11

Add a k Speed daemon. Connect it to both emitters. Set the Min and Max speeds to 0, and turn on ‘Limit & Keep’. The velocities of any elements it affects

will now converge to 0. Reset and press the Lock button. Run the simulation, keeping an eye on the Max and Min speeds of the emitters in the Statistics tab. Once the values get close to 0, stop the simulation, and unlock and deactivate the daemon. Now active the Gravity01 daemon.

13Now it’s time to create an Initial State for both emitters. Go to the Initial State tab in each emitter and activate Use Initial State. You will also need to

activate ‘Reset to Initial State’ from the Reset button, so that when you reset the simulation it will go back to the saved state when the fl uids are relaxed. Reset the simulation to the Initial State and press the Simulate button. You should now see a better looking ‘splash crown’ ready for the next step.

14You need to adjust a few settings to make the static fl uid a bit ‘tighter’ but also to make it react more quickly to the impact. Set Density to 500 and Ext

Pressure to 0.1. This will help the water surface react more naturally when hit by the drop. Set Viscosity to about 30, to glue everything together. Set ‘fi ll Y ratio’ to 0.02 and increase the Resolution to 2. This will give you a large number of particles in a small area. Press Reset to update.

12

STAGE ONE (Continued) | Setting up the simulation

EXPERT TIPGhost the simulationWhen 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 emitters to load the previous simulation in the background. This way, you can compare the results of the new simulation with the previous one to check that your refi nements are taking it in the right direction. Just make sure that you don’t export the new simulation while comparing the two and ensure you are exporting it with a different name, so you don’t overwrite the one loaded in the binLoader emitter.

i

1

2

10

062 | 3D WORLD3D WORLD Christmas 2006

TUTORIALS | Dynamic fl uids

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

Page 4: Realflow Splash

STAGE ONE (Continued) | Setting up the simulation

Right-click again on the stillWater_mesh node and select ‘Insert fl uids’. A pop-up window will appear with all the emitters in the scene. You could hit the

All button, but you don’t really need the drop emitter, as it has been mostly dissipated under the surface of the still water. Instead, just select the stillWater fl uid and Build the mesh again. This time, a mesh appears, but it’s very blobby.

17

Select the stillWater fl uid under the Meshes node and set ‘Blend factor’ to 80. This parameter helps to add detail by separating particles if they are more

than a certain distance apart. You could also modify the Radius parameter – but be careful: if it’s decreased too much with Filter on, the mesh will almost disappear. Set the value to 0.03. Build the mesh again to see the detail it has gained.

22Ultimately, an ‘acceptable’ result is a matter of personal taste. If you want extra detail, lower the ‘Polygon size’ to 0.01 in the Mesh tab. Build the

mesh once again. A more detailed mesh is always welcome, but bear in mind that since the meshes must be loaded from disk at each frame, poly count may become an issue.

23

This is to do with the particle count: in general, the higher it is, the closer the mesh will be to the particle simulation. If you’re using the full version of RealFlow,

you can increase the Resolution of the emitter without having to resimulate: select the stillWater fl uid, set Interpolation to Local, and double the Resolution. Go to Export Central and rename the mesh ‘stillWater_localInt’. Build the mesh again.

18

You need to refi ne the mesh generated by adjusting some of the settings under the Mesh node in Node Params. Go to the Filters tab and set ‘Filter method’

to Yes. Leave the default values for now. Right-click the Mesh node and select Build. The generated mesh looks smoother, but it is still quite blobby.

21Open your 3D application and fi nd the three meshes you have generated. Load them one by one and place them side by side so you can compare them in

shaded mode. You can immediately see that increasing the resolution may be a good idea for certain types of simulations, but that it probably won’t be the only thing you have to do in order to get the result you want.

20

Now try generating a new mesh from the stillWater fl uid with Interpolation set to Global. Again, go to Export Central and rename the mesh, this time to

stillWater_globalInt. Build the mesh again. For a detailed explanation on how Local and Global parameters work, left-click the Interpolation parameter in the Node Params panel and hit [F1] to get the contextual help.

19

EXPERT TIPThings to keep in mindIf you export hi-res simulations or meshes while testing, you will quickly fi ll up your disk space. By default, every time an element is created, it is confi gured for export. To solve this, uncheck everything in Export Central before you run the simulations, and 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 using the Cache simulation state if the elements of the simulation don’t have to change. All three are options from a drop-down menu in the Simulation parameter on each node.

i

The fi nal touch while refi ning a mesh is to activate the Optimize tab. Open it and activate it by setting Optimize to Curvature. This will help to reduce the

number of polygons in the geometry, which will help when importing it in your 3D package. Build the mesh once more. Now that it is as good as it’s going to get, you can fi nally export the fi le!

24

stillWater particles

stillWater Resolution = 1

stillWater Resolution = 2Interpolation = Local

stillWater Resolution = 2Interpolation = Global

Christmas 2006 3D WORLD 3D WORLD | 063

Dynamic fl uids | TUTORIALS

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

Page 5: Realflow Splash

Even in the fi nal render, you will notice that the result is not as close to reality as it could be. Inevitably, the full version of the software – which

would enable more particles to be used in the simulation – would produce a better result. Only high particle counts can generate the fi ne detail that tricks the eye into believing that what it is seeing is real.

If you are using the commercial version of the software, there are two ways to increase the number of particles used to calculate the mesh. The fi rst option is to increase the Resolution of the emitters before running the simulation – although this will mean that the new simulation does not necessarily maintain the same look

as the lo-res one. The second option is to generate multiple low-resolution simulations and combine them together using an NBinary Loader emitter to generate the mesh. This way, you can ensure that the original look remains when building the mesh. If you want to try it, the emitterMultisim.rfs script (included in the supporting fi les for the tutorial, available from the Stop Press section of www.3dworldmag.com) will generate these multiple simulations.

To get fi ner detail, you will have to be prepared to face long simulation times, so the more processing power you can muster, the better. It would also be a wise move to check the recommended specifi cations for RealFlow 4 before you start, unless you want to risk simulations that go on forever... ●

STAGE ONE (Continued) | Setting up the simulation

To see how much space the fi les take up, and what kind of format you might need if you were exporting a long simulation, open the \meshes folder in your

RealFlow project. It’s worth noting that .bin fi les have two advantages over .obj fi les: fi rst, they’re smaller in size, and second, if you need to use the mesh UVs, they’re preserved by default.

26Open Export Central and check the stillWaterMesh box. (If you want to preserve any meshes you exported earlier, rename the node, but bear in mind

that the fi les quickly eat up disk space.) Check ‘Mesh cache (.bin)’ and ‘Mesh sequence (.obj)’ and close the tab. Go to the frame that you want to render and build the mesh. This will be exported in RealFlow .bin format and also as an .obj fi le.

25

Apply XSI’s Water_Stuff Shader Preset to the mesh. This is the easiest way to get a watery-looking result. Your software will probably have an

equivalent, but if not, you could try to fi nd a preset online. You can simplify the shading by using Phong materials and playing around with incidence and transparency, while a good HDRI environment map will help add detail to the render.

28

STAGE TWO | Rendering the mesh

29

Open the mesh in your 3D package. In XSI, if you are using the .obj fi le rather than RealFlow’s native .bin fi le, all you need to do is to select File > Import > Obj

File. For details of how to import a .bin fi le, or for information relating to the other 3D applications RealFlow supports, check the Help documentation.

27

EXPERT TIPTry PythonIf you are an adventurous coder, you may fi nd 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 offi cial RealFlow scripting site (www.nextlimit.com/nlscript) and forum. Don’t be scared: even if you don’t know anything about programming, you can easily pick up the essentials. Learning Python scripting will improve your workfl ow and make life easier.

i

Your 3D app Your 3D app

Your 3D app

064 | 3D WORLD3D WORLD Christmas 2006

Xx

TUTORIALS | Dynamic fl uids

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