// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 ======= 8 ======= 9 ======= 10 // Copyright 2001-2003 by Tor Olav Kristensen // Email: t o r . o l a v . k [_A_T_] g m a i l . c o m // http://subcube.com // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 ======= 8 ======= 9 ======= 10 #version 3.5; #include "colors.inc" #include "functions.inc" // For f_noise3d() and f_sphere() #include "rad_def.inc" global_settings { radiosity { Rad_Settings(Radiosity_OutdoorHQ, on, off) } } // This texture is "borrowed" from Gilles Tran and then modified a bit #declare GTexture = texture { pigment { bozo color_map { [ 0 color White*0.7 ] [ 1 color White*1.3 ] } } normal { agate 0.8 scale <1, 1, 1>*3 } finish { ambient color -0.3*White diffuse 0.8 specular 0.1 roughness 0.1 metallic brilliance 1 } scale <1, 1, 1>*0.5 } // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 ======= 8 ======= 9 ======= 10 // Macro for rotating a function about the X, Y and Z axis #macro RotateXYZ_Function(Fn, RotXAngleFn, RotYAngleFn, RotZAngleFn) #local RotZFn = function(x, y, z, CosZ, SinZ) { Fn( x*CosZ -y*SinZ, x*SinZ +y*CosZ, z ) } #local RotYFn = function(x, y, z, CosY, SinY, AngleZ) { RotZFn( x*CosY +z*SinY, y, -x*SinY +z*CosY, cos(AngleZ), sin(AngleZ) ) } #local RotXFn = function(x, y, z, CosX, SinX, AngleY, AngleZ) { RotYFn( x, y*CosX -z*SinX, y*SinX +z*CosX, cos(AngleY), sin(AngleY), AngleZ ) } #local TempFn = function(x, y, z, AngleX, AngleY, AngleZ) { RotXFn( x, y, z, cos(AngleX), sin(AngleX), AngleY, AngleZ ) } function { TempFn( x, y, z, RotXAngleFn(x, y, z), RotYAngleFn(x, y, z), RotZAngleFn(x, y, z) ) } #end // macro RotateXYZ_Function // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 ======= 8 ======= 9 ======= 10 // The isosurface functions #declare A = 4.0; // Frequency of noise #declare B = 1.0; // Amount of noise #declare C = 2.0; // Frequency of rotation #declare D = pi/6; // Amount of rotation #declare R = 2.1; // Sphere "radius" #declare NoiseFn = function { 0.5 - f_noise3d(x, y, z) } #declare NoisySphereFn = function { f_sphere(x, y, z, R + B*NoiseFn(A*x, A*y, A*z)) } #declare XAngleFn = function { D*NoiseFn(C*(x + 50), C*y, C*z) } #declare YAngleFn = function { D*NoiseFn(C*x, C*(y + 50), C*z) } #declare ZAngleFn = function { D*NoiseFn(C*x, C*y, C*(z + 50)) } object { isosurface { RotateXYZ_Function(NoisySphereFn, XAngleFn, YAngleFn, ZAngleFn) max_gradient 15 contained_by { sphere { <0, 0, 0>, R + B/2 } } } texture { GTexture } rotate 20*y } // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 ======= 8 ======= 9 ======= 10 sky_sphere { pigment { gradient y color_map { [ 0 color White ] [ 1 color rgb <0.52, 0.71, 1.09> ] } } } light_source { <-1, 6, 1>*200 color rgb <1.25, 1.08, 0.72> area_light 100*x, 100*z, 5, 5 circular orient jitter } camera { location <6.5, 4.1, -6.5> look_at <0, 0, 0> angle 45 } // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 ======= 8 ======= 9 ======= 10