How to do realistic physics simulation using Blender

If you don’t have experience, or are beginner you are in the right place to learn how to do realistic physics simulation on your computer.

Image for post
Image for post

1. Software

The first step to make a realistic physics simulation is choosen a software. There is a lot of good softwares. Here are some good ones:

Autodesk Fusion 360 - Good for engineering simulations;

Blender - Free 3D software that is possible to do realistic physics simulations, it is good using fluids, fire, explosion, smoke, rigid bodies, soft bodies, cloths and has many addons that allow you to do more things and even destruction;

Cantera - Chemistry (open source);

Celestia - Astronomy simulations (open source);

There is a lot of simulations Softwares with different usages. If you are looking for some one that doesn’t is in this list just search on Google and you will find a good one for you.

2. Blender Basics

The software that I choose is Blender, a very good one.

Image for post
Image for post
Blender interface

Viewpoint controll

Rotate (orbit)- Mouse wheel (middle button) and move the mouse

Zoom - Scroll. Or if you want a smooth zoom: Ctrl + scroll

Pan - Shift + Mouse wheel (middle button)

If you loose focus of the object simply select the object and press the ‘numpad .’

Scale object

To scale something in your scene, just click on it and press the ‘S’ key

If do you want to scale just one axis, pres the letter of the axis, for example, if you want to scale the object vertically, press ‘S’ and then ‘Z’

Move object

To move the object just press ‘G’, and use the same mechanics that scale uses to move on just one axis.

Add new object to the scene

To add a new object just press ‘Shift + a’, and the basic objects will be in the ‘Mesh’ section.

Image for post
Image for post

2D ortographic views of the scene

If you want 2D views of the scene to correct or sculpt better, here are someA views:

Numpad 1 - Front Ortographic

Numpad 3 - Right Ortographic

Numpad 7 - Top Ortographic

And here are where find these ortographic views

Image for post
Image for post
Image for post
Image for post

3. Simulation

Fluid Simulation

One of the most incredible simulations in Blender are the fluid simulation.

If you want more fascinating results try searching for the Flip Fluid Blender addon, but in this article I will make the simulation without addons.

Fitst, add a mesh to the scene to be the fluid domain.

Image for post
Image for post

Then scale it

Image for post
Image for post

Enable wireframe vision

Image for post
Image for post

Now go to the Physics Properties

Image for post
Image for post

Click on fluid and then change the type to domain

Image for post
Image for post

Change domain type to liquid

Image for post
Image for post

Now add a ‘UV Sphere’ to the scene, change the sphere position in axis ‘Z’ and upscale it a little

Image for post
Image for post

In Physics Properties in the sphere enable ‘Fluid’ and change type to ‘Flow’

Image for post
Image for post

Change ‘Flow Type’ to ‘Liquid’

Image for post
Image for post

If you click in resume in the timeline you will see the animation, but it is no the final version

Image for post
Image for post

Now back to the cube and go to cache in ‘Fluid’ in the ‘Physics Properties’ and change ‘Replay’ to ‘Modular

Image for post
Image for post

Now click in ‘Bake Data’

Image for post
Image for post

After done, now you can resume the animation and see the water as particles

Image for post
Image for post

Let’s add some obstacles to this simulation.

Add a cone and don’t change the cone position

Image for post
Image for post

In ‘Physic Properties’ in the cone enable ‘Fluid’, but in this time set the type to ‘Effector’

Image for post
Image for post

And now add more obstacles and do the same that you did with the cone

Image for post
Image for post

Now go to the cube domain and click in ‘Free Data’

Image for post
Image for post

Then click again in ‘Bake Data’

Image for post
Image for post

After making the Fluid Bake you can now resume the simulation and see the interaction of the fluid with the obstacles

Image for post
Image for post

Now change your ‘Resolution Division’ to 64

Image for post
Image for post

Change ‘Timesteps Minimum’ to at least 2

Image for post
Image for post

Enable ‘Difusion’

Image for post
Image for post

Choose what fluid do you prefer

Image for post
Image for post

Now enable ‘Mesh’

Image for post
Image for post

Enable ‘Use velocity vectors’ to blur the fluid during movement

Image for post
Image for post

Now change cache ‘Modular’ to ‘All’

Image for post
Image for post

And click in ‘Bake All’, but now the baking process will take more time

Image for post
Image for post

Let’s move to the last stage, the particles, but don’t forget to ‘Free’ in cache

Now, to make the fluid more realistic, go to the ‘Particles’ section and enable all 3 options available. If you want more details and more particles, change the ‘Upres Factor’ to 2

Image for post
Image for post

Now change the ‘Resolution Division’ to 128 (if you have a very good computer, you can change the ‘Resolution Division’ to 200 or 256, or even more, but 256 is already a good result)

I recommend you to create a folder for this project before Bake Alland save your project file inside this folder

Image for post
Image for post
Image for post
Image for post

After baking all, you can now back to the solid material view

Image for post
Image for post

Now right click in the domain and click in ‘Shade Smooth’

Image for post
Image for post

Now with the ‘cube’ domain selected go to ‘Material Properties’

Image for post
Image for post

If you don’t have a material create a new one

Image for post
Image for post

Now go to the ‘Shading’ tab

Image for post
Image for post

Delete the material that you created, but don’t delete the ‘Material Output’

Image for post
Image for post

Now ‘Shift + A’ and add a new shader, the ‘Gass BSDF’

Image for post
Image for post

Change the IOR to 1.333

Image for post
Image for post

And connect the ‘Glass BSDF’ BSDF to ‘Surface’ in ‘Material Output’

Image for post
Image for post

Now in ‘World’ inside ‘Surface’ click in color yellow circle and then choose ‘Enviroment Texture’

Image for post
Image for post

Now download an HDRI, depending on which HDRI you choose the color of the water will be different, I recommend downloading this in 4K, and if you have a slow computer download the 2K:

Create a folder inside your project called HDRIs and save the HDRI you downloaded inside this folder

Image for post
Image for post

Now open this HDRI image as your ‘Enviroment Texture’

Image for post
Image for post

Now you can back to ‘Layout’

Image for post
Image for post

Go to ‘Render Properties’

Image for post
Image for post

And change your ‘Render Engine’ to Cycles

Image for post
Image for post

I recommend you to change your decive to GPU

Image for post
Image for post

Now click on this button to see the preview of the render in real time

Image for post
Image for post
Image for post
Image for post

In ‘Film’ enable ‘Transparent’ and enable ‘Transparent Glass’

Image for post
Image for post

Now we’re going to render the particles, so back to solid view

Image for post
Image for post

‘Shif + Right Click’ to change the 3D cursor

Image for post
Image for post

Add an ico sphere

Image for post
Image for post

And click here to change some settings of the ico sphere

Image for post
Image for post

Change ‘Subdivisions’ to 1

Image for post
Image for post

Now go to ‘Shading’

Image for post
Image for post

Add a new material

Image for post
Image for post

Delete ‘Principled BSDF’

Image for post
Image for post

Using ‘Shift + a’ add Diffuse BSDF

Image for post
Image for post

Now add ‘Add Shader’

Image for post
Image for post

And add ‘Glass BSDF’, and change the IOR to 1.333

Image for post
Image for post

Now make this connection

Image for post
Image for post

Click on the ‘Glass BSDF’ color and decrease the value to 0.5

Image for post
Image for post

Then connect ‘Add Shader’ to ‘Material Output’

Image for post
Image for post

Now for the bubbles duplicate this ico sphere using ‘Shift + D’

Image for post
Image for post

Click on the ‘2’ to duplicate the material

Image for post
Image for post

Now delete ‘Diffuse BSDF’ and ‘Add Shader’

Image for post
Image for post

And connect ‘Glass BSDF’ to ‘Material Output’

Image for post
Image for post

Change the glass value color to 0.82, saturation ‘S’, to 0.108 and hue ‘H’ to 0.574

Image for post
Image for post

Now select the fluid (domain) and go to the ‘Particle Properties’ section

Image for post
Image for post

I recommend that you disable particle preview in the preview window so as not to slow down your computer

Image for post
Image for post

Render bubbles as a object

Image for post
Image for post

And select the ‘Instance Object’ to be the ‘Icosphere.001’

Image for post
Image for post

Now to remove the pattern of the particles go back to the ‘Layout’ tab

Image for post
Image for post

duplicate (Shift + d) your first icosphere and change the scale of the copy

Image for post
Image for post

Go to edit mode (press Tab) and move (press G) the particle a little bit to get out of the orange origin point

Image for post
Image for post

Go back to ‘Object Mode’ (press Tab again) and scale the particle a little on the ‘Z’ axis

Image for post
Image for post

Duplicate this particle and change a little on the ‘Z’ axis of the new

Image for post
Image for post

Select the 3 particles and press ‘Ctrl + g’ to create a new collection with the name ‘Splash’

Image for post
Image for post

Now select your fluid and in the properties of the particles click on ‘Spray’ and render as ‘Collection’ and change the ‘Instance Connection’ to Splash

Image for post
Image for post

And enable ‘Pick Random’

Image for post
Image for post

And do the same with the ‘Foam’ particles

Image for post
Image for post

Now, back to ‘Shading’ and select some of the icosphere from the ‘Splash’ collection’

Image for post
Image for post

Add a ‘Mix Shader’

Image for post
Image for post

Make this connection

Image for post
Image for post

Then add a ‘Transparent BSDF’ shader

Image for post
Image for post

Make this connection

Image for post
Image for post

And then add ‘Object Info’ from ‘Input’

Image for post
Image for post

Connect ‘Random’ to ‘Factor’

Image for post
Image for post

And done!

Image for post
Image for post

This will give the particles random opacity

Now back to ‘Layout’

Image for post
Image for post

And select the camera

Image for post
Image for post

Go to camera properties

Image for post
Image for post

Enable ‘Depth of Field’

Image for post
Image for post

In ‘Viewport Display’ select ‘Limits’, to see the camera focus

Image for post
Image for post

To adjust the camera position, press Numpad 0, and press N, then go to ‘View’ tab

Image for post
Image for post

And enable ‘Camera to View’

Image for post
Image for post

Now you can move the camera as your ‘Viewport’

Image for post
Image for post

After choosing a good angle, adjust the camera’s focus by moving this

Image for post
Image for post

Now go to ‘View Layer Properties’ and enable ‘Vector’ to enable fluid motion blur

Image for post
Image for post

Now enable the particles again, and if you see the particles a bit large, select your collection and size the icosphere collection

Image for post
Image for post

This is a good size for real water

Image for post
Image for post

Now render your simulation

Image for post
Image for post

Once you're done, go to the 'Composition' tab to make rendering better

Image for post
Image for post

Enable ‘Une Nodes’

Image for post
Image for post

Now add ‘Vector Blur’

Image for post
Image for post

Make this connection

Image for post
Image for post

Now click on 'Vector Blur' by pressing 'Ctrl + Shift', and this appears and you will see your background image

Image for post
Image for post

Change the blur to 0.10 and enable ‘Curved’

Image for post
Image for post

Now change the max speed to 256

Image for post
Image for post

Now if you go to ‘Rendering’ you can export this image

Image for post
Image for post

Switch to ‘Viewer Node’ if you want to render with motion blur

Image for post
Image for post

Now go to 'Image' and 'Save as ...' to save the image

Image for post
Image for post

If you have a ‘super’ computer you can render the animation

Image for post
Image for post

But use this setting, or a better one for better results

Image for post
Image for post

And that was my result!!

Image for post
Image for post

I think there was a lot of information just in this article, but now you can do a your super fluid simulation using Blender!! Thanks!

Studies: React Native, Python, JavaScript, Node JS, C#, SQL, React.Js, Bootstrap, php, Pytorch and Numpy

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store