//Title:Bubbles travel into the sky
//Author: Masaaki Tsuji

#version 3.1; //specifying the version
#include "colors.inc" //including include files
#include "skies.inc"
#include "glass.inc"


//prepare the use of random numbers
#declare RandX = seed(12);
#declare RandY = seed(14);
#declare RandZ = seed(146);
#declare RandR = seed(7);

//defining a macro(indenpendent random number streams)
#macro Buble(RandX, RandY, RandZ, RandR)

//aquiring random numbers
#declare PointX = rand(RandX) * 10;
#declare PointY = rand(RandY) * 10;
#declare PointZ = rand(RandZ) * 10;
#declare Radius = rand(RandR);

//obtaining a primitive object
sphere{
<PointX,PointY,PointZ>,Radius //position and radius of the sphere decided by random numbers
texture{T_Glass3 //glass texture

//finishing the bubbles
finish{
irid{
0.8 //degree of rainbow color pattern effect
thickness 0.2 //thickness of the bubble skin
turbulence 1.0 //turbulence of the rainbow color pattern
}
}
}
}
#end

//global settings
global_settings {
assumed_gamma 2.2 //gamma correction, usually 2.2 for PC
max_trace_level 10 //maximum numbers of reflection and refraction
}

//camera
camera{
location<-2,-2,-2> //camera position
look_at<0,1,0> //where to look at
}

//sky sphere
sky_sphere {S_Cloud5}

//light source
light_source{
<10,10,10> //position of the light source
White //light color
}

//placing multiple objects using random numbers
#declare Cntr = 0; //counter
#while(Cntr < 20)

object{Buble(RandX, RandY, RandZ, RandR)}
//incrementing the Cntr value
#declare Cntr = Cntr + 1;

#end