Sunday, December 23, 2012

Gradually 'freezing' particles

Sometimes I needed to gradually decrease the SPH-based particles velocity until they're completely stopped. A bounded Drag daemon is an effective way to apply a 'braking' force to your particles, but if you want to apply such forces in a smooth & progressive way, you may find interesting the following script that I made as an Event script. 

See a sample video here:

So, let's do it. First of all, press Ctrl + F2 to open up Simulation Events window and right clic over Frames Post.

In the pop up window add the following code (replacing the "Circle01" string with your emitter's name): Download
  • increment is the reduction factor of the velocity. Higher values means less reduction, for instance 0.99 will barely reduce the velocity frame by frame all along the timeline, while 0.10 will drasticly reduce the velocity of your particles in a short time.
  • threshold stands for the minimum velocity of the particle prior to get completely frozen.
  • minlife is the minimum life (in seconds) of the particle prior to apply the braking force.
Once your values are set up you just need to clic OK and Simulate.

You'll have noticed that the particles are frozen by setting up their velocity to 0,0,0 (what is described in the script as 'zero_velocity'). Once these particles are completely stopped they can still react and move if other particles collide with them. However you may want that once the particles are stopped in a first term, they keep completely frozen even though other particles / forces collide with them. In that case you just need to uncomment the particle.freeze() line by removing the ## symbols and add them to the previous line in order to comment the 'set velocity to zero_velocity' instruction.

IMPORTANT: Make sure your tabbing is OK if you copy/paste code. Your leading indents should appear pretty much like these ones (click on the image to enlarge):

Friday, February 10, 2012

RealFlow 2012. Breaking a glass

Not an usual straighforwad step-by-step tutorial, but a wider review about how to deal with dynamics inside RealFlow, even integrated with fluids when they're cached, and how to work with animation curves, joints, collisions and how to inherit the motion, speed of one object to another as well.

I hope you enjoy this one, find the simulation video right here.

Saturday, January 14, 2012

Maxwell camera quick set up in Maya

Depending on specific needs or different scenarios, there are different ways to rig a Camera if we want to automatically upgrade the Focus everytime we move the camera, the target or both of them. Find in this video a quick way to connect your Maxwell Camera focus to the Mx Use Manual Focus value in Maya. Easy breezy.

Feel free to explore different riggings matching your needs, every single scene is a challenge.

Monday, November 7, 2011

Getting the most out of RealFlow Nodes

We made this video series with some training stuff focused on RealFlow Nodes. We also provide some specific tidbits about Hybrido, IDOCS, exclusive links, and feature Maxwell Render's Multilight feature. We hope you enjoy it and get familiar with these powerful tools!

I want to thank Jorge Medina and Luis Mora for their help and support, and permission to feature their respective blogs/resources. Thank you, guys!

Tuesday, March 22, 2011

MEL Script for export .mxs sequences with RF meshes involved

Using Maya, sometimes you can experience issues when try to export a .mxs sequence with any sort of RealFlow meshes embedded. Looks like there's not a fix for that in the short term as there are some problems in the Maya side that scramble the code of specific plugins creating unexpected errors (you may experience this when both RealFlow and Maxwell Render plugins are set to Autoload in the Plugin Manager) and get some odd obscure results in your renders.

If you try to export a .mxs sequence and get just a .ma file instead your .mxs files, you can usethis simple script (thanks to Next Limit's Angel Tena) to automatically enforce Maya do the job via MEL.

Note in this code we´re setting a range of 100 frames (from 1 to 100) with a framepadding = 4 and a path output as: C:/Users/Username/mxs/. Don't forget to customize your own scene length, framepadding and file path for export the .mxs files:

for ($i=1;$i<=100;$i++)
currentTime $i;
int $padding = 4;
string $frameString = $i;
string $filePath = "C:\\Users\\Username\\mxs\\frame_";
for($j = size($frameString); $j < $padding; $j++)
$frameString= ("0" + $frameString);
$filePath += $frameString;
print $filePath;
print "\n";
file -force -options
"useActiveCam=1;animation=0;protection=0;packngo=0;" -type
"MaxwellScene" -pr -ea $filePath;

You also can download the script here.

Sunday, February 21, 2010

Realflow in an unusual workflow: Live TV

This project was leaded by the Next Limit team in cooperation with the Spanish Academy Film Industry: 'Academia de las Artes y las Ciencias Cinematográficas de España'. I took part in the whole simulation, meshing and render, basically.

The idea was to make a surprising flood during the Spanish Film Academy Awards 'Los Goya' with Andreu Buenafuente on the stage, a very popular and funny showman in Spain. The true challenge in this case was not -only- the final quality of the result (of course, that´s the most important thing...), but the aditional motivation in this case was to do the final renders even before recording the plate. We had a relative idea about how was the main shapes of the stage, so we had to render the final flood before the real stage was built (48 hours before the show). We recorded Buenafuente the day before, and we had a large -but not enough- night for compositing and saving the final result.

So, in this case the trully 'beautiness' of the water is not the water itself... but the fact of being present in a live action show.

...And here´s the final result (from 00:50 to 01:00):

Thursday, October 1, 2009

How to... speed up your RF simulations


Handling a complex scene in a few seconds per frame, using the command line

Many factors are decisive when you try to improve the performance of a Realflow simulation. Small simulations can be processed in a few minutes but large scale simulations (like massive fluids, natural disasters, seas, etc) may take many hours, and even days, although we´re using high end workstations. Of course, depending on the complexity of the scene, with special attention to the collision objects (never use final geometry, be sure to use simplified low-poly proxies), and resolution of the fluids, and many other parametres like viscosity or surface tension may affect seriously the time of the whole process.

One of the most important factors is the 'MAX Substeps' parameter: to decrease the 'MAX Substeps' can help us to make really faster simulations. By default, the 'MAX Substeps' is set to 333, however we rarely will need this level of accuracy, so we can reduce this value drasticly. Usual and simple simulations (pouring fluids on a vase, waterdrops, etc) may demand some values between 80 and 60, or even less in many cases. You can test your own values, but remember that extremely low values may affect and distort your fluid behavior, and your scene will become unstable: our aim is to seek a value in an equilibrium point between stability and and fast-performance. To change the 'MAX Substeps' value, simply go at the bottom-right corner and access the down arrow (sub-menu) located at the Simulate button > Options:

Now you can change the 'MAX Substeps' to the desired value:

Bear in mind you also can change this value in File > Prefrences > Simulation.

While we´re running a simulation, we can press Alt D to disable the viewer. Realflow keeps calculating the simulation, even though we can not seet it. To bring back the image on the preview, we just simply press Alt D, again.

Disabled viewer

Using the command line is the fastest way to calculate simulations in Realflow, by far. This method allows the computer to manage strictly the calculation process without launching the graphic user interface (GUI), calculate previews, etc. Definately is the best way to run complex simulations. The workflow is to launch the GUI program as usual to prepare the scene, set the fluids and objects parametres, daemons, contrtaints if needed, etc. and finally save the scene (*.flw file) we will use later. Once the scene is saved and Ralflow closed, this is the way to launch your command line simulation, following these easy steps:


1.º Go to Windows logo at the bottom-left corner (Start in XP), and type cmd in the search field. ('Run' option, in Windows XP). A command prompt window will pop up:

2.º Go to the folder where realflow.exe is installed; for instance, introduce (in my case):

cd\Program files (x86)\Next Limit\x64\realflow4\

...or drag and drop the folder directly on to the prompt window (in Windows XP). Something similar to this must appear:

3.º Now type the following command (where the # symbol is the number of available threads in you computer and the .flw is the path to the .flw file you recently saved):

realflow -nogui -threads # c:\your_path\test01.flw

in my case is c:\Users\Victor\Documents\RealFlow\test01\test01.flw

Then we hit enter, and the simulation will start immediately on command line mode: all active nodes will be calculated. Please note in this example we´re calculating all the process and active nodes in the scene, but there are many flags to calculate determinate actions, for instance: only build meshes, only a range of frames, etc. You the command list in the Realflow Help > Contents > RF4 > Command Line > Win, Linux, Mac...


1.º Open a Terminal shell. Terminal is located under /Applications/Utilities/ folder.

2.º With active terminal, press Command key while clic over the Realflow application in the Dock, then Mac OS will expand a new window with the located Realflow Package. We simply navigate into the Realflow Package and locate the file: Contents/Mac Os/realflow. We select the file 'realflow' and drag and drop it on to the Terminal shell, and then we add the desired flags, for example: -nogui (to run the application without user interface), -threads # (where # is the numer of maximum threads in our machine), -mesh, -frames, etc.
Clic on the image above to enlarge

3.º Then, we finally locate the .flw file to simulate and drag and drop it to the Terminal shell, so we´ll have something like this:

/[path_to_rf_application_folder/Contents/MacOs]/realflow -nogui -threads # [path_to_flw_file_folder]/name_of_file.flw

Remember: # is the number of available threads in our computer. In my case the whole command is:

/Applications/ -nogui -threads 4 /Users/Victor/Documents/RF/test01/test01.flw

Then hit enter, and enjoy!. As mentioned before, at the end of Windows section, bear in mind we have a lot of different commands to simulate determinate actions (meshes, frames ranges, etc).

P.D.: Thanks to Next Limit Team for his patience, help and support.