Shattered Glass

One of the most famous RealFlow scenes is a shattering glass after being hit by a bullet. The idea behind this setup is very interesting, because it is a combination of fluids, rigid bodies, and slow motion effects. In this tutorial you will learn how to recreate this simulation with RealFlow's built-in tools. Please note that this simulation is split into two parts: in the first simulation a resting and calm fluid is created. Then, the interaction between the fluid and the smashing glass is done in a separate action.



The result of the workshop rendered with Maxwell Render.

 

Here is the nodes list for the first part – the relaxed fluid:

  • 1 glass object

  • 1 “Gravity” daemon

  • 1 “k Volume” daemon

  • 1 “k Speed” daemon

  • 1 “Drag Force” daemon

 

All scene elements can be added from RealFlow's shelves

  • Objects | Standard - Particles | Daemons

  • RealFlow nodes can be moved, scaled, and rotated with the WR, and E keys.

  • Imported objects from SD files have to be unlocked before they can be transformed with Selected object > Node Params > Node > SD ↔ Curve

  • Viewport perspective is changed with the 123, and 4 keys.

  • Shading modes are toggled with the 789, and 0 keys.

The Setup – Glass Filling

For this scene, the milk glass from the “Wetmap Creation” quick start tutorial is used. Please bear in mind that this tutorial is based on RealFlow's standard scale, and therefore the objects might appear rather big. The very first task is to fill the glass with milk:

  • Import the glass with the Ctrl/Cmd + I command. 
  • If you want to reposition the glass unlock it under Node Params > Node > SD ↔ Curve.
  • With the M key the object can be moved.




  • Add “Circle” emitter from the "Standard - Particles" shelf and place it inside the glass. It can be moved with the M key as well. If you have to rescale the emitter use the R key.
  • To get more particles, the emitter's “Resolution” value has to be increased under Node Params > Particles. The value depends on the size of the glass object and the scene's scale. For the fluid in the rendered image, a value of 30 has been used.
  • Other settings are: Int Pressure = 0.5, Viscosity = 4.0, Surface Tension = 10
  • Under “Circle”, set “V/H random” to 1.0 each.

 

 

A very important thing to check is the glass object's “Liquid - Particle Interaction” panel:

  • Change “Collision distance” to 0.01. This will bring the fluid particles closer to the object's surface.

 

Finally, some daemons are necessary:

  • Edit > Add > Daemons > Gravity | k Volume

  • k_Volume01 > Node Params > k Volume > Fit to object > select glass node

 

Now, the scene can be simulated:

 

 

  • Click on the small lock icon to left of the timeline. With this action, RealFlow neither counts frames (no matter how long you simulate, the timeline slider will remain at 0), nor writes out any files. This mode is perfectly suited to fill the glass.

  • Simulate.

 

If you think that the glass is properly filled (between one half and two thirds) stop the emission of particles:

 

 

  • Stop the simulation with another click on “Simulate”.

  • Highlight the “Circle01” and go to Node Params > Particles > Max Particles.

  • Also open the “Statistics” panel and look for “Existent Particles”.

  • Let's say the value there is around 110,000. Under “Max particles” you enter 125,000 (or any other value greater than 110,000), and resume the simulation.

  • The emission will stop automatically when the “Max Particles” limit has been reached.

  • Let the simulation run for a few more minutes.

Relaxing the Fluid

In the next step you create a calm fluid surface:

  • Unlock the simulation with another click on the lock icon.
  • If the emitter is not selected, click on it again.
  • Node Params > Initial State > Use Initial State > Yes
  • Make Initial State
  • Click on the small triangle next to the “Reset” button and enable “Reset To Initial State”.
  • Reset

 

 

For the relaxation process, two more nodes are required:

 

 

  • Add a “k Speed” daemon.

  • Node Params > k Speed > Limit & Keep > Yes

  • Max speed > 1.0 

  • Max speed > click on the grey circle

  • Shift the timeline slider to frame 200 (the fluid disappears).

  • Max speed > 0.01

  • Max speed > click on the red circle

  • Reset (the fluid reappears).

  • Add a “Drag Force” daemon.

  • Under Drag Force > Drag Strength create two keys with values of 0 (f = 0) and 75 (f = 200).

  • Simulate. At frame 200 the fluid should be calm and relaxed.

  • Create a new initial state for your final simulation as described above.

  • Reset.

The Setup – Glass Shattering

The “k Speed” and “Drag Force” daemons are no longer need and can be removed.

 

  • Click on the small triangle next to the “Simulate” button and open “Options...”.

  • Under General > FPS Output enter 72, 75, or 90 (according to your film/TV system).

 

 

  • Add a “Sphere” node – this object will serve as a bullet. In the viewport's “Front” mode (2 key) shift the bullet to the right.

  • Add a “Cube” node, position it beneath the glass, and rescale it. Make it big, because it is the ground object.

  • Add a “Cone” node and rescale/reposition/rotate it until you get a setup similar to the image below. The “Cone01”object should be aligned with the bullet, because it is the zone of impact.

Fragmenting the Glass

The bullet should hit the glass exactly where the cone is intersecting the glass. This is also the zone with the highest density of fragments:

 

 

  • Select the glass node.

  • Tools > Fracture Tool > Voronoi By Steering Geometry...

  • Rough number of pieces > 130 (or any other number)

  • Click on the “...” button and choose “Cone01”.

  • Lowest/highest concentration rate > 0.007

  • Transition length > 0.2

  • A new MultiBody with a “_fractured01” suffix appears.

  • If you are happy with the results “Cone01” and the original glass node can be deleted.

The last two parameters are used to control the transition from the impact zone to the outer areas of the glass. Both settings avoid that the glass will be broken into lots of very small, almost uniform, pieces. If you are not satisfied just delete the newly created object, and repeat the fracturing process with other values.

The Rigid Body Parameters

In this step, the dynamics properties will be activated and adjusted. Let's start with the fractured glass node:

  • Node > Dynamics > Active rigid body

  • Rigid body > @ object friction > 0.5

  • Rigid body > @ elasticity > 0.5

 

Then the ground object (“Cube01”):

  • Node > Dynamics > Passive rigid body

 

Finally, the bullet (“Sphere01”). This node will be animated, but has rigid body features as well:

  • Node > Position > X (the first value from the trio)

  • Create a key-framed animation from right to left (or left to right) using the method from “Relaxing the Fluid”. The bullet should be fast to get a vivid splash: 20 m in 70-80 frames is a good value.

  • Node > Dynamics > Passive rigid body

The combination of animation and rigid body properties is interesting, because the bullet's motion path and speed can be controlled, but it is able to interact with other rigid bodies. In this state, the bullet has infinite force.

Joining the Pieces

Currently, the fractured glass will fall apart and the fluid will pour out, because the pieces are not connected. There has to be a way to reconnect them, but these joints have to break when the bullet hits the glass. The solution is MultiJoints – all panels are located under the “MultiJoint01” element's “Node Params”:

  • Edit > Add > Objects > MultiJoint
  • Creation > Objects A > fractured glass node
  • Creation > Objects B > fractured glass node
  • Forces > Force max mode > Constant limit
  • Forces > @ Max force > 250000 (this is just a starting value - see below)
  • Collisions > Enable if break > Yes
  • Break > Break if distance exceeded > Yes
  • Creation > Create/Recreate

 

The “Forces” panel contains a “@ Max force” parameter and adjusting this value is the most difficult part. The joints have to be strong enough to resist the glass body's own weight and the weight of the fluid. Start with a rather high value, e.g. 250,000 and trigger the simulation. Let it run for around 5-10 frames:

 

 

  • If you can see orange or red joints then the forces are not strong enough and the links break. In this case you have to increase “@ Max force”.

  • Go to Statistics > @ Max force used since creation. This read-only field gives you a hint of the occurring forces, and can be used as a starting value.

  • Do not use the displayed value 1:1, but add a 10-20% buffer and transfer the value to “@ Max force”.

  • Reset and simulate again. If all joints are green and intact you can go on simulating. Otherwise you have to further increase “@ Max force”.

  • For the rendered image at the beginning of this tutorial, “@ Max force” has been set to 150,000 with a “@ Max force random” value of 100.

Simulation and Previews

It is very likely that you will have to create different versions until you get the desired result – and these versions have to be compared. The easiest way to do this is to use RealFlow's preview engine:

  • Adjust the point of view by rotating, zooming and panning the viewport.

  • You can add a camera, but this step is not mandatory.

  • Go to frame 0, and click on Playback > OpenGL.

  • RealFlow goes through the simulation and records the viewport frame by frame.

  • If the timeline slider stays at frame 0 please check if the maximum preview frame is not 0.

  • Once the frames have been recorded, a “Movie Player” window is opened automatically. After a few seconds you can watch the simulation in real-time.

  • Click on the player's “Save” icon, and write the movie to disk.