// Tiled sphere examples // Copyright (C) 2003 Nicolas P. Rougier (rougier@loria.fr) // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // --------------------------------------------------------------------------- // Persistence of Vision Ray Tracer Scene Description File // File: sphere-1.pov // Vers: 3.5 // Desc: Macro for tiling objects on a sphere with regular spacing // Date: 08/2003 // Auth: Nicolas Rougier // Cmd : povray +Itiled-sphere.pov +w800 +h800 +fn +a0.1 +am2 +P // --------------------------------------------------------------------------- #version 3.5; #include "math.inc" #include "shapes.inc" // ======================================== // Notes // ======================================== // ======================================== // Switches // ======================================== #declare use_radiosity = on; // ======================================== // Settings // ======================================== global_settings { assumed_gamma 1.0 #if (use_radiosity) radiosity { pretrace_start 0.08 pretrace_end 0.02 count 400 error_bound 0.25 nearest_count 5 recursion_limit 1 low_error_factor .5 gray_threshold 0.0 minimum_reuse 0.015 brightness 1 adc_bailout 0.01/2 } #end } // ======================================== // Default settings // ======================================== #default { texture { #if (use_radiosity) finish { ambient 0.0 diffuse 1.0 } #else finish { ambient 0.1 diffuse 0.6 } #end } } // ======================================== // Lights // ======================================== light_source { <-5000, 14000, -10000> color rgb <1.0, 0.99, 0.98>*1 jitter adaptive 1 } // ======================================== // Camera // ======================================== #declare EyePos = <0, 0, -8>; #declare EyeLook = <0, 0, 0>; camera { location EyePos look_at EyeLook direction 1.5*z right x*image_width/image_height angle 30 } // ======================================== // Sky // ======================================== sky_sphere {pigment {rgb <0.6,0.7,1.0>}} // ======================================== // Spheric to cartesian conversion macro // (angle in degrees) // ======================================== #macro spheric_d (rho,theta,phi) #end // ===================================================== // Tile a sphere with object with regular spacing // "object" dimensions are taken from bounding box // ===================================================== // _size : Radius of the sphere // _object: Object to be used as tiles // _lshift: Control placement of object along lateral axis // _hdev : Standard deviation of altitude of object on the sphere // _msize : Mortar size as a percentage of object size // theta_start, theta_end, phi_start, phi_end: control sphere "completness" // _seed : any number you like #macro tiled_sphere (_size, _object, _msize, _lshift, _hdev, theta_start, theta_end, phi_start, phi_end, _seed) // Get size of the object #local Min = <0,0,0>; #local Max = <0,0,0>; Extents (_object, Min, Max) // Center the object #local _tile = object {_object translate -(Max-Min)/2} // Get size of the new centered object Extents (_tile, Min, Max) #local _tile_size = Max-Min; #local st = seed (_seed); #local shift = 0; #local theta = theta_start; #local theta_step = 360/(2*pi*_size/_tile_size.z); union { #while (theta < theta_end) #local ring_radius = _size*abs(sind(theta)); #local ring_perimeter = 2*pi*ring_radius; // Test to check if we are at the pole (where ring_perimeter could be null) #if (int (ring_perimeter/(_tile_size.x*2)) = 0) #local phi_step = 361; #else #local phi_step = 180 / int (ring_perimeter/(_tile_size.x*2)); #end #local shift = shift + _lshift; #local shift = shift - int(shift); #local phi = phi_start + shift*phi_step; #while (phi <= phi_end) object { _tile scale (1-_msize) translate y*(_size + _tile_size.y*_hdev*rand(st)) rotate pigment {rgb .75+.25*rand(st)} } #local phi = phi+phi_step; #end #local theta = theta+theta_step; #end } #end // ======================================== // Half a dome with a mis-aligment // ======================================== #declare tile_size = <0.05, .025, 0.025>*2; object { tiled_sphere (1, box {0,1 scale tile_size}, 0.05, 0.5, 0, 0, 90, 0, 180, 12345) rotate y*-45 } /* // ================================================ // Half a dome with aligment and square brick // ================================================ #declare tile_size = <0.025, .025, 0.025>*2; object { tiled_sphere (1, box {0,1 scale tile_size}, 0.05, 0.0, 0, 0, 90, 0, 180, 12345) rotate y*-45 } // ================================================ // Sphere with big bricks // ================================================ #declare tile_size = <0.05, .025, 0.025>*8; object { tiled_sphere (1, box {0,1 scale tile_size}, 0.05, 0.5, 0, 0, 180, 0, 360, 12345) rotate y*-45 } // ================================================ // Sphere with very long bricks // ================================================ #declare tile_size = <0.2, .025, 0.025>*2; object { tiled_sphere (1, box {0,1 scale tile_size}, 0.05, 0.5, 0, 0, 180, 0, 360, 12345) rotate y*-45 } // ======================================== // Small planet (quite long to render) // ======================================== #declare tile_size = <0.025, .5, 0.025>; object { tiled_sphere (1, box {0,1 scale tile_size}, 0.05, 0.5, .25, 0, 180, 0, 360, 12345) rotate -x*30 rotate -z*20 } */