// Last edited on 2008-08-13 13:28:58 by stolfi // Ring of lights that follow the camera #local cmz = vnormalize( < camera_dir.x, camera_dir.y, 0 > ); #local cmx = vnormalize(vcross(z,camera_dir)); #local cmy = vnormalize(vcross(cmz,cmx)); // Parameters (angles in degrees): #local nk = 10; // Number of lamps in outer ring. #local elev = +62; // Light group elevation relative to camera dir. #local azim = -15; // Light group azimuth relative to camera dir. #local orad = +40; // Angular radius of outer light ring. #local irad = +25; // Angular radius of inner light ring. #local nlamps = nk + floor(nk/2) + 1; // Total number of lamps. #local totlum = 1.5; // Total intensity of the lamps. #macro lamp(arad,theta,avglum) // Places a lamp in the light group at angle {arad} from center and // angle {theta} to the horizontal. Angles in degrees. #local ca = cos(radians(arad)); #local sa = sin(radians(arad)); #local ct = cos(radians(theta)); #local st = sin(radians(theta)); #local dloc = ca*cmz + sa*(ct*cmx + st*cmy); #local dabs = vaxis_rotate(vaxis_rotate(dloc, cmx, -elev), cmy, -azim); #local lum = avglum*(1 - st); light_source { camera_ctr + 100*dabs color rgb lum * < 1.000, 1.000, 1.000 > } #end #local k = 0; #local dtheta = 360/nk; #while (k < nk) #local theta = (k + 0.25)*dtheta; lamp(orad, theta, totlum/nlamps) #if (mod(k,2) = 0) lamp(irad, theta + dtheta/2, totlum/nlamps) #end #local k = k + 1; #end lamp(0, 0, totlum/nlamps)