.
On the left, a sphere is given an apparently bumpy surface by using POV-Ray's internal "agate" function to create a bump map (the agate function defines a value for each point in 3D space). This changes the way light is calculated to reflect from the surface of the sphere without actually changing the sphere's size or shape. The outline of the sphere and the shadow on the ground are therefore those of a perfect, non-bumpy sphere. An unrealistic hard shadow is also visible on the surface of the sphere, about a third of the way from the top.
On the right, a sphere with a bumpy surface is actually modelled by calculating an w:isosurface for a sphere function modified by the agate function (the agate function is subtracted from a function defining a sphere, x2+y2+z2-Radius2, and all points in space where this sum is zero form the surface of the resulting object). This results in an actual modification in the size and shape of the sphere. The outline of the sphere and the shadow on the ground are therefore also changed. The shadowing on the surface of the sphere is also more realistic.
#version 3.6;
#declare rad=1;
global_settings {
assumed_gamma 1.0
ambient_light 0
#if (rad)
radiosity {
pretrace_start 0.08 // start pretrace at this size
pretrace_end 0.04 // end pretrace at this size
count 35 // higher -> higher quality (1..1600) [35]
nearest_count 5 // higher -> higher quality (1..10) [5]
error_bound 1.8 // higher -> smoother, less accurate [1.8]
recursion_limit 3 // how much interreflections are calculated (1..5+) [3]
low_error_factor .5 // reduce error_bound during last pretrace step
gray_threshold 0.0 // increase for weakening colors (0..1) [0]
minimum_reuse 0.015 // reuse of old radiosity samples [0.015]
brightness .4 // brightness of radiosity effects (0..1) [1]
adc_bailout 0.01/2
normal on // take surface normals into account [off]
media off // take media into account [off]
always_sample on // turn sampling in final trace off [on]
max_sample 1.0 // maximum brightness of samples
}
#end
}
// ----------------------------------------
camera {
location <0.0, 2.25, -7>
direction 1*z
angle 48
right x*image_width/image_height
look_at <0.0, 0, -1.5>
}
light_source { <6, 2.5, -6> color rgb <1, 1, 1>*.3
area_light <1,0,0>,<0,0,1> #if(rad)2,2 #else 2,2 #end orient circular
}
light_source { <-9, 7.5, -6> color rgb <1, 1, 1>*.5
area_light <3,0,0>,<0,0,3> #if(rad)5,5 #else 2,2 #end orient circular
}
light_source { <0, 100, 80> color rgb <1, 1, 1> area_light <1,0,0>,<0,0,1> #if(rad)2,2 #else 2,2 #end orient circular}
// ----------------------------------------
box{<-35,-2,-3>,<35,-1,38>
pigment { color rgb 1 }
finish {ambient 0}
}
#declare mytex=texture{pigment { bozo
colour_map{
[0 colour rgb <.3,.1,.05> ]
[0.25 colour rgb <.32,.08,.06> ]
[0.5 colour rgb <.3,.1,.05> ]
[.75 colour rgb <.28,.12,.04> ]
[1 colour rgb <.3,.1,.05> ]
}
scale .15
turbulence 2.75
}
finish{ specular 0.1 roughness .0075 diffuse .70 ambient 0 reflection 0.0}}
#include "functions.inc"
#declare function2=function{f_agate(x/.5,y/.5,z/.5)*.1}
#declare function3=function(x,y,z,Radius,xoff,yoff,zoff){pow(x-xoff,2)+pow(y-yoff,2)+pow(z-zoff,2)-pow(Radius,2)}
#declare ball=
isosurface {
function {function3(x,y,z,1,0,0,0)-function2(x,y,z)*1} //.71
max_gradient 8
contained_by { sphere { 0, 1.5 } }
texture {mytex}
translate x*1.5
}
object{ball translate <0,0,0> }
sphere { 0, 1
texture {
mytex
//normal{bozo scale .5}
normal {function {function2(x,y,z)*10*.25} accuracy .0002 bump_size 1.5}
}
rotate -y*32
translate -x*1.5
}