Welcome back to our tutorials. While I’m working on more interesting, (we hope), educational stuffs for you, it’s time to start a new tutorial’s lineup. This week we’ll start understanding something about fluid dynamic in a mixed pipeline using Next Limit Realflow and Autodesk 3ds max. The tutorial can be accomplished with other 3D software and Realflow. This exercise will be not so complex but it will be a good point to start understanding fundamentals about fluids, dynamic, and special effects. So let’s start setting the 3ds max unit setup in centimeters.

Step 02
Create a Box primitive with Lenght = 25cm, Width = 25cm, Height = 15cm as in the figure,

Step 03
Now convert the box in an Editable Poly, select the upper face as in the figure and delete it, we’ll modify it to create a water container,

Step 04
Add a Shell modifier with the default parameters, now we have the 1st container,

Step 05
Make a copy of it, so we’ll have two containers as in the figure,

Step 06
Click on the Time Configuration icon, the panel will be opened and you’ll be able to set the time for the scene animation at PAL, and 501 total frames for the complete duration,

Step 07
Let’s start to create our test animation. We’d like to fill a container with some kind of fluid, and then use it to fill the other one, so go we need to have the “right” container still until we are at frame 40 as in the figure,

Step 08
Move it at frame 100 with the “Auto key” button active as in the figure,

Step 09
And the move it as in the figure at frame 200,

Step 10
Now rotate it as in the figure at frame 280,

Step 11
Now we are ready to export the animation in Realflow, (to do it you have to install it on your workstation, but the 3ds max Realflow plug-in also), before you start the export operation, please remove the Shell modifier from the animated container, because we need it with no volume to fill it in Realflow. Now click on the “SD File Export Settings”, so you can change the settings in the panel as in the figure, please set “Entire Scene”, Deformation = Autodetect, Active Time Segment, and set the file name as in the figure, it will create a scene file with .SD extension that will be readable in Realflow,

Step 12
Please run Reaflow 4. As soon as you launched RealFlow, please go in the menù File, then click on Preferences, and in the panel that will be opened, please set Axis setup = ZXY (3ds max, Maya). Go in the File menu, choose “Create a new project”, and choose the file name you want in the panel as in the figure,

Step 13
Now click on the “Add object” icon and choose “Import…” from the object list as in the figure, or click CTRL+I, when asked choose the .SD scene file saved before from 3ds max,

Step 14
As you can see you have the same scene we created in 3ds max, here inside Realflow, if you try to move the time slider, you’ll see the animation,

Step 15
The 1st thing we have to do,is to create the fluid inside the animated container, so please click on the “Add emitter” icon, and choose “Fill object”, it will fill a 3D mesh with fluids using various parameters,

Step 16
In the “Nodes” panel view, choose “Fill_Object01”, so all the emitter’ parameters will appear in the “Node Params” as in the figure, now click on the “Object” parameter inside che “Fill object” sub-panel, a little panel will appear as in the figure, choose the Box02, (the animated one), mesh,

Step 17
Now, in the “Particles” sub-panel, set Resolution = 0,01, (this parameter will controls the amount of particles used in the simulation, with higher value we’ll have more particles so a more stable and precise simulation, but it will be slower during the calculation), Max Particles = 150000, then in the “Fill Object” sub-panel set fil Z ratio = 0.6, it means we are filling the mesh by the Z axys at 60%, you can see the result in the figure,

Step 18
Now please click on the “Daemons” icon, and choose “Gravity”, so we’ll add a realistic gravity force, set as in the real world,

Step 19
Trying to make it faster for the test simulation, we’ll change the “Resolution” parameters at 0.004, so we’ll have less particles, but it will be faster to simulate and operate on,

Step 20
Now if you’d like to see what happens and if the scene is working, you can try to simulate the dynamic solution by pressing the “Simulate” button, as you can see in the figure the simulation seems very interesting at frame 157, if you want to stop the simulation you have to press the ESC key,

Step 21
Here you can see the simulation at frame 292, as you can see the fluid collides with the other container in a very realistic way,

Step 22
At the moment we have only the particle simulation, but in order to export and render the fluid mesh we have to create the 3D mesh starting from the simulated emitter, to do it you have to click on the “Add mesh” button, so you’ll see the “Mesh01” object in the Nodes panel, select it and you’ll see the mesh topology parameters in the Node Params panel as in the figure,

Step 23
Now click on the “persp” label on the Perspective viewport with the right mouse button, then select “Shading” and then “Smooth”,
Step 24
In the Mesh node params, set Polygon size = 0.3975, (this is the face size, with bigger size the mesh generation is faster but the precision is lower), then click with right mouse button over “Mesh01” object, and click on “Build” to generate the mesh at the selected frame, (we worked at frame 243),

Step 25
Now open the sub-object level of the Mesh01, and select “Fill_Object01”, in the Node Params, set Radius = 0.15, (this is the radius of the metaball applied at every single particle of the fluid, with lower value will have a more precise mesh but it will needs more particles),

Step 26
Go back at the Mesh01 parameters and set Polygon size = 0.15 to obtain a more precise mesh,

Step 27
Go back at the 1st frame as in the figure, and try to build the mesh to check it,

Step 28
Now move at frame 223, and set Filters method = Yes, in the “Filters” sub-panel, as in the figure, it will gives a more realistic appearance at the fluid mesh topology with a lower “ lobmesh” effect,

Step 29
Now we are very near to launch the final mesh generation, but we have to make it faster, so set Polygon size = 0.3 and click on the “Build mesh” button or press CTRL+SHIFT+M, it will generate the mesh for the entire simulated frames,
Step 30
Now you can go back in 3ds max, in our old scene, with the RF Mesh Loader, please load the .BIN generated mesh, to find these files you can use the export panel in RealFlow,using the menu Export—Export Central, the file usually are in the Document and settings folder inside a sub-folder, but you can reach it with no problems, as you can see in the figure, now we have the simulated fluid mesh inside 3ds max,

Step 31
Let’s start creating some basic shader to render it, in the Material Editor create a Arch&Design shader for mental ray, set it with the Ceramic Tiles preset, (remember to set Mental Ray as standard rendering engine), and apply it to the container not animated,

Step 32
Go in the Diffuse map and open the “Advanced controls” of the Tiles map, change the Texture color in a similar way as proposed in the figure,

Step 33
Now please create a new Arch&Design shader, set it as “Glossy plastic” preset, set the diffuse color as proposed in the figure, and set Glossy samples = 16, apply it to the animated container,

Step 34
Now add a Spot light source as in the figure, and set Shadows = On, with Ray traced shadows, leave all the other parameters set to default values,

Step 35
Add a Skylight and leave all the parameters as default,

Step 36
Select the imported fluid mesh, and add a Turbosmooth modifier to it to make it more precise, in the Material Editor create a Raytrace shader, change the diffuse color as in the figure, Specular Level = 130, Glossiness = 38, and apply it to the fluid mesh,

Step 37
In the rendering settings panel
activate the Final Gather with the Draft preset, and try to make a
test render, you should obtain something similar to the figure,

Step 38
Create a camera similar to the figure point of view and try to render it at various frame to check the animation,

Step 39
Trying to simulate a simple water shader, make a new Raytrace shader in the Material Editor, set Transparency = 90, Specular level = 70 and Glossiness = 50, Reflect = Fresnel, try to make a render, you should obtain something similar to the figure,

Step 40
Let’s try to simulate a different liquid shader, select the “water” shader and change the Specular color as in the figure, Specular level = 40, then in the “Extended Parameters” panl, activate “Fog” and set End = 5 and the fog color as in the figure, if you’ll try to render it, you should obtain something similar to the figure, a strange red fluid with color changing by density,

Step 41
An other test frame, now you are ready to render the entire simulation. This tutorial is only the beginning of our fluid dynamic series, in the next one we’ll discuss more complex features that can be found inside RealFlow, exploring bubbles, sea surfaces, foam, spray, gas etc etc.

(Usaged of source files requires Realflow)

















Hi! I Have problem with render active time segment. When i render single frame render is ok but when i use active time segment mesh stays. (boxes are moving). How to solve this? Thanks!
Hi,
it is really strange. Did you encountered this problem in every scene you try to render or just in this case ?
Regards,
Alessandro
How long do simulation times in real-flow approx take i’m running a quad core 2.8 and its taking ages…. about 20mins to get to frame 20 so far. Is this normal or am I missing something??
Hi, thank you for the great tutorial!…but I do have a problem, around step 22, after I put the gravity on and I start the simulation, around frame 74 you can see how the particles start flowing out of the animated box (like 0 gravity). Do I need to set the “Parent to” or the “Bounded” option? Thank you
Hi,
thanks for the comment. You have to set the “Bounded” option, but if you continue to have problems to it, you can contact me directly via mail at a.cangelosi@cgcookie.com
Alessandro
Hello
Im having a problem with the rendering of the mesh.
When i try too render a single frame the mesh (fluid) renders ok but when i try to render the entire segment the mesh doesnt get rendered, just the objects around it!
I would appreciate help as soon as possible!
Regards
Martin Daunfeld
Hi Martin,
I sent you a mail some days ago to understand better why you have this problem, please answer me if you can
Thanks
Alessandro
Hi,
I have the same problem as Martin and Shaom, and I see it posted on lots of forums – using Max and Mental ray, the Realflow mesh won’t update or change when I render a sequence. It’s fine with stills and the scanline renderer. any ideas?
thanks,
Ste
Hi,
I’ve not the problem. To try to understand something about it, we need to pick your scene and your simulated cache so we can open your project and investigate on it.
Please let me know
Thanks
Alessandro
Hi ste, Martin and Shaom
Try running 3dmax as administrator , this should solve the problem at least it did for me.
Great tut!
very easy to understand, however, the part where you have to hit the ‘fill the object’ button I encoutered some problem… I do not have that option? I hope you can help me
thanks in advance
Congratulation ! this is a well written tutorial.
I cant understand why a software that has this kind of pricetag has such bad tutorials and documentation. They should take a look at 3dmax’s documentation and tutorials.
Hi, Ive been going along just fine with the tutorial but when I get to the mesh stage it gets a tad hairy. My mesh seems to come out beyond the animated box like jelly! It wont stay inside either box. I am using realflow 5 and a standard particle mesh.
hi, thanks for the tutorial, it looks really cool!! im doing the 3d with maya, and in real flow when the box start to move the liquid doesnt stay in it and it fall down to the floor and beyond, i dont know what im doing wrong because it stays in the box until the animation start, whats up with that? please help!!
thnx
Hi and thanks for your comment. I think that there are some problems with the SD data exported in Realflow. In realflow you see the box moving ? The box in 3ds max has the Shell modifier applied on ?