sabato 21 marzo 2015

A simple way to create a dust whirpool

Here we show how to create a simple picture of a dust whirpool, using the scattering media materials generated by POV Ray.

#version 3.7;
global_settings{assumed_gamma 1.0}
#default{ finish{ ambient 0.1 diffuse 0.9 }}
//--------------------------------------------------------------------------
#include "colors.inc"
#include "textures.inc"
#include "glass.inc"
#include "metals.inc"
#include "golds.inc"
#include "stones.inc"
#include "woods.inc"
#include "shapes.inc"
#include "shapes2.inc"
#include "functions.inc"
#include "math.inc"
#include "transforms.inc"
//-------------------------------------------------------------------------------------------------------<<<<
//-------------------------------------------------------------------------------------------------------<<<<
// camera ------------------------------------------------------------------
#declare CAmera_posizione = < 0.00, 1.70,-5.50>;  // vista frontale
#declare Camera_guarda_a = < 0.00, 3.2, 0.00>;
#declare CAmera_angolo = 55 ; // in gradi
//--------------------------------------------------------------------------------------------------------<<<<
camera{ /*ultra_wide_angle*/  
        location CAmera_posizione
        right     x*image_width/image_height
        angle CAmera_angolo  
        look_at   Camera_guarda_a
      }
//------------------------------------------------------------------------------------------------------<<<<<
//------------------------------------------------------------------------------------------------------<<<<<

// sole ---------------------------------------------------------------------
light_source{<1500,2500,-2500> color White*0.85}          
// cielo ---------------------------------------------------------------------

sky_sphere { pigment { gradient <0,1,0>
                       color_map { [0.00 rgb <1.0,1.0,1.0>*0.5]
                                   [0.30 rgb <0.4,0.4,1.0>*0.5]
                                   [0.75 rgb <0.4,0.4,1.0>*0.5]
                                   [1.00 rgb <1.0,1.0,1.0>*0.5]
                                 }
                       scale 3        
                     }
           } //fine del cielo
// nebbia ---------------------------------------------------------------------
fog{fog_type   2
    distance   50
    color      White*0.5
    fog_offset 0.1
    fog_alt    2.0
    turbulence 0.8}

// terreno ------------------------------------------------------------------
plane{ <0,1,0>, 0
       texture{ pigment{ color rgb <1.00,0.95,0.85>*0.5} 
                normal { bumps 0.95 scale 0.025  }
                finish { phong 0.1 }
              } //fine della trama
     } // fine del piano

//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
//---------------------------- oggetto in scena ----------------------------
//--------------------------------------------------------------------------


// oggetto di diffusione della luce "tornado di polvere"

cylinder{ <0,0,0>,<0,100,0>,1.5
        pigment { rgbt 1 }
        hollow  

       interior{ //---------------------
          media{ scattering{ 1, <1,1,1> 
                             extinction  2.5 }
                 absorption rgb< 0.65, 0.89, 0.89>*2
                 // densità 1
                 density{ spiral2 8
                          turbulence 0.25
                          color_map {
                                [0.00 rgb 0.00] // bordo
                                [0.50 rgb 0.20] //
                                [1.00 rgb 1.00] // centro
                              } // fine della color_map 
                          rotate<90,0,0>
                          scale<1,0.5,1>
                        } // fine della densità 1
                 // densità 2
                 density{ cylindrical
                     turbulence 1.5
                     frequency 1
                       color_map {
                                [0.00 rgb 0.00] // bordo
                                [0.50 rgb 0.25] //
                                [0.85 rgb 1.00] //
                                [1.00 rgb 0.50] // centro
                              } // end color_map 
                     scale<1,1,1>
                     } // fine della densità 2
                
               }
            } // fine dell'interior


 rotate<0,0,-25>
 translate <   0.00, 0.15, 0.5>
}

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


Here is the picture generated by the code:

martedì 17 marzo 2015

How to create a rocky crater

In this post we will sho how to use the command height_field, to generate a rocky crater picture using POV Ray. First of all, a data picture have to be generated using greyscale and some tricks to have 2D for the crater.
Here is the code to generate the picture map.
#version 3.7;
global_settings { assumed_gamma 2.0 hf_gray_16 }


#include "colors.inc"

// piano colorato con pieghe

plane {z,10
 hollow on
 pigment{wrinkles
  color_map{
   [0 White*0.4]
   [1 White]
  }
 }
}

// Luce principale crea il cratere maggiore
light_source {0 color 1  spotlight point_at z*10
  radius 7 falloff 11
}

// Luce fioca addolcisce i bordi esterni del cratere
light_source {0 color .25  spotlight point_at z*10
  radius 2 falloff 15
}
                                                                      
// Luce stretta crea il picco centrale
light_source {0 color .3  spotlight point_at z*10
  radius 0 falloff 1.3
}

// Luce spot negativa crea interno del cratere
light_source {0 color -0.9  spotlight point_at z*10
  radius 5 falloff 9.5
}  

// Luce negativa stretta contrasta il luce del picco centrale
light_source {0 color -.25  spotlight point_at z*10
  radius 3 falloff 8
}
 //Luce spostata crea un secondo cratere
light_source {0 color 0.5  spotlight point_at z*10  translate <1,1.5,0> 
  radius 0.1 falloff 5
}


// Luce fioca negativa spostata crea interno del secondo cratere
light_source {0 color -0.30  spotlight point_at z*10 translate <1,1.5,0> 
  radius 0.2 falloff 2
}

light_source {0 color 0.5  spotlight point_at z*10 translate <-2,-1.5,0>
  radius 3 falloff 11
}

The picture generated by this code is below.





A second file is needed to generate the final 3D picture of the crater.
The code is below.
#version 3.7;
global_settings { assumed_gamma 1.5 }

#include "colors.inc"
#include "stones.inc"


camera{ location <0,14,-24>
        right     x*image_width/image_height
        direction z*5
        look_at 0
      }

light_source{<1000,2000,-2000> White}

height_field {
  "crater_dat.png" smooth
                  texture{ T_Stone1
                normal { agate 0.25 scale 0.10 rotate<0,0,0> }
                finish { phong 2 }
                rotate<0,0,0> scale 1.5 translate<0,0,0>
              } // end of texture



  translate <-.5, 0, -.5>
  scale <17, 1.75, 17>
}


Final picture obtained using the height_field command is this.


domenica 15 marzo 2015

Floating objects on sea

Here it is an example how to combine Isosurface command, and functions to create a picture of objects floating on the sea.
Please following the code below:
// POV-Ray 3.7 Scene File "Prova8.pov"
// author:  Max
// Date:   14/03/2015
//--------------------------------------------------------------------------
#version 3.7;
global_settings{ assumed_gamma 1.0 }
#default{ finish{ ambient 0.1 diffuse 0.9 }}
//--------------------------------------------------------------------------
#include "colors.inc"
#include "textures.inc"
#include "glass.inc"
#include "metals.inc"
#include "golds.inc"
#include "stones.inc"
#include "woods.inc"
#include "shapes.inc"
#include "shapes2.inc"
#include "functions.inc"
#include "math.inc"
#include "transforms.inc"
//--------------------------------------------------------------------------
// camera ------------------------------------------------------------------
#declare Camera_0 = camera {/*ultra_wide_angle*/ angle 75      // vista frontale
                            location  <0.0 , 3.0 ,-12.0>
                            right     x*image_width/image_height
                            look_at   <0.0 , 1.0 , 0.0>}

camera{Camera_0}

// sole ---------------------------------------------------------------------
light_source{<-2500,2500,-2500> color White}

// cielo ---------------------------------------------------------------------
plane{<0,2,0>,2 hollow 
       texture{ pigment{ bozo turbulence 0.95
                         color_map { [0.00 rgb <0.25, 0.30, 1.0>*0.7]
                                     [0.50 rgb <0.25, 0.30, 1.0>*0.7]
                                     [0.70 rgb <1,1,0.9>]
                                     [0.85 rgb <0.25,0.25,0.25>]
                                     [1.0 rgb <0.5,0.5,0.5>]}
                        scale<1,1,1.5>*2.5  translate< 0,0,0>
                       }
                finish {ambient 1 diffuse 0} }     
       scale 10000}

// nebbia sullo sfondo -------------------------------------------------
fog { fog_type   2
      distance   75
      color      White 
      fog_offset 0.1
      fog_alt    2.5
      turbulence 1.8
    }
// -------------------------------------------------------------------



//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
#declare Acqua_trama = texture{ Polished_Chrome }

// pigmento per la modulazione Isosurface
// e trama pigmento delle normali
#declare Pigmento_01 =
pigment { bumps  
          turbulence 0.17
          scale <2,1,1>
} // fine pigmento
//---------------------------------------
#declare Pigmento_funzione_01 =
function {
  pigment { Pigmento_01 }
} // fine della funzione
//---------------------------------------

// dimensioni x/z della scatola Isosurface
#local Scala_x = 20; 
#local Scala_z = 14;
#local Iso_inizio =<-Scala_x,-1.0,-Scala_z>;
#local Iso_fine   =< Scala_x, 1.0, Scala_z>;
//---------------------------------------
isosurface {

  function{
    y
   -Pigmento_funzione_01(x, y, z).gray* 0.92 
  } //

  contained_by { box {Iso_inizio,Iso_fine} }
  accuracy 0.01
  max_gradient 2

  texture{ Polished_Chrome
           normal { pigment_pattern {  Pigmento_01 } }
         }
  // non scalare la Isosurface!
  // scalare il Pigmento_01 se necessario! 
translate <0, -0.3, 0>
} // fine di isosurface ------------------------
//---------------------------------------------



difference{ // ci allontaniamo dalla trama del pigmento
 plane{<0,1,0>, 0 }
 box { Iso_inizio,Iso_fine  }
 texture{
    Acqua_trama 
    normal{
     pigment_pattern{ Pigmento_01 }, 5}
          }
     translate<0,0.0,0>
     }

//cornice di legno
difference{
box{ <-7.00,-1.00, 0.00>,< 0.00, 0.50, 7.00> } 
box{ <-6.70,-1.11, 0.50>,<-0.50, 0.61, 6.70> } 

     texture { T_Wood1
               finish { phong 1 }
             } // end of texture

     rotate<0,45,0> translate<0,0,-5>
   } // fine della cornice  ---------------------------


//sfera galleggiante
 sphere { <0,0.2,0>, 1

        texture { T_Wood3
                  finish { phong 1.0 reflection 0.01}
                }

          scale<1,1,1>   
       }  // fine della sfera -----------------------------------


Here is the picture generated by the code.

sabato 14 marzo 2015

Water pool raytraced

In this post, we will show how to generate a water pool using POV Ray, and how to create a relistic wave effect on the pool water using the Isosurface command line.
Here is the code for POV Ray file:
// POV-Ray 3.7 Scene File "Prova7.pov"   basato su woodbox
// author:  Max
// Date:   14/03/2015
//--------------------------------------------------------------------------
#version 3.7;
global_settings{ assumed_gamma 1.0 }
#default{ finish{ ambient 0.1 diffuse 0.9 }}
//--------------------------------------------------------------------------
#include "colors.inc"
#include "textures.inc"
#include "glass.inc"
#include "metals.inc"
#include "golds.inc"
#include "stones.inc"
#include "woods.inc"
#include "shapes.inc"
#include "shapes2.inc"
#include "functions.inc"
#include "math.inc"
#include "transforms.inc"
//--------------------------------------------------------------------------
// camera ------------------------------------------------------------------
#declare Camera_0 = camera {/*ultra_wide_angle*/ angle 75      // vista frontale
                            location  <0.0 , 2.0 ,-8.0>
                            right     x*image_width/image_height
                            look_at   <0.0 , -1.0, 0.0>}
#declare Camera_1 = camera {/*ultra_wide_angle*/ angle 70   // vista diagonale
                            location  <4.0 , 7.5 ,-5.0>
                            right     x*image_width/image_height
                            look_at   <1.0 , 0.0 , -2.5>}
#declare Camera_2 = camera {/*ultra_wide_angle*/ angle 90 // vista lato destro
                            location  <4.0 , 1.0 , 0.0>
                            right     x*image_width/image_height
                            look_at   <0.0 , 0.0 , 0.0>}
#declare Camera_3 = camera {/*ultra_wide_angle*/ angle 40        // vista dall'alto
                            location  <0.0 , 20.0 ,-2.00-0.001>
                            right     x*image_width/image_height
                            look_at   <0.0 , 1.0 , -2.00>}
camera{ Camera_0 }

// sole ---------------------------------------------------------------------
light_source{<-3500,2000,-1500> color rgb<1,0.85,0.85> }

// cielo ---------------------------------------------------------------------
plane{<0,2,0>,2 hollow 
       texture{ pigment{ bozo turbulence 0.95
                         color_map { [0.00 rgb <0.25, 0.32, 1.0>*0.8]
                                     [0.50 rgb <0.25, 0.32, 1.0>*0.8]
                                     [0.70 rgb <1,1,1>]
                                     [0.85 rgb <0.25,0.25,0.25>]
                                     [1.0 rgb <0.5,0.5,0.5>]}
                        scale<1,1,1.5>*2.5  translate<-2,0,0>
                       }
                finish {ambient 1 diffuse 0} }     
       scale 10000}

// nebbia sul terreno -------------------------------------------------
fog { fog_type   2
      distance   75
      color      White 
      fog_offset 0.1
      fog_alt    2.5
      turbulence 1.8
    }
//---------------------------------------------
//----------------------------- Piscina trama
#declare Piscina_Tex =
          texture{ T_Wood4
            finish { specular 0.25 roughness 0.115 ambient 0.2 }
                  
                 } // fine della trama

//---------------------------------------------
//----------------------------- Piscina dimensioni
#declare Piscina_X = 5.00;
#declare Piscina_Y = 2.00;
#declare Piscina_Z = 8.00;
#declare Piscina_Interno_Size = <5,-2,8>;
#declare Bordo = 0.30; 

//---------------------------------------------
#declare Piscina_Transformation =
  transform{ rotate<0,0,0>
             translate<-2.5,0.10,-6>
           } // fine della trasformazione
//---------------------------------------------
#declare Piscina_Interno =
  box{<0,-Piscina_Y,0>,<Piscina_X,Piscina_Y,Piscina_Z>  
     } //--------------------------------------
#declare Piscina_Esterno =
  box{<-Bordo, -Piscina_Y-0.01, -Bordo> ,
      <Piscina_X+Bordo,0.001,Piscina_Z+Bordo>
     } //--------------------------------------
//---------------------------------------------
#declare Piscina =
difference{
 object{ Piscina_Esterno texture{Piscina_Tex}}
 object{ Piscina_Interno texture{Piscina_Tex}}
} // fine della differenza
//--------------------------------------------- 

// terreno erboso
difference{
 plane{ <0,1,0>, 0
        texture{
         pigment{ color rgb<0.35,0.65,0>*0.7}
         normal { bumps 0.75 scale 0.015 }
         finish { phong 0.1 }
        } // fine della trama   
      }// fine del piano
 object{ Piscina_Esterno 
        texture{ Piscina_Tex }
         transform Piscina_Transformation
       } // buco della piscina
} // fine del terreno
//---------------------------------------
//---------------------------------------
// Mettere la piscina:
object{ Piscina
        transform Piscina_Transformation }  
//---------------------------------------  
//---------------------------------------  

// acqua trasparente //-------------
#declare Acqua_materiale = 
material{   
 texture{
   pigment{ rgbf <0.92,0.99,0.96,0.45> }
   finish { diffuse 0.1 reflection 0.3 
            specular 0.8 roughness 0.0003
            phong 1 phong_size 400}
 } // fine della trama --------------------
 interior{ ior 1.3 caustics 0.15 
 } // fine di interior -------------------
} // fine del materiale --------------------

//---------------------------------------
// modulazione del materiale Pigmento 
#declare Pigment_01 = 
 pigment{ bumps
          turbulence 0.30
          scale <3,1,3>*0.12
          translate<1,0,0>
 } // fine del pigmento
//---------------------------------------
#declare Pigment_Function_01 =
function {
  pigment { Pigment_01 }
} // fine della funzione
//---------------------------------------
// modulazione della funzione pigmento

isosurface {
 function{
   y
   +Pigment_Function_01(x,y,z).gray*0.2 
 } //
 contained_by{
   box{<-Bordo,-Piscina_Y-1.01,-Bordo>,
       < Piscina_X+Bordo,1, Piscina_Z+Bordo>
      } //
    } // fine di contained_by
 accuracy 0.01
 max_gradient 2
 material{ Acqua_materiale }

 // scalare the Pigment_01 se necessario! 
 transform  Piscina_Transformation 
} // fine di isosurface ------------------
Here is the picture resulted from the file:


sabato 7 marzo 2015

A whole scene example

This is another example of a whole scene constructed with POV Ray, the picture is based on the woodbox.pov file; has been recreated modifing position and other charactheristic of the example.

// POV-Ray 3.7 Scene File "Prova6.pov"   basato su woodbox
// author:  Max
// Date:   07/03/2015

#version 3.7;
global_settings { assumed_gamma 1.2 }

#include "colors.inc"
#include "textures.inc"
#include "shapes.inc"
#include "metals.inc"
#include "glass.inc"
#include "woods.inc"

camera {
   location <-5, 22, -26.5>
   angle 45
   right x*image_width/image_height
   look_at <0,0,0>
}


#declare Dist=80.0;
light_source {< -50, 25, -50> color White
     fade_distance Dist fade_power 2
  area_light <-40, 0, -40>, <40, 0, 40>, 3, 3
   adaptive 2
   jitter
}
light_source {< 50, 10,  -4> color Gray30
     fade_distance Dist fade_power 2
  area_light <-20, 0, -20>, <20, 0, 20>, 3, 3
   adaptive 1
  jitter
}
light_source {< 0, 200,  0> color Gray30
     fade_distance Dist fade_power 1
        area_light <-30, 0, -30>, <30, 0, 30>, 3, 3
        adaptive 1
        jitter
}

sky_sphere {
    pigment {
        gradient y
        color_map {
            [0, 1  color Gray60 color Gray80]
        }
    }
}

#declare M_Legno18b =
colour_map {
    [0.00 0.35   color rgbf < 0.50, 0.26, 0.12, 0.10>
                 color rgbf < 0.54, 0.29, 0.13, 0.20>]
    [0.35 0.45   color rgbf < 0.54, 0.29, 0.13, 0.20>
                 color rgbf < 0.55, 0.28, 0.10, 0.70>]
    [0.45 0.50   color rgbf < 0.55, 0.28, 0.10, 0.70>
                 color rgbf < 0.50, 0.23, 0.15, 0.95>]
    [0.50 0.70   color rgbf < 0.50, 0.23, 0.15, 0.95>
                 color rgbf < 0.56, 0.29, 0.17, 0.70>]
    [0.70 0.95   color rgbf < 0.56, 0.29, 0.17, 0.70>
                 color rgbf < 0.54, 0.29, 0.13, 0.20>]
    [0.95 1.00   color rgbf < 0.54, 0.29, 0.13, 0.20>
                 color rgbf < 0.50, 0.26, 0.12, 0.10>]
}


#declare Trama_pavimento =
    texture { pigment { P_WoodGrain18A color_map { M_Wood18A }}}
    texture { pigment { P_WoodGrain12A color_map { M_Legno18b }}}
    texture {
        pigment { P_WoodGrain12B color_map { M_Legno18b }}
        finish { reflection 0.25 }
    }

#declare Pavimento =
plane { y,0
    texture { Trama_pavimento
        scale 2.5
        rotate y*90
        rotate <10, 0, 15>
        translate z*4
    }
}

#declare T0 = texture { T_Wood15 }

#declare T =
texture { T0
    finish { specular 0.50 roughness 0.1 ambient 0.25 }
}

#declare T1 = texture { T translate  x*10 rotate <0, 87, 0> }
#declare T2 = texture { T translate  y*10 rotate <0,  1, 0> }
#declare T3 = texture { T translate -x*10 rotate  <0, 90, 0> translate z*10}

#declare Pannello_frontale =
box      { <-5.75, 0.00, -0.5>,
           < 5.75, 1.75,  0.0> }

#declare Bordo_fronte_alto   =
cylinder { <-5.75, 1.75,  0.0>,
           < 5.75, 1.75,  0.0>, 0.5 }

#declare Bordo_fronte_destro =
cylinder { < 5.75, 0.00,  0.0>,
           < 5.75, 1.75,  0.0>, 0.5 }

#declare Bordo_fronte_sinistro  =
cylinder { <-5.75, 0.00,  0.0>,
           <-5.75, 1.75,  0.0>, 0.5 }

#declare Angolo_as_fronte  = sphere   { <-5.75, 1.75,  0.0>, 0.5 }
#declare Angolo_ad_fronte  = sphere   { < 5.75, 1.75,  0.0>, 0.5 }


#declare Pannello_sinistro      = box { <-0.50, 0, -5.75>, <0.50, 1.75, 5.75> }
#declare Bordo_sinistro_alto   = cylinder { <0, 1.75, -5.75>, <0, 1.75, 5.75>, 0.5 }

#declare Parte_sinistra =
intersection {
    union {
        object { Pannello_sinistro       }
        object { Bordo_sinistro_alto    }
    }
    plane { x, 0 }
    texture { T2 scale 2.5}
    bounded_by { box { <-0.501, 0.01, -5.251>, <0.01, 2.251, 5.251> } }
}

#declare Fronte_scatola =
intersection {
    union {
        object { Pannello_frontale      }
        object { Bordo_fronte_alto   }
        object { Bordo_fronte_sinistro  }
        object { Bordo_fronte_destro }
        object { Angolo_as_fronte  }
        object { Angolo_ad_fronte  }
    }
    plane { z, 0 }
    texture { T1 scale 2.5}
    bounded_by { box { <-6.251, 0.01, -0.51>, <6.251, 2.251,  0.01> }}
}
#declare Fondo_scatola = box {<-5.75, 0.0, -5.75> <5.75, 0.25, 5.75> texture {T3} }
#declare Coperchio_scatola =    box {<-5.75, 0.0, -5.75> <5.75, 0.25, 5.75>
    translate -5.25*z    // mette il fulcro nell'origine
    rotate x*35          // apre il coperchio
    translate 5.25*z     // muove il fulcro indietro e
    translate y*2        //sposta in alto
    texture {T3 scale 2.5}
}
#declare Scatola =
union {
    object { Fronte_scatola translate -z*5.25}
    object { Fronte_scatola scale <1,1,-1> translate z*5.25}
    object { Parte_sinistra translate -x*5.75 }
    object { Parte_sinistra scale <-1,1,1> translate x*5.75 }
    object { Coperchio_scatola  }
    object { Fondo_scatola }
}
#declare Sfere =
union {

    // Nella scatola
    sphere { <1.5, 1.5, -0.75>, 1.25
        texture {
            T_Wood14
            finish { specular 0.35 roughness 0.05 ambient 0.3 }
            translate x*1
            rotate <15, 10, 0>
            translate y*2
        }
    }
    // Nella scatola
    sphere { <-1.5, 1.25,  0.5>, 1
        texture { T_Wood18
            finish { specular 0.25 roughness 0.025 ambient 0.35 }
            scale 0.33
            translate x*1
            rotate <10, 20, 30>
            translate y*10
        }
    }
    // Nella scatola
    sphere { <-0.75, 1.0, -1.5>, 0.75
        texture { T_Wood10
            finish { specular 0.5 roughness 0.1 ambient 0.35 }
            translate x*1
            rotate <30, 10, 20>
        }
    }

    // Fuori dalla scatola
    sphere { <-0.75, 0.75, -7.5>, 0.75
        texture { T_Wood4
            finish { specular 0.25 roughness 0.115 ambient 0.2 }
        }
    }
    // Fuori dalla scatola
    sphere { <-2.25, 0.45, -7.5>, 0.45
        texture { T_Wood20
            finish { specular 0.15 roughness 0.15 ambient 0.3 }
            rotate <45, 10, 45>
            translate x*10
        }
    }

    // Fuori dalla scatola
    sphere { <-7.5, 0.95, 0.8>, 0.95
    
      material {
        texture {
          pigment { color rgbf <0.98, 1.0, 0.99, 0.75> }
          finish { F_Glass4 }
          }
        interior {I_Glass caustics 1}
        }
      }
    // Fuori dalla scatola 
    sphere { <-15.5, 0.95, 0.8>, 1.2
      material {
        texture {
          pigment { color rgbf <0.98, 1.0, 0.99, 0.75> }
          finish { F_Glass4 }
          }
        interior {I_Glass caustics 1}
        }
      } 
    // Fuori dalla scatola
    sphere { <-7.00, 0.75, -2.0>, 0.75 texture { T_Copper_2B} }
    // Fuori dalla scatola
    sphere { <-1.75, 0.40, -7.4>, 0.40 texture { T_Brass_3B} }
}
union {
    object { Pavimento }
    object { Scatola }
    object { Sfere }
    rotate -y*45
}


Here the picture generated.

domenica 1 marzo 2015

Vortex simulation

How to create a simple vortex on POV Ray, using the instruction union and difference.
// POV-Ray 3.7 Scene File "Prova4.pov"
// author:  Max
// Date:   01/03/2015
//--------------------------------------------------------------------------
#if (version < 3.7) global_settings{ assumed_gamma 1.0 } #end
//--------------------------------------------------------------------------
#include "colors.inc"
#include "textures.inc"
//--------------------------------------------------------------------------
// camera ------------------------------------------------------------------
#declare Camera_0 = camera {ultra_wide_angle angle 65          // vista frontale
                            location  <0.0 , 3.0 ,-3.5>
                            right     x*image_width/image_height
                            look_at   <0.0 ,-0.5 , 0.0>}
camera{Camera_0}

// sole ---------------------------------------------------------------------
light_source{<1500,3000,-3000> color White}
// cielo ---------------------------------------------------------------------
plane{<0,1,0>,1 hollow no_shadow
       texture{ pigment{ Bright_Blue_Sky scale 1
                        }
                finish {ambient 1 diffuse 0} }     
       scale 10000}
// nebbia ---------------------------------------------------------------------

fog{fog_type   2
    distance   20
    color      rgb<1,0.98,0.9>
    fog_offset 0.1
    fog_alt   1
    turbulence 0.8}
 
   
// terreno ------------------------------------------------------------------
// dimensioni del foro:
#declare ForointernoR = 1.00;
#declare Foroscala  = 1.25;
#declare ForoR      = 0.75;

//-------------------------
// piano forato:
union{
difference{

plane{<0,1,0>, 0 }
cylinder{<0,-ForoR,0>, <0,0.001,0>,ForointernoR+ForoR scale Foroscala}
cylinder{<0,  -100,0>, <0,0.001,0>,ForointernoR scale Foroscala}
          } // fine della differenza
         
torus{ ForointernoR+ForoR, ForoR
       translate<0,-ForoR,0>scale Foroscala}

 texture{Polished_Chrome 
         normal {spiral1  20  0.25  sine_wave   
                 turbulence 0.1 rotate<90,0,0> scale <0.25,0.5,0.25> }
         finish {ambient 0.15 diffuse 0.85 reflection 0.35}}
 } // fine dell'unione 

 //sfera sospesa
 sphere { <0,-ForoR,0>, ForoR/3

        texture { pigment{ color rgb<0.75, 0.75, 0.75>}
                  finish { phong 1.0 reflection 0.01}
                }

          scale<1,1,1>  rotate<0,0,0>  translate<0,0.5,0> 
       }  // fine della sfera -----------------------------------

//-----------------------------------------------------------------------fine

Here the picture obtained from the program written above.

A simple water scene

Here are some instruction how to create a flat water surface with a blue sky. The water effect is only simulated, no real waves are created by this code.

// POV-Ray 3.6 Scene File "Prova2.pov"
// created Max
// date:    01/03/2015

#include "colors.inc"
#include "textures.inc"
#include "textures.inc"

global_settings { assumed_gamma 1.1 }

// telecamera -----------------------------------------------------------
#declare Cam0 = camera {/*ultra_wide_angle*/ angle 65
                        location  <0.0 , 1.0 ,-3.0>
                        look_at   <0.0 , 0.8 , 0.0>}
camera{Cam0}

// sole ---------------------------------------------------------------
light_source{<1500,3000,-2500> color White}

// nebbia ---------------------------------------------------------------
fog{fog_type   2   distance 85  color rgb<1,0.99,0.9>
    fog_offset 0.1 fog_alt  2.0 turbulence 0.2}
   
// cielo ---------------------------------------------------------------------
plane{<0,1,0>,1 hollow 
       texture{ pigment{ bozo turbulence 0.99
                         color_map { [0.5 rgb <0.30, 0.30, 1.0>*1]
                                     [0.6 rgb <1,1,0.9>]
                                     [1.0 rgb <0.2,0.2,0.2>]}
                         scale 3.5 translate<10,0,9>
                       }
                finish {ambient 1 diffuse 0} }     
       scale 10000}
//--------------------------------------------------------------------------
  

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

plane{<0,1,0>, 0
      texture{pigment{ rgb <0.2, 0.2, 0.2> }
              normal { bumps 0.18 scale <1,0.25,0.35>*1 turbulence 0.8 }
              finish { ambient 0.05 diffuse 0.55
                       brilliance 6.0 phong 0.8 phong_size 120
                       reflection 0.6 }
             }
     }
//--------------------------------------------------------------------
#declare Asta_H = 1.75;
#declare Asta_R = 0.20;
#declare Asta =   // Oggetto      
union{

 cylinder {<0,-Asta_H,0>,<0,Asta_H,0>,Asta_R translate<0,0,0>
          texture{pigment{spiral1 2
                          color_map{[0.0 White]
                                    [0.5 White]
                                    [0.5 rgb<1,0.5,0>]
                                    [1.0 rgb<1,0.5,0>]}
                                    rotate<90,0,0>
                                    scale<1,0.3,1>}
                  normal {bumps 0.3 scale 0.025}
                  finish {ambient 0.05 diffuse 0.95
                          phong 1 reflection 0.05}
                  }
           }
 union{
   cylinder{<0,-0.05,0>,<0,0.05,0>,Asta_R+0.05 translate<0,Asta_H.0>}
   sphere {<0,0,0>,Asta_R+0.05 translate<0,Asta_H+0.1,0> }
   torus {1.0,0.1 scale 0.12  translate<0,Asta_H+0.01,0>}
      
   texture{pigment{color White}
           normal {bumps 0.3 scale 0.025}
           finish {ambient 0.15 diffuse 0.85 phong 1 reflection 0.05}}}
}// fine di Asta --------  

//---------------------------------------------------------------------
object{Asta scale 1 rotate<0,0,2> translate <-1.0,0,3>}     
          
//----------------------------------------------------------------- fine