/* light shader that produces the batsignal from procedrual pattern and help of the slideprojector shader in RenderMan Companion*/ #include "rmannotes.sl" light batsignal(float intensity = 1, freq = 1; color lightcolor= 1; float fieldofview = PI/7; point from = point"camera"(0,0,0), to = point"camera"(0,0,1), up = point "eye"(0,1,0)) { color surface_color, layer_color; float layer_opac, layer_opac2, layer_opac3,layer_opac4,layer_opac5,surface_opac; float lwing,rwing; float fuzz = 0.025; point p1, p2; float half_width; float d, ss , tt; point center; float radius; float left, right, top, bottom; uniform point relT,relU,relV; uniform float spread = 1/tan(fieldofview/2); float Pt,Pu,Pv; surface_color = Cs; surface_opac = 0; /*--------------------------------------------------------------*/ /* wings face*/ relT = normalize(to-from); relU = relT^up; relV = normalize(relT^relU); illuminate(from,relT,atan(sqrt(2)/spread)) { L = Ps-from; Pt = L.relT; Pu = L.relU; Pv = L.relV; ss = spread*Pu/Pt; tt = spread*Pv/Pt; ss = ss*.5+.5; tt = tt*.5+.5; center = (0.7, 0.5, 0); /* location of center of disk */ radius = 0.3; /* radius of disk */ d = distance(center, (ss,tt, 0)); lwing = 1 - smoothstep(radius - fuzz, radius, d); center = (0.3, 0.5, 0); /* location of center of disk */ radius = 0.3; /* radius of disk */ d = distance(center, (ss,tt, 0)); rwing = 1 - smoothstep(radius - fuzz, radius, d); surface_color = union(lwing,rwing); left = 0.3; right = 0.7; /* rectangle sides */ top = 0.2; bottom = 0.8; layer_opac = pulse(left, right, fuzz, ss) * (pulse(top, bottom, fuzz, tt)); surface_color = difference(surface_color,layer_opac); left = 0.2; right = 0.8; /* rectangle sides */ top = 0.35; bottom = 0.7; layer_opac = pulse(left, right, fuzz, ss) * (pulse(top, bottom, fuzz, tt)); surface_color = union(surface_color,layer_opac); /*ripples top*/ center = (0.34, 0.3, 0); /* location of center of disk */ radius = 0.13; /* radius of disk */ d = distance(center, (ss,tt, 0)); lwing = 1 - smoothstep(radius - fuzz, radius, d); surface_color = difference(surface_color,lwing); center = (0.66, 0.3, 0); /* location of center of disk */ radius = 0.13; /* radius of disk */ d = distance(center, (ss,tt, 0)); rwing = 1 - smoothstep(radius - fuzz, radius, d); /*ripples bottom*/ surface_color = difference(surface_color,rwing); center = (0.3, 0.7, 0); /* location of center of disk */ radius = 0.1; /* radius of disk */ d = distance(center, (ss,tt, 0)); lwing = 1 - smoothstep(radius - fuzz, radius, d); surface_color = difference(surface_color,lwing); center = (0.7, 0.7, 0); /* location of center of disk */ radius = 0.1; /* radius of disk */ d = distance(center, (ss,tt, 0)); rwing = 1 - smoothstep(radius - fuzz, radius, d); surface_color = difference(surface_color,rwing); center = (0.42, 0.7, 0); /* location of center of disk */ radius = 0.08; /* radius of disk */ d = distance(center, (ss,tt, 0)); lwing = 1 - smoothstep(radius - fuzz, radius, d); surface_color = difference(surface_color,lwing); center = (0.58, 0.7, 0); /* location of center of disk */ radius = 0.09; /* radius of disk */ d = distance(center, (ss,tt, 0)); rwing = 1 - smoothstep(radius - fuzz, radius, d); surface_color = difference(surface_color,rwing); /*head*/ center = (0.5, 0.32, 0); /* location of center of disk */ radius = 0.08; /* radius of disk */ d = distance(center, (ss,tt, 0)); rwing = 1 - smoothstep(radius - fuzz, radius, d); surface_color = union(surface_color,rwing); center = (0.5, 0.28, 0); /* location of center of disk */ radius = 0.06; /* radius of disk */ d = distance(center, (ss,tt, 0)); rwing = 1 - smoothstep(radius - fuzz, radius, d); surface_color = difference(surface_color,rwing); center = (0.5, 0.5, 0); /* location of center of disk */ radius = 0.5; /* radius of disk */ d = distance(center, (ss,tt, 0)); rwing = 1 - smoothstep(radius - fuzz, radius, d); surface_color = difference(rwing,surface_color); Cl = intensity*lightcolor*surface_color; } }