POV-Ray : Newsgroups : povray.text.scene-files : Smoke macro source code : Smoke macro source code Server Time
28 Jul 2024 12:30:51 EDT (-0400)
  Smoke macro source code  
From: Chris Huff
Date: 29 Jul 2000 13:47:33
Message: <chrishuff-D28677.12482029072000@news.povray.org>
This is just a very simple particle system for simulating smoke. It 
should work fine in the official version, it doesn't use any MegaPOV 
features.

//*******************************************
#macro SRand(Seed) (rand(Seed)*2 - 1)#end
#declare RS = seed(6463681);
#declare Wind = < 1, 0, 0>;
#declare Drag = 0.25;
#declare Buoyancy = 0.1;
#declare StartTemperature = 5;
#declare CoolRate = 0.7;

#macro SmokeParticle(Iter, StartPos, StartVel, Radius, RandRadius, 
Jitter)
    #local Pos = StartPos;
    #local Vel = StartVel + < SRand(RS)*Jitter, SRand(RS)*Jitter, 
SRand(RS)*Jitter>;
    #local T=StartTemperature;
    #local J=0;
    #while(J < Iter)
        #local T = T*CoolRate;
        #local Force = y*T*Buoyancy + (Wind - Vel)*Drag;
        #local Vel = Vel + Force;
        #local Pos = Pos + Vel;
        #local J=J+1;
    #end
    sphere {Pos, Radius+RandRadius*rand(RS)}
#end


union {
    #declare Wind = < 0, 0, 0>;
    #declare Pos = < 8, 0.5, 0>;
    #declare J=0;
    #declare Parts=150;
    #while(J < Parts)
        SmokeParticle(25*(1-J/Parts), Pos, y*1.5, 0.25, 0.25, 0.5)
        SmokeParticle(25*(1-J/Parts), Pos, y*1.5, 0.25, 0.25, 0.5)
        #declare Pos = Pos - x*0.1;
        #declare J=J+1;
    #end
    difference {
        cylinder {< 0,-0.5, 0>, < 0, 2, 0>, 1.5}
        cylinder {< 0, 0, 0>, < 0, 3, 0>, 1.45}
        texture {
            pigment {color Yellow}
        }
        translate Pos
    }
    texture {
        pigment {color White}
//      pigment {color White*0.2 transmit 0.75}
//      pigment {color White filter 0.9}
    }
    scale 0.5
}

//*******************************************

-- 
Christopher James Huff - Personal e-mail: chr### [at] maccom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://homepage.mac.com/chrishuff/
TAG Web page: http://tag.povray.org/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.