POV-Ray : Newsgroups : povray.text.scene-files : Smoke macro source code Server Time
31 Oct 2024 10:20:37 EDT (-0400)
  Smoke macro source code (Message 1 to 3 of 3)  
From: Chris Huff
Subject: Smoke macro source code
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

From: Ken
Subject: Re: Smoke macro source code
Date: 30 Jul 2000 12:07:58
Message: <39845138.D8F1DAB2@pacbell.net>
Chris Huff wrote:
> 
> it doesn't use any MegaPOV features.

How did you manage to resist the temptation ? :)

-- 
Ken Tyler - 1400+ POV-Ray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Chris Huff
Subject: Re: Smoke macro source code
Date: 30 Jul 2000 12:52:59
Message: <chrishuff-538646.11534630072000@news.povray.org>
In article <39845138.D8F1DAB2@pacbell.net>, lin### [at] povrayorg 
wrote:

> How did you manage to resist the temptation ? :)

It wasn't easy. Actually, the actual scene used image_width and 
image_height to readjust the camera when changing aspect ratios...and I 
almost made a more powerful macro using my transform patch and/or the 
spline patch(the one I like, with the spline {} syntax). Then there was 
the compulsion to do it all with my particle_system patch, or to add the 
ability to control it using eval_pigment()...but I managed to hold 
myself back. :-)

-- 
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.