Posted on

Vampiro WIP VII: Fire and Smoke in Cycles

Creating a Cycles Fire and Smoke Shader

Currently (as of Blender 2.71) the Cycles Rendering Engine is lacking a default fire and smoke Shader when utilizing Volumetrics Rendering. As a result this post covers a simple setup to initialize a Shader that can control various, useful properties determining the look of rendered fire and smoke. This methodology is based on Jonathan Lampel’s Youtube video.

Properties of the Shader

  • The Shader can logically be divided into a component that addresses Smoke and another addressing Fire, both of which are composited onto a single volumetric entity.
  • At it’s simplest level both the Density of the Fire and Smoke can be controlled individually with a single value representing each respective component.
  • The color of both components can be adjusted individually.
  • Fire has the ability to illuminate surrounding elements within a scene, utilizing Cycle’s physically accurate renderer.

setp1Rend

Scene Setup

emiter

Select the Default Cube go to

Object -> Quick Effects -> Quick Smoke

A Domain is created around the Cube, which subsequently becomes the Emitter object in the simulation.

Scale the Domain up to encompass a larger area, big enough to engulf the volume of the Fire and Smoke effect.

Select the Emitter.

In the Physics View under Flow Type choose Fire and Smoke.

setp2Rend

Shader Setup

play

Playing through the animation at this point should render fire and smoke in the 3D View.

Switch to the Cycles Rendering Engine, usually located at the top of the screen in Blender’s Info View.

usenodes

Select The Domain and in it’s Material Panel under Surface click the Use Nodes button.

setp3Rend

Volume Shading

Blender would have created several default nodes (from the previous step) to render a default solid surface type. This is not applicable for volumetric rendering and subsequently needs to be adjusted.

nodes01

With the Domain selected, in the Node Editor View delete the Diffuse BSDF Node.

Add 3 new Shader Nodes: Volume Absorption, Volume Scatter and Add.

Composite the two Volume Shaders within the Add Shader, which is subsequently output to the Volume Channel of the Material Output Node.

render3d

Switching the 3D View to Rendered, will reveal the effects of utilizing the Domain object’s Volume Channel for Material rendering.

setp4Rend

Smoke Mapping

As you would have noticed the Domain renders as a volume but the Shader is currently still mapped to the original coordinates of the Cube object. In order to map the Shader to the Smoke and Fire Volume, add an Attribute Node (found under the Input Nodes Group) and set it’s Name field to “density”.

density

Connect the Nodes Output Factor (Fac) to both Volume Nodes’ Density Inputs.

play02

Playing through the animation from the first frame will now render the Volume as expected.

setp5Rend

Creating and Mapping Fire

As the fire will Emit light an Emission Shader Node will be used to simulate this effect.

Create another Add Shader Node and an Emission Shader Node.

flame

Connect the Output of the Emission Shader Node to the Input of the new Add Shader Node. Disconnect the Output of the Add Shader Node created in Step 3 (to the Material Output Node) and Composite this Output within the remaining Channel of the Newly created Add Shader Node. Subsequently Connect the Output of the Newly created Add Shader Node to the Volume Channel of the Material Output Node.

comp

This will revert the Domain to erroneous mapping. Creating the correct mapping for the Fire is a similar process to that previously covered with regards to Smoke.

Create another Attribute Node and enter “flame” in it’s Name input field. Connect this Nodes Factor Channel Output to the Emission Node’s Strength Input Channel.

Fire and Smoke can now be controlled as two separate entities within the same Shader.

setp6Rend

 Color , Density and Intensity

Tweaking settings through the 3D View at this stage will be useful to determine an approximation of what the final rendering will look like as a quick preview. However, for best results use Blender’s Render option (F12 on the Keyboard by Default) to get an accurate representation of the final render.

Color

colorRamp2

Control the color of the fire by adding a ColorRamp Node.

render01

Connect the “flame” Attribute Node’s Color Output to the ColorRamp Node’s Fac input and connect the ColorRamp’s Color Output to the Emission Node’s Color Input.

The Smoke’s color can be controlled with a similar setup.

Intensity

Use a Gamma Node to control the intensity of the Fire, by intercepting the color throughput between the ColorRamp and the Emission Nodes.

gamaSetup

gamma

Controlling Density

The Density of either the Fire or the Smoke can be controlled with a Brightness/Contrast Node by adjusting the Contrast value.

contrastbirght

For the Smoke Connect the Fac Output of the “density” Attribute Node to the Color input channel of the Bright/Contrast Node.

Connect the Color output channel of the Bright/Contrast Node to the corresponding Density Outputs of the Volume Nodes.

contrst0

 

 

 

 

 

 

Conclusion

Many more adjustments could be added to the Fire and Smoke to complement various rendering styles. This setup for a Fire and Smoke Shader in Cycles provides a basic component upon which many additional Nodes can be implemented, experimentation is the key in this case.

Download the file used in this post here

Flattr this!

Leave a Reply

Your email address will not be published. Required fields are marked *