// HEAVE / Heaving waves in the evening '03.05 // by Tsutomu HIGO E-mail: nj2t-hg@asahi-net.or.jp #version 3.5; global_settings { max_trace_level 5 assumed_gamma 2.2 } camera { location <-56, -200, -15> angle 120 look_at <-20, -100, 10> } light_source {<166000, 3000, 500000> color rgb <0.7, 0.5, 0.3>} #macro Wave (Xo, Yo, Zo, To, Lo) #declare Xo = 50*Lo+5*sin(5*Lo/pi/4)-1000; #declare Yo = (15*sin(3*To/pi+pi*1.5)+12*cos(5*Lo/pi/3))/(0.3+0.1*To)+50; #declare Zo = 30*To+5*cos(3*To/pi+pi*1.5)+8*sin(5*Lo/pi/2)-0.5*Yo-300; #declare Lxz = sqrt(Xo*Xo+Zo*Zo); #declare Yo = Yo-Lxz*sin(asin(Lo/2/5000)); #end //***************** Mesh treatment ***************** //triangle of the surface #macro Trid (Ph, Pv) #declare Phs1 = Ph-1; triangle { } triangle { } #end //normal vector of the point #macro Vd (Ph, Pv) <(Cp[Ph-1][Pv][1]-Cp[Ph][Pv][1])*(Cp[Ph][Pv-1][2]-Cp[Ph][Pv][2]) -(Cp[Ph][Pv-1][1]-Cp[Ph][Pv][1])*(Cp[Ph-1][Pv][2]-Cp[Ph][Pv][2]), (Cp[Ph][Pv-1][0]-Cp[Ph][Pv][0])*(Cp[Ph-1][Pv][2]-Cp[Ph][Pv][2]) -(Cp[Ph-1][Pv][0]-Cp[Ph][Pv][0])*(Cp[Ph][Pv-1][2]-Cp[Ph][Pv][2]), (Cp[Ph-1][Pv][0]-Cp[Ph][Pv][0])*(Cp[Ph][Pv-1][1]-Cp[Ph][Pv][1]) -(Cp[Ph][Pv-1][0]-Cp[Ph][Pv][0])*(Cp[Ph-1][Pv][1]-Cp[Ph][Pv][1])> #end //smooth_triangle of the surface #macro Trisd (Ph, Pv) #declare Blue = texture { pigment {color rgb <0.2, 0.7, 0.5>} finish {reflection 1 ambient 0.1 phong 1 diffuse 0.5 brilliance 1} normal {ripples 1 rotate y*0 scale 100 frequency 15 translate <-300, 0, 1000>} } smooth_triangle { Vd(Ph, Pv) Vd(Ph-1, Pv-1) Vd(Ph, Pv-1) texture {Blue} } smooth_triangle { Vd(Ph-1, Pv) Vd(Ph-1, Pv-1) Vd(Ph, Pv) texture {Blue} } #end #declare Tmax = 150; #declare Lmax = 70; #declare Cp = array[Tmax][Lmax][3] #declare T = 0; #while (T < Tmax) #declare L = 0; #while (L < Lmax) #declare M = 0; #while (M < 3) #declare Cp[T][L][M] = 0; #declare M = M+1; #end Wave (Cp[T][L][0], Cp[T][L][1], Cp[T][L][2], T-1.5, L) #declare L = L+1; #end #declare T = T+1; #end #declare T = 2; #while (T < Tmax-1) #declare L = 2; #while (L < Lmax-1) mesh {Trisd (T, L) rotate x*-3 no_shadow} #declare L = L+1; #end #declare T = T+1; #end sky_sphere { pigment { gradient y color_map { [0 color rgb <0.7,0.85,1>] [1.0 rgb <0,0,0>] } } }