// Based on work 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 // http://hof.povray.org/Riemann_Sphere-Isosurface.html // // Except the formula for the isosurface, all other things are made by Clodo (www.clodo.it). #version 3.7; #include "colors.inc" #include "functions.inc" // For f_r() and f_sphere() #include "rad_def.inc" #include "textures.inc" #include "stars.inc" #include "skies.inc" #declare myMode = 2; // 0: Animation, 1...n Shots #declare myClock = frame_number/600; #declare smoothClock = (sin(myClock*pi-pi/2)+1)/2; #if(myMode=0) #declare K = max(-sin(smoothClock*2*pi)*3,1); #declare max_grad = 2.5; #declare NrOfBands = 4; #declare MyPigment = pigment { gradient x+y color_map { [0.75 rgbf <1.0, 0.5, 0.0, 0.0>] [0.75 rgbf <1.0, 1.0, 1.0, 1.0>] [0.75 rgbf <1.0, 1.0, 1.0, 1.0>] [0.75 rgbf <1.0, 0.5, 0.0, 0.0>] } } #end #if(myMode=1) #declare K = 1.5; #declare max_grad = 2; #declare NrOfBands = 4; #declare MyPigment = pigment { Green } #end #if(myMode=2) #declare K = 0.1; #declare max_grad = 75; #declare NrOfBands = 1; #declare MyPigment = pigment { Red } #end #if(myMode=3) #declare K = 0.5; #declare max_grad = 2; #declare NrOfBands = 4; #declare MyPigment = pigment { Blue } #end #if(myMode=4) #declare K = 1.9; #declare max_grad = 2; #declare NrOfBands = 12; #declare MyPigment = pigment { Black } #end // global_settings { radiosity { Rad_Settings(Radiosity_OutdoorHQ, on, off) } } global_settings { ambient_light rgb<1,1,1> max_trace_level 100} #declare Nihil = 1E-10; #macro SphereSpiralsFunction(Rmaj, Rmin, TwistFn, NrOfBands, GapRatio, ClodoDelta) #local TwoPi = 2*pi; #local FourPi = 2*TwoPi; #local DivAngle = TwoPi/NrOfBands; #local GapAngle = DivAngle*GapRatio; #local HalfGapAngle = GapAngle/2; #local AdjFn = function(A) { A + select(A, FourPi, TwoPi) } #local TempFn = function(x, y, z, Theta, ModAngle, RR) { select( ModAngle - GapAngle, select( ModAngle - HalfGapAngle, f_sphere( x - RR*f_r(x, 0, z)*cos(Theta - ModAngle), y - RR*y, z - RR*f_r(x, 0, z)*sin(Theta - ModAngle), Rmin ), f_sphere( x - RR*f_r(x, 0, z)*cos(Theta - ModAngle + GapAngle), y - RR*y, z - RR*f_r(x, 0, z)*sin(Theta - ModAngle + GapAngle), Rmin ) ), abs(f_sphere(x, y, z, Rmaj)) - Rmin ) } function { TempFn( x, y, z, atan2(z, x), mod(AdjFn(atan2(z, x) - TwistFn(x, y, z)), DivAngle), Rmaj/(Nihil + f_r(x, y, z)) ) } #end // macro SphereSpiralsFunction #declare NegOne = Nihil - 1; #declare PosOne = 1 - Nihil; #declare ClampFn = function(N, Min, Max) { max(Min, min(N, Max)) } #declare Rmajor = 1.5*2; #declare Rminor = 0.2; #declare GapSize = 0.5; #declare Rmajor2 = 1.51*2; #declare Rminor2 = 0.2; #declare GapSize2 = 0.7; #declare LogFn = function(A) { ln(2/(1 - A) - 1)/K } #declare yFn = function { LogFn(ClampFn(y/(Nihil + f_r(x, y, z)), NegOne, PosOne)) } isosurface { SphereSpiralsFunction(Rmajor, Rminor, yFn, NrOfBands, GapSize,0) max_gradient max_grad contained_by { sphere { <0, 0, 0>, Rmajor + Rminor } } rotate 110*x texture {Chrome_Texture} finish {reflection {0.9} metallic} } isosurface { SphereSpiralsFunction(Rmajor2, Rminor2, yFn, NrOfBands, GapSize2,0) max_gradient max_grad contained_by { sphere { <0, 0, 0>, Rmajor2 + Rminor2 } } rotate 8.1*y rotate 110*x texture {MyPigment} finish {reflection {0.4}} normal { gradient x // this is the PATTERN_TYPE slope_map { [0 <0.5, 1>] // start in middle and slope up [0.25 <1.0, 0>] // flat slope at top of wave [0.5 <0.5,-1>] // slope down at mid point [0.75 <0.0, 0>] // flat slope at bottom [1 <0.5, 1>] // finish in middle and slope up } } } #declare BoxCount=0; #while (BoxCount < 12) box { <-4,0,-1>, <4,15,+1> rotate 360/12*BoxCount * y translate pigment {Black} finish { ambient Black diffuse 0.8 reflection {0.1}} } #declare BoxCount=BoxCount+1; #end plane { y, -(Rmajor + Rminor + 0) pigment { checker pigment{White}, pigment{Gray} } finish {reflection {0.4}} } sky_sphere { S_Cloud5 } #declare lightIntensity = 1.0; light_source { <34, 29, -16>*4 color rgb area_light 2*x, 2*z, 4, 4 circular orient adaptive 1 jitter } #declare distanceCam = Rmajor + 0.1 + smoothClock*6; #declare cameraRotationClock = smoothClock + 1/24; camera { #if(myMode=0) location look_at <0, 0.0, 0.0> #end #if(myMode=1) location <8,1,-8> look_at <0, 0.0, 0.0> #end #if(myMode=2) location <-2,0,-8> look_at <0, 0.0, 0.0> #end #if(myMode=3) location <-3,3,-3> look_at <0, 0.0, 0.0> #end #if(myMode=4) location <-5, -(Rmajor + Rminor + 0)+0.3,12> look_at <0, -(Rmajor + Rminor + 0)+0.3, 0.0> #end right x*1920/1080 //focal_point 0 blur_samples 50 aperture .75 }