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.


Nessun commento:

Posta un commento