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.

Nessun commento:

Posta un commento