Monday 26 May 2014

Blender 2.6 - Smoke and Fire Tutorial

For those that haven’t used Blender before it’s a fantastic free animation/digital art program. It also has a legendarily bad user interface and steep learning curve before you can get anything nice out of it. However once you’re stepped through the complexity a little, the flexibility of the program and the ability to program directly into it using the Python programming language will allow you to create really wonderful art! Like this: www.bigbuckbunny.org

We’re not going to delve into Blender much today – but I just want to show you some basics and how to use some of the simulation functions for smoke and fluids like water. These are amongst Blender more complicated but more impressive features so if you feel lost don’t worry unduly about it – you don’t have to understand anything now, but by following the instructions you should be able to get some nice looking smoke and fire by the end of the session.

Step #1: Basic intro to Blender


Open up Blender, then click anywhere to get past the intro image.

Now you’re in the main Blender 3D Viewport.

Before you move around too much – lets just introduce you to the names of a few things that are already visible – from left to right :

·      The transparent pyramid with a black triangle above it is your camera
·      The grey box with orange edges in front of you is the default cube
·      The black dot with dotted lines around it is a lamp.

The camera works like a usual camera – that’s where images are captured from, and the lamp does what a lamp normally does: provides light to the scene.

Now have a play with some basic commands:

·      To select the lamp, camera or cube – right click it and an orange box will appear around it
·      To move your point of view – hold down the mouse wheel and move the mouse
·      To see what the camera sees – push ‘0’ on the numpad (i.e. not ‘0’ along the top row of numbers)
·      To ‘render’ a view of the full scene push F12 (or select Render -> Render Image from the top menu).

Step #2: Simulations


Blender has the ability to simulate a LOT of things, liquids, particles, smoke and many more – but we’re just going to show you one of those today. If you’re interested it’s pretty simple to move from our smoke simulation to any of the others by using online tutorials (http://www.blenderguru.com/videos/introduction-to-the-fluid-simulator/) or the blender documentation (http://wiki.blender.org/index.php/Doc:2.6/Manual/Physics/).

The most important things to remember are: focus on one small objective at a time, save frequently and check your scene regularly (F12)! It’s FAR easier to correct a mistake you’ve just made then trying to remember what you did 20 minutes ago and undo it! [Yes I’m speaking from experience here]

So lets go ahead and save our .blend files, and hit F12 (if you haven’t already) to get an idea of what your scene looks like.

Simulations are a mix of science, programming and art. They can also be quite complicated and quickly use up al the memory in your computer – so they come with two components: a DOMAIN and a FLOW OBJECT.

Step #2a: DOMAIN

The DOMAIN is usually a cube that describes outlines the edges of the simulation area. Sounds complex right? Yeah nah – not really. It’s just a box that tells the computer where to STOP the simulation. Without it your poor computer might try to simulate an entire imaginary 3D universe – so instead we give it a much easier job by just getting it to work on a very small part of our scene at once.

If you’re interested, ask Elf: so what exactly IS a simulation? (but be prepared for a ~5 minute rant on why physics is awesome. It’s quite entertaining though – I promise!)

That grey cube in front of you will be our domain, but it’s a bit small. We can make it bigger by selecting it, then pushing the ‘s’ key and dragging our cursor out, then left clicking when it’s where we want it to be. Make the cube bigger – ideally you want the edges to be 8 units long on the blender grid.

Now we just need to tell blender that this is a domain rather than just a huge box, so look over to the right of the screen and look for an icon that looks like a ball bouncing (a blue tick with a white circle). Select it (when you have your cube selected) then pick ‘Smoke’ from the dropdown menu and ‘Domain’  from the menu below that. You will see the cube go transparent and a whole bunch of other options will appear.  We’re going to leave these alone for now.

Save your blend file and render it! What do you see?

Step #2b: FLOW OBJECT

The second part of a simulation the FLOW OBJECT  is where the smoke will come from. Go back to the 3D view, pick ‘Add’ from the top menu and Mesh -> Circle (actually you can pick any mesh object you want for this!).

With the newly created circle still selected – look for the ‘physics’ tab (the bouncing ball icon from before), select it and then pick ‘Flow’ from the list below.

Now push ‘Alt+A’ – this will run the simulation and you should see the smoke appear in your 3D viewport. (Calculating the movement of our simulation is called BAKING)

save .blend  push F12 and what do you see? A box!

Step #3: Materials


We have to tell blender what we want the smoke to look like – we do this my adding a MATERIAL to our DOMAIN.  From the right side of the screen (near where the physics tab was) you will find a tab called ‘Material’ (it has the symbol of a small reddish ball). Select it (with the DOMAIN object selected) select ‘New’ and then pick ‘Volume’ from the options.

Now set :

‘DENSITY: 0.0’

Density Scale: 3.7’

If you want to know more about Materials, ask Elf

Step #4: Textures

Now we add a Texture.

Pick the chessboard tab (called Texture), select ‘New’ and then pick ‘Voxel Data’ as the type.

Scrolling down select:

The Domain Object to be ‘Cube’

And under ‘Influence’ check Emission and Density and uncheck Emission Co.

Now pick a frame (drag the vertical green line down the bottom left and right) and hit F12 and you should see it render your smoke!

Step #5: Improvements

Well that..kinda sucked actually didn’t it?  The smoke doesn’t look very real and it’s grey on grey which is hard to see. Lets change the background colour.

Step #5a: Background

From the right hand tabs pick the picture of the earth (called ‘world’) and then select the horizon colour and set all the numbers to 0.0. Then render (F12) again and already things should look better.

Step #5b: Better smoke

Some of you will have noticed that there was an ‘Smoke High Resolution’ option on our DOMAIN object. You can go back and select this if you want - it makes things look much nicer. However it WILL make your render take longer! This is a common balance when you simulate anything - you trade computing time and power for image quality. In the high res smoke options you can also increase the divisions to 3, and in the DOMAIN object you can change Division to 70 if you want REALLY high quality smoke, but it will take FOREVER to animate. I’ll leave it to you to play with these setting later.

Step #5c: Effector Fields

Our smoke is … alright. We can make it look more real, but it’s still acting like boring old smoke (actually this effect called vorticity is AMAZEBALLS, the math behind it is complicated and it’s the same phenomena (convection) responsible for the mushroom cloud of a nuclear explosion - again ask Elf if you want a fun rant about it) so now we can add other effects to it like Turbulence, Wind or a Vortex Field. In Blender, these are called effector objects and you add them just like you did the cube. Go add -> Force Field -> Vortex Field. This will create a spiral in your 3D viewport. If you then press Alt+A, then you will see the smoke creation animation will change slightly and the smoke will spiral around as it’s created.  See the ‘Wind’ section in Extension below for suggestions for how to make this better.

Step #6: Outputting to .avi

Now we’re ready to output our smoke to a video file. In Blender even this simple task can be really confusing, especially if you don’t understand how videos are made. Videos are just static pictures that are changed too fast for our eyes to see. Our brain makes up for it by interpreting the changes as movement. So with Blender you can either output your movie as (literally!) thousands of images that you could then string together to create a movie - or you can cut out the middle man and export it straight to .avi.

We do this by selecting the camera icon on the right of our screen (near the other tabs), then scroll down to ‘output’, type in a file name and change the dropdown menu to AVI JPEG. Then either hit Ctrl + F12 or go to the render menu (top left) and select render animation. It will take a while but Blender will then spit your movie out into the tmp directory (or another one if you change the location before rendering).

Extension:

Fire…

Now imagine there are some (simple) flames creating this smoke. We can simulate this by adding another Texture to our DOMAIN. Go to the texture tab, and select the checkerboard icon from below the one that says ‘Texture’. Then click ‘new’, set the type to Voxel Data, set the Domain object to Cube, and set the Source to Heat (not density which is what we had for the smoke). Under influence check and set Density to about 0.16 and check Emission.

Finally, under ‘Colours’ check the ramp box (this is like setting a gradient in Photoshop)

This section still under construction: http://www.3dartistonline.com/news/2013/01/tutorial-blender-2-65-smoke-effects/

Wind…

Back to force fields. Remove any force fields you have on your scene (select them then, whilst the cursor is over them, push ‘x’ and choose ‘ok’). Now add->Force Field -> Vortex.

Then press ‘g’, ‘z’ and 1 and enter. The vortex field should jump up a unit above the plane. Now push ‘r’, ‘90’ and enter. The vortex field should rotate to the side. Now Alt+A should show the smoke field REALLY changing. You can also add a ‘wind’ or a ‘turbulence’ vortex field to your scene and see how they change the smoke motion. Remember that you will need to Alt+A every time you add a new one or the smoke movement wont notice it. Start by changing the field’s location and using the default settings in each. Then play with adjusting the settings for each field (strength is a good one to start off with!).

and Water!

Finally here is are two excellent resources for extending this into fluid simulations.

http://cgcookie.com/blender/2010/03/29/introduction-to-fluid-simulator/

http://www.blenderguru.com/videos/introduction-to-the-fluid-simulator/

Yes it’s a little advanced but on the other hand TSUNAMI SIMULATIONS.

The general idea is the same as the smoke - set up a DOMAIN (cube) but instead of smoke pick ‘fluid’. Then pick a fluid source (a UV sphere is usually good here) - and in physics pick it as a ‘flow’ object.  Then ALT+A (or Bake Fluid simulation with the DOMAIN selected) and watch what happens in the 3D view port.  Again, start with the default setting and then play. Finally add a material and a texture (there are some great hints on how to make compelling water in the videos above)

Here’s some nice water settings:

Domain object

Adjust time to 10 seconds ( stops default slowdown to 4 s)

For final render set to ~150

Domain world adjust domain size to fit

Domain particles to 0.1 (and set subdivisions in domain boundary to min 2)

Set smoothing to 2

Fluid object inflow or fluid

(for obstacles select ‘both’ (not either volume or shell)

hit bake and cycle through frames when it’s a bit done.

(the domain box will disappear after the first frame)

WITH CYCLES for material:

  • Switch to cycles -> Blender Render Menu in top centre dropdown menu. Select ‘Cycles’ – this will allow you to select default materials without installing the online materials library.
  • Select Glass object for realistic water settings and play with lighting to make it look nicer

OR

Material  (WITHOUT CYCLES):
  • select fluid,
  • Ad new -> surface ->
  • Diffuse -> slight blue
  • Specular -> Blinn
  • Intensity = 1.0
  • Hardness = 511
  • IOR = 8.85
  • Select transparency -> raytrace ->
  • Transparency ~100% (alpha = 0.0)
  • IOR to 1.33333
  • Filter = 0.551
  • Mirror
  • Reflectivity = 0.279
  • Fresnel = 0.3

References

http://www.blenderguru.com/videos/introduction-to-the-fluid-simulator/

http://wiki.blender.org/index.php/Doc:2.6/Manual/Physics/

http://www.3dartistonline.com/news/2013/01/tutorial-blender-2-65-smoke-effects/


http://cgcookie.com/blender/2010/03/29/introduction-to-fluid-simulator/

http://www.blenderguru.com/videos/introduction-to-the-fluid-simulator/

No comments:

Post a Comment