POV-Ray : Newsgroups : povray.text.scene-files : Clouds code Server Time
22 Dec 2024 22:57:09 EST (-0500)
  Clouds code (Message 1 to 4 of 4)  
From: Gilles Tran
Subject: Clouds code
Date: 8 Apr 2002 07:44:21
Message: <3cb18295$1@news.povray.org>
// Test for fast clouds
// Gilles Tran 8/4/2002 (www.oyonale.com)
// Feel free to use, modify etc.
#version 3.5;
#include "colors.inc"
global_settings{max_trace_level 50}

light_source {
    -z*10000
    White*2
    rotate x*60
    rotate y*90
}
camera {
  location  <0.0, 0, -60>
  direction z*8
  right     image_width/image_height*x
  look_at   y*3+z*10
}
#declare SkyBlue=rgb <135,142,238>/255;
//#declare SkyBlue=rgb <135,172,238>/255;

#macro colCloud(Color,P,S,T)
    rgbf <pow(Color.x,P)*S,pow(Color.y,P)*S,pow(Color.z,P)*S,T>
#end

#declare colCloud1=colCloud(SkyBlue,0.3,0.6,0.8); // shadow
#declare colCloud2=colCloud(SkyBlue,0.3,0.8,0.5);
#declare colCloud3=colCloud(SkyBlue,0.2,1,0.3);
#declare colCloud4=colCloud(SkyBlue,0.1,1.2,0.1); // white

#declare colBack=Clear;
// the clouds pigment
// because it's based on the cylindrical pattern, translating the pattern
along the z axis changes the shape of the cloud
#macro mPigCloud(S1,S2) // S1 and S2 are the cloud length and height
    #local Turb=0.35+rand(rd)*0.2;
    #local Lambda=3+rand(rd);
    pigment{
        pigment_pattern{
            cylindrical
            scale <S1,1,S2>
            warp{turbulence Turb lambda Lambda}
            rotate -x*90
        }
        pigment_map{
            [0.4 color colBack]
            [0.5
                pigment_pattern{
                    function{min(1,max(0,y))}
                    warp{turbulence Turb lambda Lambda}
                    rotate -z*20 // tilts the higlights to the right
                }
                pigment_map{
                    [0

                        pigment_pattern{
                            cylindrical
                            scale <S1,1,S2>
                            warp{turbulence Turb lambda Lambda}
                            rotate x*-90
                        }
                        pigment_map{
                            [0 color Clear]
                            [0.7 colCloud1]
                            [1 color colCloud2]
                        }

                    ]
                    [0.7 colCloud4]
                }
            ]
        }
    }
    finish{ambient 1 diffuse 0}

#end
#declare i=0;
#declare rd=seed(1);
#declare NZ=6;
#declare LZ=6;
#declare Nuage0=union{ // basic cloud square
    triangle{0,y,x+y}
    triangle{0,x,x+y}
    hollow
    translate -x*0.5-y*.5
    scale 5
    no_shadow
}
union{
    #while (i<10)
        #debug concat(str(i,0,0),"\n")
        #declare j=0;
        #declare zC=i*40;
        #while (j<NZ)
            #declare Nuage=union{ // 3 subclouds
                object{Nuage0
texture{mPigCloud(2+rand(rd),0.5+rand(rd))translate z*100*rand(rd)}
                    #declare SN1=0.4+rand(rd)*0.4;
                    scale SN1

                }

                object{Nuage0
texture{mPigCloud(2+rand(rd),0.5+rand(rd))translate z*100*rand(rd)}
                    #declare SN2=0.4+rand(rd);
                    scale SN2
                    translate <2*rand(rd),0,-2>
                }

                object{Nuage0
texture{mPigCloud(2+rand(rd),0.5+rand(rd))translate z*100*rand(rd)}
                    #declare SN3=0.4+rand(rd);
                    scale SN3
                    translate <-2*rand(rd),0,-1>
                }
            }
            union{
                object{Nuage clipped_by{plane{y,0 inverse}}}
                object{Nuage clipped_by{plane{y,0}} scale <1,0.5,1>} //
makes the bottom flatter
                scale (1+rand(rd))
                translate
<-LZ+(j/(NZ-1))*(2*LZ)+(0.5-rand(rd))*5,0,zC+rand(rd)+(0.5-rand(rd))*i*60>
            }
            #declare j=j+1;
        #end
        #declare i=i+1;
        #declare NZ=NZ+i*2;
        #declare LZ=LZ+4*i;
    #end
    translate y*4
}


sky_sphere{
    pigment{
        gradient y
        poly_wave 0.1
        color_map{
            [0 color SkyBlue*2]
            [1 color SkyBlue*0.3]
        }
    }
    rotate x*2
}

fog{colCloud(SkyBlue,0.3,1,0) fog_type 2 distance 400 fog_alt 8}


Post a reply to this message

From: Martial
Subject: Re: Clouds code
Date: 9 Apr 2002 15:48:54
Message: <3cb345a6$1@news.povray.org>
Merci Gilles 
en plus c'est rapide comme rendu !
Thanks Gilles 
It is fast render !

--
Martial


Post a reply to this message

From: Jeff Nighbert
Subject: Re: Clouds code
Date: 13 May 2002 10:47:51
Message: <3CDFD214.B7043FCF@or.blm.gov>
Hi folks--
I have made some changes to the fast clouds code.  I have added some variables
that I believe make this code more usable for regular folks.  I have enclosed
a sample scene file that I think will run if you have pov version 3.5 beta.
In the code I have indicated where you can change variables to see how the
program works.
Below is the New_fastclouds.pov for everyone to try:
//============================================= mark here
// Persistence of Vision Ray Tracer Scene Description File
// File: ?.pov
// Vers: 3.5
// Desc: Basic Scene Example
// Date: mm/dd/yy
// Auth: ?
//

#version 3.5;

#include "colors.inc"

global_settings {
  assumed_gamma 1.0
  max_trace_level 255 // need this for fast_clouds2.inc
}

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

camera {
  location  <0.0, 0, -10.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0,3,  0.0>
  angle 50
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 30, -30>
}

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

plane {
  y, -1
  pigment { color rgb <0.7,0.5,0.3> }
}

sphere {
  0.0, 1
  texture {
    pigment {
      radial
      frequency 8
      color_map {
        [0.00 color rgb <1.0,0.4,0.2> ]
        [0.33 color rgb <0.2,0.4,1.0> ]
        [0.66 color rgb <0.4,1.0,0.2> ]
        [1.00 color rgb <1.0,0.4,0.2> ]
      }
    }
    finish{
      specular 0.6
    }
  }
  translate <0,3,0> // put this in the air
}

#declare Sunset_Sky =
pigment {
gradient y
color_map {
 [-1 color rgb <1,1,0>]
[0 color rgb <1,.8,0>]
[.075 color rgb <1,.5,0>]
[.25 color rgb <.3,.25,1>]
[.35 color rgb <.1,.05,1>]
[.5 color rgb <0,0,.5>]
[1 color rgb <0,0,.25>]
}


scale <1,1,1>
rotate <0,0,0>
}

sky_sphere{
pigment{Sunset_Sky

}

 pigment{
  bozo
  turbulence .5
  color_map{
   [0.0 rgbt <.5,.5,.5,.8> ]
   [1.0 rgbt <1,1,1,.5> ]
  }
  scale .5
  scale <1,1/6,1>

 }


translate 0
scale 1.5
rotate <0,0,0>
}
//
=================================================================================================

// to see what these variables really do, change the fcloud_count to 10 or the
fcloud_scale_min or
//any other variable, you should see some changes!
// Thanks to Gilles for the basic code and to Chris Colfax for "how to use
variables"
//
=====================================================================================

 // fast_clouds2
#declare fcloud_count = 300;
#declare fcloud_min_xtnt = <-50,0,-50>;
#declare fcloud_max_xtnt = <50,50,50>;
#declare fcloud_scale_min = <1,1,1>;
#declare fcloud_scale_max = <5,5,5>;
#declare fcloud_turb = .1;
#declare fcloud_lambda = .1;
#declare fcloud_highlight_angle = 10;
#declare fcloud_rotate = <-60,0,0>;
#declare fcloud_color =  <1,.8,.8>*1.5;

//#include "i:\from_home2\my_includes\fast_clouds2.inc"
// ======================================================================
// I have inserted the inc file here, but it should be a separate file
//=======================================================================
// Test for fast clouds
// Gilles Tran 8/4/2002 (www.oyonale.com
// Feel free to use, modify etc.
#version 3.5;
#include "colors.inc"
// random number generation macros
//
#include "rand.inc"
#ifndef (fcloud_count) #declare fcloud_count = 10; #end //cloud count
#ifndef (fcloud_min_xtnt) #declare fcloud_min_xtnt = <-10,0,-10>; #end //min
vect of box
#ifndef (fcloud_max_xtnt) #declare fcloud_max_xtnt = < 10,10,10>; #end //max
vect of box
#ifndef (fcloud_scale_min) #declare fcloud_scale_min = 1; #end //lower cloud
scale
#ifndef (fcloud_scale_max) #declare fcloud_scale_max = 4; #end //upper cloud
scale
#ifndef (fcloud_turb) #declare fcloud_turb = .1; #end //cloud turbulence
#ifndef (fcloud_lambda) #declare fcloud_lambda = .1; #end //lower is smoother
#ifndef (fcloud_highlight_angle) #declare fcloud_highlight_angle = -20; #end
//lower is smoother
#ifndef (fcloud_rotate) #declare fcloud_rotate = 0;#end //individual cloud
rotation
#ifndef (fcloud_color) #declare fcloud_color = <1,1,1>;#end


#declare SkyBlue=rgb <135,142,238>/255;
//#declare SkyBlue=rgb <135,172,238>/255;

#macro colCloud(Color,P,S,T)
    rgbf <pow(Color.x,P)*S,pow(Color.y,P)*S,pow(Color.z,P)*S,T>
#end

#declare colCloud1=colCloud(SkyBlue,0.3,0.6,0.8); // shadow
#declare colCloud2=colCloud(SkyBlue,0.3,0.8,0.5);
#declare colCloud3=colCloud(SkyBlue,0.2,1,0.3);
#declare colCloud4=colCloud(SkyBlue,0.1,1.2,0.1); // white

#declare colBack=Clear;
// the clouds pigment
// because it's based on the cylindrical pattern, translating the pattern
//along the z axis changes the shape of the cloud
#macro mPigCloud(S1,S2) // S1 and S2 are the cloud length and height
    #local Turb=0.35+rand(rd)*fcloud_turb;
    #local Lambda=3+rand(rd)*fcloud_lambda;  //cloud smoothness
    pigment{
        pigment_pattern{
           cylindrical
            scale <S1,1,S2>
           warp{turbulence Turb lambda Lambda octaves 4}
            rotate -x*90

        }
        pigment_map{
            [0.4 color colBack]
            [0.5
                pigment_pattern{
                    function{min(1,max(0,y))}
                    warp{turbulence Turb lambda Lambda}
                    rotate -z*fcloud_highlight_angle // tilts the higlights to
the right
                }
                pigment_map{
                    [0

                        pigment_pattern{
                            cylindrical
                            scale <S1,1,S2>
                            warp{turbulence Turb lambda Lambda}
                            rotate x*-90
                        }
                        pigment_map{
                            [0 color Clear]
                            [0.7 colCloud1]
                            [1 color colCloud2]
                        }

                    ]
                    [0.7 colCloud4]
                }
            ]
        }
    }

    finish{ambient fcloud_color diffuse 0 brilliance 100}

#end

#declare i=0;
#declare rd=seed(1);

#declare Nuage0=union{ // basic cloud square
    triangle{0,y,x+y}
    triangle{0,x,x+y}
    hollow
    translate -x*0.5-y*.5
    scale 5
    no_shadow
}



#debug concat(str(i,0,0),"\n")
#declare j=0;

#declare Nuage=union{
   #while (j<fcloud_count)
          object{Nuage0 rotate fcloud_rotate
                 texture{mPigCloud(2+rand(rd),0.5+rand(rd))translate
z*100*rand(rd)}
                    #declare SN2=0.4+rand(rd)*.3;
                    scale SN2*RRand(fcloud_scale_min,fcloud_scale_max,RdmB)
                    translate
VRand_In_Box(fcloud_min_xtnt,fcloud_max_xtnt,RdmA)
                }

  #declare j=j+1;
  #end
  }

//=======================================================================================

// end of .inc file
//=======================================================================================



object{Nuage  rotate <0,0,0>
scale <10,3,10>
translate <3,80,0>
//scale <3,2,3>
}

//==================================cut here

I have also attached it.

Thank you,

Jeff


Gilles Tran wrote:

> // Test for fast clouds
> // Gilles Tran 8/4/2002 (www.oyonale.com)
> // Feel free to use, modify etc.
> #version 3.5;
> #include "colors.inc"
> global_settings{max_trace_level 50}
>
> light_source {
>     -z*10000
>     White*2
>     rotate x*60
>     rotate y*90
> }
> camera {
>   location  <0.0, 0, -60>
>   direction z*8
>   right     image_width/image_height*x
>   look_at   y*3+z*10
> }
> #declare SkyBlue=rgb <135,142,238>/255;
> //#declare SkyBlue=rgb <135,172,238>/255;
>
> #macro colCloud(Color,P,S,T)
>     rgbf <pow(Color.x,P)*S,pow(Color.y,P)*S,pow(Color.z,P)*S,T>
> #end
>
> #declare colCloud1=colCloud(SkyBlue,0.3,0.6,0.8); // shadow
> #declare colCloud2=colCloud(SkyBlue,0.3,0.8,0.5);
> #declare colCloud3=colCloud(SkyBlue,0.2,1,0.3);
> #declare colCloud4=colCloud(SkyBlue,0.1,1.2,0.1); // white
>
> #declare colBack=Clear;
> // the clouds pigment
> // because it's based on the cylindrical pattern, translating the pattern
> along the z axis changes the shape of the cloud
> #macro mPigCloud(S1,S2) // S1 and S2 are the cloud length and height
>     #local Turb=0.35+rand(rd)*0.2;
>     #local Lambda=3+rand(rd);
>     pigment{
>         pigment_pattern{
>             cylindrical
>             scale <S1,1,S2>
>             warp{turbulence Turb lambda Lambda}
>             rotate -x*90
>         }
>         pigment_map{
>             [0.4 color colBack]
>             [0.5
>                 pigment_pattern{
>                     function{min(1,max(0,y))}
>                     warp{turbulence Turb lambda Lambda}
>                     rotate -z*20 // tilts the higlights to the right
>                 }
>                 pigment_map{
>                     [0
>
>                         pigment_pattern{
>                             cylindrical
>                             scale <S1,1,S2>
>                             warp{turbulence Turb lambda Lambda}
>                             rotate x*-90
>                         }
>                         pigment_map{
>                             [0 color Clear]
>                             [0.7 colCloud1]
>                             [1 color colCloud2]
>                         }
>
>                     ]
>                     [0.7 colCloud4]
>                 }
>             ]
>         }
>     }
>     finish{ambient 1 diffuse 0}
>
> #end
> #declare i=0;
> #declare rd=seed(1);
> #declare NZ=6;
> #declare LZ=6;
> #declare Nuage0=union{ // basic cloud square
>     triangle{0,y,x+y}
>     triangle{0,x,x+y}
>     hollow
>     translate -x*0.5-y*.5
>     scale 5
>     no_shadow
> }
> union{
>     #while (i<10)
>         #debug concat(str(i,0,0),"\n")
>         #declare j=0;
>         #declare zC=i*40;
>         #while (j<NZ)
>             #declare Nuage=union{ // 3 subclouds
>                 object{Nuage0
> texture{mPigCloud(2+rand(rd),0.5+rand(rd))translate z*100*rand(rd)}
>                     #declare SN1=0.4+rand(rd)*0.4;
>                     scale SN1
>
>                 }
>
>                 object{Nuage0
> texture{mPigCloud(2+rand(rd),0.5+rand(rd))translate z*100*rand(rd)}
>                     #declare SN2=0.4+rand(rd);
>                     scale SN2
>                     translate <2*rand(rd),0,-2>
>                 }
>
>                 object{Nuage0
> texture{mPigCloud(2+rand(rd),0.5+rand(rd))translate z*100*rand(rd)}
>                     #declare SN3=0.4+rand(rd);
>                     scale SN3
>                     translate <-2*rand(rd),0,-1>
>                 }
>             }
>             union{
>                 object{Nuage clipped_by{plane{y,0 inverse}}}
>                 object{Nuage clipped_by{plane{y,0}} scale <1,0.5,1>} //
> makes the bottom flatter
>                 scale (1+rand(rd))
>                 translate
> <-LZ+(j/(NZ-1))*(2*LZ)+(0.5-rand(rd))*5,0,zC+rand(rd)+(0.5-rand(rd))*i*60>
>             }
>             #declare j=j+1;
>         #end
>         #declare i=i+1;
>         #declare NZ=NZ+i*2;
>         #declare LZ=LZ+4*i;
>     #end
>     translate y*4
> }
>
> sky_sphere{
>     pigment{
>         gradient y
>         poly_wave 0.1
>         color_map{
>             [0 color SkyBlue*2]
>             [1 color SkyBlue*0.3]
>         }
>     }
>     rotate x*2
> }
>
> fog{colCloud(SkyBlue,0.3,1,0) fog_type 2 distance 400 fog_alt 8}


Post a reply to this message


Attachments:
Download 'new_fastclouds.pov.txt' (7 KB)

From: Jeff Nighbert
Subject: Re: Clouds code
Date: 13 May 2002 11:00:27
Message: <3CDFD508.F0522B76@or.blm.gov>
Gilles Tran wrote:

> // Test for fast clouds
> // Gilles Tran 8/4/2002 (www.oyonale.com)
> // Feel free to use, modify etc.
> #version 3.5;
> #include "colors.inc"
> global_settings{max_trace_level 50}
>
> light_source {
>     -z*10000
>     White*2
>     rotate x*60
>     rotate y*90
> }
> camera {
>   location  <0.0, 0, -60>
>   direction z*8
>   right     image_width/image_height*x
>   look_at   y*3+z*10
> }
> #declare SkyBlue=rgb <135,142,238>/255;
> //#declare SkyBlue=rgb <135,172,238>/255;
>
> #macro colCloud(Color,P,S,T)
>     rgbf <pow(Color.x,P)*S,pow(Color.y,P)*S,pow(Color.z,P)*S,T>
> #end
>
> #declare colCloud1=colCloud(SkyBlue,0.3,0.6,0.8); // shadow
> #declare colCloud2=colCloud(SkyBlue,0.3,0.8,0.5);
> #declare colCloud3=colCloud(SkyBlue,0.2,1,0.3);
> #declare colCloud4=colCloud(SkyBlue,0.1,1.2,0.1); // white
>
> #declare colBack=Clear;
> // the clouds pigment
> // because it's based on the cylindrical pattern, translating the pattern
> along the z axis changes the shape of the cloud
> #macro mPigCloud(S1,S2) // S1 and S2 are the cloud length and height
>     #local Turb=0.35+rand(rd)*0.2;
>     #local Lambda=3+rand(rd);
>     pigment{
>         pigment_pattern{
>             cylindrical
>             scale <S1,1,S2>
>             warp{turbulence Turb lambda Lambda}
>             rotate -x*90
>         }
>         pigment_map{
>             [0.4 color colBack]
>             [0.5
>                 pigment_pattern{
>                     function{min(1,max(0,y))}
>                     warp{turbulence Turb lambda Lambda}
>                     rotate -z*20 // tilts the higlights to the right
>                 }
>                 pigment_map{
>                     [0
>
>                         pigment_pattern{
>                             cylindrical
>                             scale <S1,1,S2>
>                             warp{turbulence Turb lambda Lambda}
>                             rotate x*-90
>                         }
>                         pigment_map{
>                             [0 color Clear]
>                             [0.7 colCloud1]
>                             [1 color colCloud2]
>                         }
>
>                     ]
>                     [0.7 colCloud4]
>                 }
>             ]
>         }
>     }
>     finish{ambient 1 diffuse 0}
>
> #end
> #declare i=0;
> #declare rd=seed(1);
> #declare NZ=6;
> #declare LZ=6;
> #declare Nuage0=union{ // basic cloud square
>     triangle{0,y,x+y}
>     triangle{0,x,x+y}
>     hollow
>     translate -x*0.5-y*.5
>     scale 5
>     no_shadow
> }
> union{
>     #while (i<10)
>         #debug concat(str(i,0,0),"\n")
>         #declare j=0;
>         #declare zC=i*40;
>         #while (j<NZ)
>             #declare Nuage=union{ // 3 subclouds
>                 object{Nuage0
> texture{mPigCloud(2+rand(rd),0.5+rand(rd))translate z*100*rand(rd)}
>                     #declare SN1=0.4+rand(rd)*0.4;
>                     scale SN1
>
>                 }
>
>                 object{Nuage0
> texture{mPigCloud(2+rand(rd),0.5+rand(rd))translate z*100*rand(rd)}
>                     #declare SN2=0.4+rand(rd);
>                     scale SN2
>                     translate <2*rand(rd),0,-2>
>                 }
>
>                 object{Nuage0
> texture{mPigCloud(2+rand(rd),0.5+rand(rd))translate z*100*rand(rd)}
>                     #declare SN3=0.4+rand(rd);
>                     scale SN3
>                     translate <-2*rand(rd),0,-1>
>                 }
>             }
>             union{
>                 object{Nuage clipped_by{plane{y,0 inverse}}}
>                 object{Nuage clipped_by{plane{y,0}} scale <1,0.5,1>} //
> makes the bottom flatter
>                 scale (1+rand(rd))
>                 translate
> <-LZ+(j/(NZ-1))*(2*LZ)+(0.5-rand(rd))*5,0,zC+rand(rd)+(0.5-rand(rd))*i*60>
>             }
>             #declare j=j+1;
>         #end
>         #declare i=i+1;
>         #declare NZ=NZ+i*2;
>         #declare LZ=LZ+4*i;
>     #end
>     translate y*4
> }
>
> sky_sphere{
>     pigment{
>         gradient y
>         poly_wave 0.1
>         color_map{
>             [0 color SkyBlue*2]
>             [1 color SkyBlue*0.3]
>         }
>     }
>     rotate x*2
> }
>
> fog{colCloud(SkyBlue,0.3,1,0) fog_type 2 distance 400 fog_alt 8}


Post a reply to this message

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