|
|
// Sphere_pack.pov
// ---------------
//
// This file contains a macro to produce a spherical
// surface of relatively evenly packed spheres.
//
// Author: Mike Andrews, 6th Sep 2001
//
// Note: this needs MegaPov or v3.5
// #version unofficial MegaPov 0.7;
global_settings {
max_trace_level 20
assumed_gamma 1
ambient_light 1
#if(1)
// ini_option "+QR"
radiosity {
pretrace_start 16/image_width
pretrace_end 4/image_width
count 50
error_bound 0.1
recursion_limit 1
normal on
}
#end
}
#declare BC = <pow(7/4,-4),pow(7/5.5,-4),1>;
sky_sphere { pigment { gradient y colour_map {[0 color rgb 0.5*(1+BC)][1
rgb 0.5*BC]} } }
fog {
fog_type 2
colour rgb BC*0.3
distance 100
fog_alt 6
fog_offset -7
}
fog {
fog_type 2
colour rgb (1-BC)*0.5
distance 500
fog_alt 15
fog_offset -7
}
camera {
up y
right x*image_width/image_height
direction 2*z
location <-1,1.5,-10>*5
look_at 0
}
light_source {
0*x
color rgb 1-0.1*BC
translate 50*vnormalize(<1,2,-2>)
scale 400
}
#macro sep_tex (Th, Ph)
texture {
pigment { rgb vaxis_rotate(<0.7,0.4,0.3>, 1, Th) }
finish { ambient 0 diffuse 0.7 specular 1 metallic }
}
#end
#macro Pack_Sphere (nSph, bigRad, smallRad, Offset, useSepTex, resetTh)
#local Phi = (sqrt(5)-1)/2;
#local Mix = 1/sqrt(3);
#if (resetTh) #declare TH = 0; #end
#local maxC = nSph;
#if (smallRad < 0)
#local Rad2 = -smallRad*2*bigRad/sqrt(maxC);
#else
#local Rad2 = smallRad;
#end
#local Rad1 = bigRad + Offset*Rad2;
union {
#local Count = 0.5; #while (Count <= maxC)
#local F = Count/maxC;
#local PH = 180*(Mix*(sqrt(F)*(1-F) - F*sqrt(1-F)) + F);
#local P = vrotate(Rad1*y, <PH, TH, 0>);
sphere { P, Rad2 #if (useSepTex) sep_tex(TH, PH) #end }
#declare TH = mod(TH + 360*Phi, 360);
#local Count = Count + 1; #end
}
#end
#declare TH = 0;
object {
Pack_Sphere(8000, 10, -1, -1, true, false)
rotate -70*x
translate -<10,4,-3>
}
object {
Pack_Sphere(800, 6, -1, -1, true, false)
rotate 30*x
translate <6,3,0>
}
object {
Pack_Sphere(80, 3, -1, -1, true, false)
rotate <0,120,90>
translate <8,-7,-2>
}
// end of Sphere_pack.pov
Post a reply to this message
|
|