POV-Ray : Newsgroups : povray.text.scene-files : Flow.pov Server Time
23 Dec 2024 21:49:19 EST (-0500)
  Flow.pov (Message 1 to 1 of 1)  
From: Chris Huff
Subject: Flow.pov
Date: 22 Jun 2000 10:52:31
Message: <chrishuff-013514.09565522062000@news.povray.org>
//  Persistence of Vision Ray Tracer Scene Description File
//  File: Flow.pov
//  Date: 6/22/00
//  Author: Chris Huff
//   
//   *******************************************
//   -------------------------------------------
#include "colors.inc"
#include "textures.inc"
//#include "glass.inc"
//#include "metals.inc"
//#include "stones.inc"
//#include "stones1.inc"
//#include "stones2.inc"
//#include "golds.inc"
//#include "skies.inc"
//#include "woods.inc"
#version unofficial MegaPov 0.5;
//-------------------------------------------
global_settings {
    assumed_gamma 1.8
}

camera {
    location <2, 3.5,-8>*2
    up y*image_height right x*image_width
    angle 45
    look_at <0, 2.5, 0>
    rotate y*15
}

#declare Land =
height_field {
    pattern 300, 300 {hf_gray_16
        wrinkles//function {}
        color_map {
            [0 color Black]
            [1 color White]
        }
    }
//  hierarchy
    smooth
    texture {
        pigment {color White}
    }
    translate <-0.5,-0.5,-0.5>
    scale 200
}

//union {
//  box {<-100, 0,-100>, < 100, 0, 100>
//      texture {
//          pigment {checker color Black, color White}
//      }
//      rotate -x*5
//  }
//  box {<-100, 0,-100>, < 100, 0, 100>
//      texture {
//          pigment {checker color Black, color White}
//      }
//      rotate x*5
//  }
//  rotate z*5
//}
object {Land}
//*******************************************
#declare rsA = seed(7582);
#declare rsB = seed(4385);
#declare rsC = seed(6543);
#declare rsD = seed(8538);
#declare rsE = seed(5235);


#declare NoContrail = 0;
#declare StreakContrail = 1;
#declare DotContrail = 2;
#declare SprayContrail = 3;

#declare NoHead = 0;
#declare PlainHead = 1;
#declare HeadGlowAmt = 0;

#declare gAccel = 0.981;
#declare tUnit = 0.1;

#declare HeadMat =
material {
    texture {
        pigment {color White}
    }
}
#declare ContrailMat =
material {
    texture {
        pigment {color Red}
    }
}


#declare ForceSamps = 50;

#macro Drop(Iter, StPos, StVel, Mass, Radius, Repulsion)
    #local Norm = < 0, 0, 0>;
    #local Vel = StVel;
    
    //position over landscape:
    #local Pos = trace(Land, StPos+y*10000, -y, Norm);
    #if(Norm.x != 0 | Norm.y != 0 | Norm.z != 0)
        #local Pos = Pos + < 0, StPos.y, 0>;
    #else
        #local Pos = StPos;
    #end
    
    union {
        //loop through iterations
        #local K=0;
        #while(K<Iter)
            #local Force = -y*gAccel;
            
            //calculate force from height field
            #local AvgDir = < 0, 0, 0>;
            #local J=0;
            #while(J<ForceSamps)
                #local Dir = trace(Land, Pos, vrotate(y,<rand(rsA)*180, 
rand(rsA)*360, 0>), Norm) - Pos;
                #if(Norm.x != 0 | Norm.y != 0 | Norm.z != 0)
                    #local AvgDir = AvgDir + 
vnormalize(Dir)/pow(vlength(Dir),2);
                #end
                #local J=J+1;
            #end
            #local AvgDir = AvgDir/ForceSamps;
            
            #local Force = Force - AvgDir*Repulsion;
            
            #local Pos = Pos + Vel*tUnit + (tUnit*Force/Mass)/2;
            #local Vel = Vel + tUnit*Force/Mass;
            sphere {Pos, Radius*0.5 material {ContrailMat}}
            #local K=K+1;
        #end
        sphere {Pos, Radius material {HeadMat}}
    }
#end

//Drop(128, y*1, < 10, 1, 5>, 1, 0.15, 2)
//cylinder {<-10,-1000, 25>, <-10, 1000, 25>, 1 material {ContrailMat}}
Drop(1024, <-15, 1, 35>, < 0, 0, 0>, 1, 0.35, 0.5)
//Drop(Iter, StPos, StVel, Mass, Radius, Repulsion)
#declare C=0;
#while(C<10)
    Drop(256, <-15+(rand(rsB)*2-1)*5, 1, 35+(rand(rsB)*2-1)*5>, < 0, 0, 
0>, 1, 0.35, 0.5)
    #declare C=C+1;
#end


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

light_source {<-20, 150, -100> color White}
light_source {< 30, 50,-60> color White*0.3}

light_source {< 10, 40, 80> color White*0.3}

//   -------------------------------------------

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


Post a reply to this message

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