SmokeGen v1.2 documentation

                                                                                                          Legal information
                                                                                                          Installation
                                                                                                          Quick start
                                                                                                          Parameters:
                                                                                                              BASIC
                                                                                                                  obj_pos
                                                                                                                   TraceLevel
                                                                                                                   SceneStartClock
                                                                                                                   SourceID
                                                                                                                   PreviewMode
                                                                                                                   MainColor
                                                                                                                   SmokeDens
                                                                                                              TIME SIMULATION
                                                                                                                  FramesElapsed
                                                                                                                  SplineFile
                                                                                                                  SplineClockStart
                                                                                                                  SplineClockStop
                                                                                                              TRAIL SPECIFIC
                                                                                                                   SmokeDelay
                                                                                                                   TrailLength
                                                                                                              SIZE SPECIFIC
                                                                                                                   InitialSize
                                                                                                                   MaxSizeInc
                                                                                                                    MaxFinalSize
                                                                                                              EMISSION SPECIFIC
                                                                                                                    InitEmiss
                                                                                                                    MinEmiss
                                                                                                                    MaxEmiss
                                                                                                                     Trend
                                                                                                               APPEARANCE SPECIFIC
                                                                                                                     Roughness
                                                                                                                     MinSamples
                                                                                                                     StartTurb
                                                                                                                     TurbIncRate
                                                                                                                     CastShadows
                                                                                                               WIND, ROTATION & ASCENSION
                                                                                                                    ConstAscendRate
                                                                                                                    MaxRandAscend
                                                                                                                     WindDirection
                                                                                                                     WindStrength
                                                                                                                    ConstRotation
                                                                                                                    MaxRandRot
                                                                                                                    DanceStrength
                                                                                                                    DanceRate
                                                                                                                EFFECTS
                                                                                                                      RotationCenter
                                                                                                                      SmokeMass
                                                                                                                  EXTRA
                                                                                                                        SecondaryColor


Legal information

1. SmokeGen is postcardware and thus free to use, copy and modify, provided that you send a postcard to the address specified below. Try to find a postcard with a motive that's as typical for your hometown(or area) as possible! :-)

2. SmokeGen may not be sold or used commercially without permission by the author.

Send your postcard to:

Mikael Carneholm, SA4
IDA
Högskolan i Borås
Allégatan 1
501 90 BORÅS
SWEDEN

POV-Ray(tm) and Persistence of Vision(tm) are registered trademarks of the POV-Ray Team(tm)

Index


Installation

Extract all the files contained in the root of the zipped file to one of the directories (folders) in your POV-Ray
library path (as for example, the default include directory). If you don´t know what they
are, open your POVRAY.INI. If you have a PC running Windows95/98 or WindowsNT, they
probably look something like this:

Library_Path=C:\POV-Ray for Windows\include

If you want to try the examples, also extract the example files with their full paths
to a directory of your choice (if using pkunzip in DOS mode, type "pkunzip -d smokegen.zip" to extract with full paths).

Index


Quick start

The most basic usage is to just declare one variable, called obj_pos and thereafter include the SmokeGen.inc file.

Example:

#declare obj_pos=<0,0,clock*20>;
#include "SmokeGen.inc"

That´s it! The SmokeGen include file (and POV-Ray) takes care of the rest, and smoke will
follow the car, airplane, rocket etc.

The variable obj_pos is the postition of the object that is generating the smoke. I.e, if
you have an object that you want to animate, declare some clock dependant conditions that
control the value of the variable, and then make your object translate with that value.
This way, the smoke "derives" the position from the object automatically.

Example:

   #if( (clock>=0) & (clock<0.5))
      #declare obj_pos=<0,0,clock*20>;
   #end
   #if( (clock>=0.5) & (clock<1.0))
      #declare obj_pos=<0,clock*20,10>;
   #end
   .
   .

   object
   {
      your_object //previously declared in the file
      translate obj_pos
   }

   #include "SmokeGen.inc"
 

NOTE: The main thing is, obj_pos must be declared before SmokeGen is included.

Index


BASIC PARAMETERS

obj_pos
Type: Vector
This is the most important variable in SmokeGen, as it controls:
1. If a smokesource is active
2. Where it is located
As long as obj_pos is declared, smoke will be generated at (from) that position. Once generated, it will live as long as the parameters tells it (and SmokeGen.inc is included). Example:

#if(clock<0.5)
   #declare obj_pos=<5,0,0>;
#end

#include "SmokeGen.inc"

This will create a smoke source that is active at position <5,0,0> while clock is less than 0.5. After this, the smoke will live on and ascend, rotate etc. as long the parameters allows it to exist.

Index


TraceLevel (Previously called MxTrLvl)
Type: Integer
A little "bug" in POV-Ray is the black artifacts that can appear when light passes though
many media objects along its way. This phenomenon is illustrated below.
To correct this, use this variable to get rid of the artifacts. This may vary from scene to
scene depending on how many objects the camera looks "through", but if you at some
point have [n] smoke elements with smoke density [m] along an imaginary straight line
from the camera, you will need a trace level of [2*n*m+1].

Note: It's not necessary to do this calculation. If you get black artifacts in your scene, just
increase TraceLevel until the artifacts disappear.
 


Example of insufficient TraceLevel
(Black artifacts visible)


Problem solved by increasing TraceLevel
(No more visible artifacts)

Index


SceneStartClock
Type: Numerical
This value is used to re-write the files that SmokeGen reads/writes, and it´s important
that you give this variable the same value as the Initial_Clock (+KI). If you don´t,
you may experience "ghost smoke" from previous runs.

Index


SourceID
Type: Integer
When doing an animation you may want the smoke from one source to drift away in one direction, smoke from another to to drift away in the opposite direction and a third should stop generating smoke halfway through the animation(while not stopping the smoke already generated by that source from drifting away in the same direction as previously). To do this, SmokeGen must know which smoke from what source to affect when you call it. This is done by declaring different source ID:s for different sources, and including SmokeGen once for each source in the scene.

Also note that the first source doesn´t need to be ID:d, as it is always considered as source 1.

Index


PreviewMode
Type: Integer
Since media (previously called halo) can take long time to render, there are 2 preview
modes that renders the elements as:

 1. spheres with gradient pigments ("wireframes")
 2. spheres with plain pigments

If you need to see the rotation of the smoke, use mode 1. If not, use mode 2. (Mode 0 is
"real" mode, with smoke rendered using media.)

[PreviewMode=0]                                [PreviewMode=1]                                [PreviewMode=2]
                

Index


MainColor
Type: Vector
This vector describes the main color of the smoke, the one that is emitted with the intensity
of the emission value. Any 3-dimensional color vector will do, except <0,0,0> that will produce invisible smoke.
Note: To achieve black smoke, use <-1, -1, -1>

[MainColor=<0,0,1>]                            [MainColor=<0,1,1>]                           [MainColor=Red]
                

Index


SmokeDens
Type: Integer
Accepted values: 1-10
To control the density of the smoke, increase/decrease the value of this variable. (Note the relation SmokeDens<->TraceLevel, described in TraceLevel.)
Also note that when increasing density, the rendering time increases about the same amount....

[SmokeDens=1]                                    [SmokeDens=5]
        

Index


TIME SIMULATION

FramesElapsed
Type: Integer
To simulate elapsed time, you can use this variable to generate smoke that has been created during x amount of time (n number of frames). This means, if you set FramesElapsed=10, you will see 11 smoke elements on the first frame (10 elements created by the previous frames).

There are two "modes" when using time simulation:

Mode 1 is the "static source" mode, i.e obj_pos is constant during all "frames", and wind and other translating effects is used to achieve some sort of smoke pillar.

Mode 2 is the "spline trail" mode, where a spline file is used to define the positions through time (useful when animating an object that moves along a spile curve). Note: currently, this mode requires that splines are defined using Chris Colefax's Spline generator include. The segment of the curve that should be "filled" is defined by SplineClockStart and SplineClockStop, going from SplineClockStart to SplineClockStop with a density of [FramesElapsed] number of elements.

To use mode 1, just declare FramesElapsed and leave out either one of SplineFile, SplineClockStart, SplineClockStop.
To use mode 2, declare SplineFile, SplineClockStart and SplineClockStop as well as FramesElapsed.
 

Index


SplineFile
Type: String
This variable tells SmokeGen the name of the file that defines your spline curve. This file has to be of the type that is used by Chris Colefax's Spline generator include, i.e, it has to return the vector spline_pos in order to work. (An example would be SplineFile="MySpline.spl")

Index


SplineClockStart
Type: Float
SplineClockStart defines where on the spline curve the elements starts to be generated - to use the very start of the curve, use SplineClockStart=0.

Index


SplineClockStop
Type: Float
SplineClockStop defines where on the spline curve the elements stops to be generated - to use the very end of the curve, use SplineClockStart=1.

Index


TRAIL SPECIFIC

SmokeDelay
Type: Integer
SmokeDelay determines the position in the position history where the smoke starts appearing. Generally, smoke appears a bit behind the object, not
right where it is "at the moment". Use this variable to determine the distance.

Index


TrailLength
Type: Integer
This can be used to cut off a trail at a desired length. Below are two animations showing the difference between using TrailLength and not using TrailLength.

[NoTrailLength used]                          [TrailLength=10]
        
 

Index



SIZE SPECIFIC

InitialSize
Type: Numerical
Determines the initial size(radius) of each smoke element.

Index


MaxSizeInc
Type: Numerical
Determines how much each element can grow from frame to frame, in pov units. For example: with MaxSizeInc set to 0.5, an element with a size of 0.5 at frame one will at most have a size of 1.0 at frame two.

Index


MaxFinalSize
Type: Numerical
Constrains how much the elements can grow. When an element reaches this size, it will no longer grow with the amount determined by MaxSizeInc.

Index



EMISSION SPECIFIC

Emission is the property that is refered to as opacity in some programs. Formula is [E=InitEmiss+Trend*FrameCount]

InitEmiss
Type: Numerical
This variable controls the initial emission(opacity) of the smoke. See the images below for demonstration.

[InitEmiss=0.5]                                      [InitEmiss=1.0]                                     [InitEmiss=2.0]                                      [InitEmiss=5.0]
                        

Index


MinEmiss
Type: Numerical
This variable determines the minimum emission an element can reach, when using Trend to alter the emission over time. (If MinEmiss is set to 0, the elements will fade out totally) Below are two example animations that demonstrates the difference between MinEmiss=0.5 and MinEmiss=0.

NOTE: MinEmiss must be less than InitEmiss for Trend to have effect.

[MinEmiss=0.5]                                    [MinEmiss=0]
        

Index



 

MaxEmiss
Type: Numerical
This variable works like MinEmiss, just the other way around. It controls the maximum emission an element can reach, when using Trend to alter the emission of the elements over time.

NOTE: MaxEmiss must be more than InitEmiss for Trend to have effect.

Index



 

Trend
Type: Numerical
The Trend variable determines the development of the emission over time. A positive value makes the emission increase, while a negative value makes the emission decrease. An example: if Trend=0.1, the emission will increase by 0.1 units/frame. Likewise, if Trend= -0.1, the emission will decrease by 0.1 units/frame.

[Trend=0.1] (Positive)                         [Trend=-0.1] (Negative)
        

Index


APPEARANCE SPECIFIC

Roughness (Previously called Pulverization)
Type: Integer
Accepted values: 1-10
This variable can be used to change the appearance on the rough/fine scale, as illustrated below. This is useful specially when using SmokeGen for generating other effects than smoke.

[Roughness=10]                                   [Roughness=1]
        

Index


MinSamples
Type: Integer
Especially when the smoke elements are scaled high, a certain level of "grainyness" starts to appear. This is due to the minimum number of samples that is set default in SmokeGen. To avoid this, increase the value of MinSamples (default value is 1).

Note: The larger number of samples, the slower the rendering. Thus, do not set this larger than default if not necessary.

[MinSamples=low]                               [MinSamples increased]
        
 

Index



 

StartTurb
Type: Numerical
Use this variable to control the initial turbulence in the elements, that is, the turbulence right after the element has been created. Below are some illustrations of various degrees of turbulence:

[0]                                                           [0.5]                                                         [1.0]                                                        [1.5]
                        

[2.0]                                                        [2.5]                                                         [3.0]                                                        [3.5]
                        

Index


TurbIncRate
Type: Numerical
TurbIncRate controls how fast the turbulence increases over time. [TurbIncRate=0.1] makes the turbulence increase 0.1 units/frame. Turbulence is important to get that realistic modularization of the smoke (=twisting&fading at the same time).
This can be an alternative(or complement) to using Trend to achieve a fading effect.

[Usage of TurbIncRate to achieve a fading effect]

Index


CastShadows
Type: Boolean
The smoke can be made to cast shadows or not. [CastShadows=true] or [CastShadows=1] will make the smoke cast shadows, while [CastShadows=false] or [CastShadows=0] will turn shadows off.

[CastShadows=true]                            [CastShadows=false]
        

Index


WIND, ROTATION & ASCENSION

ConstAscendRate
Type: Numerical
This variable controls the constant movement of the elements in the Y axis. For example, [ConstAscendRate=0.3] means each element will be translated 0.3 units per frame in the positive Y direction. To get a realistic smoke effect, add some random movement as well by using MaxRandAscend.

Index


MaxRandAscend
Type: Numerical
MaxRandAscend controls the random ascension of the elements. For example, [MaxRandAscend=0.2] means that the maximum random translation in the positive Y direction will be 0.2. Normally, MaxRandAscend should be used in addition to ConstAscendRate as a "spice" to achieve a more realistic behaviour of the smoke.

Index


WindDirection
Type:Vector
This vector describes the direction of a (constant) wind that it blowing in your scene and thus affecting the smoke. Following this package you should find the file "DefWinds" containing 8 pre-declared winddirections (N,NE,E,SE,S,SW,W,NW), made with the definition Z+ =North, X+ =East, Z- =South and X- =West.
NOTE: For the wind to have effect, a WindStrength has to be declared.

Example 1: (using the default winds)
#include "DefWinds"
#declare WindDirection=N;

Example 2: (declaring your own wind direction)
#declare WindDirection=<0.3, 0, 0.8>;

[Without wind]                                    [With wind]
        

Index


WindStrength
Type:Numerical
For a WindDirection to have effect, a WindStrength also has to be declared. For example, if you declare WindDirection=N (which equals <0,0,1>) and give WindStrength the value of 0.3, the total wind will be blowing with <0,0,0.3> units/frame.
Formula is [total wind=WindDirection*WindStrength]

Index


ConstRotation
Type: Numerical
This variable controls the constant rotation of the smoke. The value determines the number of degrees each element rotates each frame, i.e [ConstRotation=5] gives 5 degrees rotation per frame. Rotation is useful both for smoke after moving vehicles and for smoke from static objects. The rotation is done about the normal between the elements(see illustration below)

Below are two animations that show the same scene, one where rotation is used and one where no rotation is used.
(Note: Both scenes use MaxSizeInc to achieve a slight growing effect, which is what makes the smoke "live" in the no-rotation scene.)

[With]                                                    [Without]
        
 

Index


MaxRandRot
Type: Numerical
Apart from using constant rotation, some random rotation can also be used. Type of rotation is the same as for the constant type, i.e degrees per frame about the normal between the elements.

Index


General info: New to version 1.2, is DanceStrength and DanceRate that can be used to create a wriggling, winding effect.
The effect depends on the WindDir vector, i.e the "dancing" will be in the (+/-)WindDir direction.

DanceStrength
Type: Numerical
DanceStrength determines the width of the oscillation, in POV units. Be careful though, as the distance accumulates for each full oscillation cycle. Good starting values could be 0.001 to 0.01 (dependant on scene scaling of course).

[DanceStrength=0.006]                        [DanceStrength=0.012]
        

Index


DanceRate
Type: Numerical
DanceRate controls the time between each oscillation peak, i.e the number of  peaks during a period of time. A high value thus gives a slow oscillation, while a low value gives a quick oscillation.

[DanceRate=10]                                    [DanceRate=1]
        
 

Index


EFFECTS

RotationCenter
Type: Vector
RotationCenter defines the point that the object is rotating about. For example, if you declare a cube at <0,0,0>, rotate it about <0,0,0> and then translate that object to <0,3,1> it will appear to be rotating about <0,3,1>. Thus, declare RotationCenter as <0,3,1>.

Index


SmokeMass
Type: Numerical
To control how far away the smoke will be thrown, use SmokeMass. A higher value gives long distances, while a low value gives short distances. Note: The distance is depending on how fast the object is rotating, as well. Formula is  [angle*mass]

        
[Low SmokeMass]                              [Higher SmokeMass]

Index


EXTRA

SecondaryColor
Type: Vector
As an option, the secondary color of the media contained within the elements can be controlled by SecondaryColor.

[SecondaryColor=<0,0,1>]

Index


Glossary:
Smoke element: A sphere that is used as a container for the media.


© Copyright Mikael Carneholm 1999