/* This shader was modified by Larry Gritz on 30 Mar 1998. The original shader is KTlensflareV.sl written by Katsuaki HIRAMITSU. */ volume KTlensflareV_lg ( string lens="on",fog="off"; float distance=1500; color background=color(0.94,0.92,0.97); /** big flare paramater **/ /*point SunP=point(-0.6,0.6,3.464);*/ /*point SunP=point "camera" (-0.42,0.73,3.464);*/ point SunP_from=point "world" (-0.42,0.73,3.464),SunP_to=point "world" (0,0,0); float fov=60; float ringS=0.3,ringL1=0.2,ringL2=0.4,ringL3=0.1,ringL4=0.1,ringL5=0.8,ringL6=0.15; float ringS_s=0.27,ringL1_s=0.13,ringL2_s=0.2; float max_ring1=0.98,max_ring2=0.98,max_ring3=0.98,max_ring4=0.98,max_ring5=0.98,max_ring6=0.98; float max_ringS_s=0.6,max_ring1_s=0.98,max_ring2_s=0.98; float max_mixS=0.1,max_mix1=0.025,max_mix2=0.025,max_mix3=0.05,max_mix4=0.05; float max_mix5=0.015,max_mix6=0.1; float max_mixS_s=0.3,max_mix1_s=0.1,max_mix2_s=0.05; string typeS="clamp",type1="step",type2="step",type3="clamp",type4="clamp",type5="clamp",type6="clamp"; string typeS_s="step",type1_s="step",type2_s="step"; color csS=color(1,0.25,0),cs1=color(0.74,1,0.87),cs2=color(1,1,0),cs3=color(1,1,0.5); color cs4=color(1,1,0.5),cs5=color(1,1,1),cs6=color(0.74,1,0.87); color csS_s=color(0,0.5,1),cs1_s=color(1,0.9,0.9),cs2_s=color(1,1,0); float roughness=-5; /** small flare paramater **/ float length1=0.02,length3=0.2,length4=0.05,length5=0.02,length6=0.04; float ring_sL1_1=0.005,ring_sL1_2=0.02,ring_sL2=0.15; float ring_sL3_1=0.01,ring_sL3_2=0.01; float ring_sL4_1=0.06,ring_sL4_2=0.05,ring_sL4_3=0.06; float ring_sL5_1=0.03,ring_sL5_2=0.005; float ring_sL6_1=0.02,ring_sL6_2_1=0.03,ring_sL6_2_2=0.02,ring_sL6_3=0.02,ring_sL7=0.08; float max_ring_sL1_1=0.98,max_ring_sL1_2=0.98,max_ring_sL2=0.98; float max_ring_sL3_1=0.25,max_ring_sL3_2=0.25; float max_ring_sL4_1=0.98,max_ring_sL4_2=1,max_ring_sL4_3=0.98; float max_ring_sL5_1=0.8,max_ring_sL5_2=0.98; float max_ring_sL6_1=0.9,max_ring_sL6_2_1=1,max_ring_sL6_2_2=0.9,max_ring_sL6_3=0.9,max_ring_sL7=0.9; string type_s1_1="step",type_s1_2="step",type_s2="clamp"; string type_s3_1="step",type_s3_2="step"; string type_s4_1="clamp",type_s4_2="specular",type_s4_3="clamp"; string type_s5_1="step",type_s5_2="step"; string type_s6_1="step",type_s6_2_1="specular",type_s6_2_2="step",type_s6_3="step",type_s7="clamp"; float max_mix_sL1_1=1.5,max_mix_sL1_2=0.69,max_mix_sL2=0.05; float max_mix_sL3_1=0.8,max_mix_sL3_2=0.5; float max_mix_sL4_1=0.05,max_mix_sL4_2=2,max_mix_sL4_3=0.05; float max_mix_sL5_1=0.69,max_mix_sL5_2=1.5; float max_mix_sL6_1=0.4,max_mix_sL6_2_1=4,max_mix_sL6_2_2=0.4,max_mix_sL6_3=0.4,max_mix_sL7=0.05; color cs_s1_1=color(1,1,1),cs_s1_2=color(0.74,1,0.87),cs_s2=color(0.74,0.9,1); color cs_s3_1=color(0.48,0.82,1),cs_s3_2=color(0.82,1,0); color cs_s4_1=color(0.7,1,0),cs_s4_2=color(0.85,1,0.8),cs_s4_3=color(0.7,1,0); color cs_s5_1=color(1,0.9,0.72),cs_s5_2=color(1,1,1); color cs_s6_1=color(0.6,0.82,1),cs_s6_2_1=color(0.8,0.85,1),cs_s6_2_2=color(0.6,0.82,1),cs_s6_3=color(0.6,0.82,1),cs_s7=color(0.92,1,0.92); float s_roughness=-5; /* highlight paramater */ /*float Highlight_roughness=10,Highlight_intensity=1.2;*/ float Highlight_roughness=3,Highlight_intensity=1.05; color Highlightcolor=color(1,1,1); float lightscale=10,light_min=0.6,light_max=0.7; float light_roughness=12,light_intensity=0.4; color lightcolor=color(1,1,1) ) { float fog_d; point norP,norSunP,norCenterP; point LensP1,LensP2,LensP3,LensP4,LensP5,LensP6; point DSunP,DLensP5; point SWP,SWSunP,SWLensP1,SWLensP2,SWLensP3,SWLensP4,SWLensP5,SWLensP6; float Pz,norSunPz; float judgeS; float r_unit,SWunit; float Dfloat; color ciS,opa_cs; float r,dis; point SWsLensP1,SWsLensP2,SWsLensP3,SWsLensP4,SWsLensP5,SWsLensP6,SWsLensP7; point SWsLensP1_1,SWsLensP1_2,SWsLensP3_1,SWsLensP3_2,SWsLensP4_1,SWsLensP4_2,SWsLensP4_3; point SWsLensP5_1,SWsLensP5_2,SWsLensP6_1,SWsLensP6_2,SWsLensP6_3; point moveP_unit; float moveL_unit; float Highlight; point LightP,norLightP; float PorM; float Cosin; float lightdis,lighttheta; float judge,lens_judge; point Z = vector "camera" (0,0,1); if (fog=="on") { fog_d=1-exp(-length(I)/distance); Ci=Oi*mix(Ci,background,fog_d); } if (lens=="on") { /*norP=normalize(P);*/ norP=normalize(I); /* in the case of BMRT, *norP=normalize(-I); */ /*norSunP=transform("world",SunP); *norSunP=normalize(norSunP); *norSunP=normalize(SunP);*/ norSunP=normalize(SunP_from-SunP_to); norCenterP=Z; norCenterP=normalize(norCenterP); lens_judge=norCenterP.norSunP; if (lens_judge>0) { /* flare BEGIN */ LensP1=reflect(-norSunP,norCenterP); LensP1=normalize(reflect(-norCenterP,LensP1)); /*printf ("LensP1 = %p\n",LensP1);*/ LensP2=normalize(LensP1+norSunP); LensP3=normalize(LensP1+LensP2); LensP4=normalize(norSunP+LensP2); LensP5=normalize(reflect(-norCenterP,norSunP)); DSunP=norSunP; DLensP5=LensP5; Dfloat=(1/3)/zcomp(DSunP); DSunP=Dfloat*DSunP; Dfloat=(2/3)/zcomp(DLensP5); DLensP5=Dfloat*DLensP5; LensP6=normalize(DSunP+DLensP5); norSunPz=zcomp(norSunP); SWunit=(1/norSunPz); SWSunP=SWunit*norSunP; SWLensP1=(1/zcomp(LensP1))*LensP1; SWLensP2=(1/zcomp(LensP2))*LensP2; SWLensP3=(1/zcomp(LensP3))*LensP3; SWLensP4=(1/zcomp(LensP4))*LensP4; SWLensP5=(1/zcomp(LensP5))*LensP5; SWLensP6=(1/zcomp(LensP6))*LensP6; /*Pz=zcomp(P);*/ Pz=zcomp(I); SWunit=(1/Pz); /*SWP=SWunit*P;*/ SWP=SWunit*I; r_unit=tan(radians(fov/2)); judgeS=distance(SWP,SWSunP)/r_unit; if (judgeS