domingo, 27 de diciembre de 2015

Configurar PovRay en Ubuntu

Configurar PovRay en Ubuntu

Una configuracion

Vamos a probar una configuracion por defecto, a partir de la instalacion mediante APT,

 sudo apt-get install povray* 
, instala los paquetes "povray-include, povray-examples, povray" version 3.7

 

Configurar el perfil y añadir variables de entorno

En el directorio $HOME se creara ".povray/{version}/" alli incluiremos el fichero povray.conf,que se encuentra en "/etc/povray/" , vemos que necesita la variable INSTALLDIR por defecto apunta a "/usr/share/povray-{version}/" tambien indicamos los directorios de Lectura/Escritura.

"/usr/share/povray/3.7/scripts", se encuentran scripts que permiten renderizar los ficheros .pov de una forma mas sencilla.

  
povray -h
povray: /home/david/.povray/3.7/povray.conf: 57: the user setting 'allowed' for [Shellout Security] is less restrictive than the system 'forbidden' setting in '/etc/povray/3.7/povray.conf': using system setting
Persistence of Vision(tm) Ray Tracer Version 3.7.0.unofficial (g++ 4.8 @
 i686-pc-linux-gnu)
export PATH=$PATH:/usr/share/povray-3.7/scripts  //añadir a .bashrc
cp /etc/povray/3.7/povray.conf ~/.povray/3.7/
 geany ~/.povray/3.7/povray.conf &
 mkdir .povray/3.7/in      
 cp /usr/share/doc/povray/examples/objects/* ~./povray/3.7/in/
 mkdir .povray/3.7/out
 sudo render_scene.sh  .povray/3.7/out   .povray/3.7/in/primitiv.pov  
 ll ~/.povray/3.7/out
 okular ~/.povray/3.7/out/primitiv.png &

En out obtenemos:

// This work is licensed under the Creative Commons Attribution 3.0 Unported License.
// To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/
// or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View,
// California, 94041, USA.

// Persistence Of Vision raytracer version 3.5 sample file.
//
// -w320 -h240
// -w800 -h600 +a0.3
#version 3.7;
global_settings { assumed_gamma 1.0 }
#default{ finish{ ambient 0.1 diffuse 0.9 }} 

#include "colors.inc"

#declare Radius =2.5;
#declare RowSpace=1.0;
#declare ColSpace=1.0;
#declare Dist=-1.25;
#declare Row3= 2;
#declare Row2=Row3+Radius*RowSpace*2;
#declare Row1=Row2+Radius*RowSpace*2;
#declare Col1= -Radius*ColSpace*3;
#declare Col2= Col1+Radius*ColSpace*2;
#declare Col3= Col2+Radius*ColSpace*2;
#declare Col4= Col3+Radius*ColSpace*2;
#declare Col5= Col4+Radius*ColSpace*2;

// perspective (default) camera
camera {
  location  <0.0, 5.0, -17.5>
  look_at   <0.0, 7.0,  0.0>
  right     x*image_width/image_height
  angle 65 
}
// create a regular point light source
light_source {
  0*x                  // light's position (translated below)
  color rgb <1,1,1>    // light's color
  translate <200, 500, -500>
}
 
//otro punto de luz
light_source {
  100*x                  // light's position 
  color rgb <1,0.5,0.2>    // light's color
  translate <25, 200, 200> //desplazamiento 
  
}

background { 
color rgb<0.1,0.1,0.1>
 
 } 

#declare ThisBlue = color rgb<0.1,0.5,0.8>; 

#declare Fade=
texture {
   pigment {
      gradient <1,1,0>
      color_map {
         [0.0 color ThisBlue]
         [0.3 color ThisBlue]
         [0.5 color Clear]
         [1.0 color Clear]
      }
      rotate z*45
   }
   finish {phong 1}
   scale 5
}

#declare Solid=
texture {
   pigment {ThisBlue}
   finish {phong 1}
}

bicubic_patch {
   type 1 flatness 0.01 u_steps 4 v_steps 4,
   <0, -1.5, 2>, <1, -1.5, 0>, <2, -1.5, 0>, <3, -1.5, -2>,
   <0, -0.5, 0>, <1, -0.5, 0>, <2, -0.5, 0>, <3, -0.5,  0>,
   <0,  0.5, 0>, <1,  0.5, 0>, <2,  0.5, 0>, <3,  0.5,  0>,
   <0,  1.5, 2>, <1,  1.5, 0>, <2,  1.5, 0>, <3,  1.5, -2>
   texture {Solid}
   rotate    -45*y
   translate 
}

blob {
   threshold 0.6
   component 1.0, 1.0, < 0.75,   0,       0>
   component 1.0, 1.0, <-0.375,  0.64952, 0>
   component 1.0, 1.0, <-0.375, -0.64952, 0>
   texture {Solid}
   translate 
}

box {
   <-1, -1, -1>, <1, 1, 1>
   texture {Solid}
   rotate <-25, 15, 0>
   translate 
}

cone {
   x,0.5,
   -x,1.0
   rotate  y*30
   texture {Solid}
   translate 
}

cylinder {
   x,-x,1.0
   rotate  y*30
   texture {Solid}
   translate 
}

...

plane {
   z, 0
   hollow on
   texture {Fade}
   clipped_by{box{<-1,-1,-1>,<1,1,1> scale 3}}
   translate 
}
...

quartic {
   //xxxx         xxyy    xxzz  -2(rr+RR)xx
   <1, 0, 0, 0, 2, 0, 0, 2, 0, -2.5,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

   //yyyy     yyzz  -2(rr-RR)yy
   1, 0, 0, 2, 0    1.5,     0, 0, 0,  0,

   //zzzz   -2(rr+RR)zz    (rr-RR)(rr-RR)
   1, 0,    -2.5,       0, 0.5625>
   texture {Solid}
   rotate -45*x
   translate 
}