volume KTlensflareV ( string 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(-0.42,0.73,3.464); 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); /** 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,LensP1z,LensP2z,LensP3z,LensP4z,LensP5z,LensP6z; float judgeS,judgeLP1,judgeLP2,judgeLP3,judgeLP4,judgeLP5,judgeLP6; float r_unit,SWunit; float Dfloat; color ciS,ci1,ci2,ci3,ci4,ci5,ci6; color ciS_s,ci1_s,ci2_s; 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 judge_sLP1_1,judge_sLP1_2,judge_sLP2,judge_sLP3_1,judge_sLP3_2; float judge_sLP4_1,judge_sLP4_2,judge_sLP4_3,judge_sLP5_1,judge_sLP5_2; float judge_sLP6_1,judge_sLP6_2,judge_sLP6_3,judge_sLP7; color ci_s1_1,ci_s1_2,ci_s2,ci_s3_1,ci_s3_2,ci_s4_1,ci_s4_2,ci_s4_3; color ci_s5_1,ci_s5_2,ci_s6_1,ci_s6_2_1,ci_s6_2_2,ci_s6_3,ci_s7; color ci_s1,ci_s3,ci_s4,ci_s5,ci_s6; float Highlight; point LightP,norLightP; float PorM; float Cosin; float lightdis,lighttheta; if (fog=="on") { fog_d=1-exp(-length(I)/distance); Ci=Oi*mix(Ci,background,fog_d); } norP=normalize(P); /*norSunP=transform("world",SunP); *norSunP=normalize(norSunP);*/ norSunP=normalize(SunP); norCenterP=point(0,0,1); norCenterP=normalize(norCenterP); /* 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; LensP1z=zcomp(LensP1); SWunit=(1/LensP1z); SWLensP1=SWunit*LensP1; LensP2z=zcomp(LensP2); SWunit=(1/LensP2z); SWLensP2=SWunit*LensP2; LensP3z=zcomp(LensP3); SWunit=(1/LensP3z); SWLensP3=SWunit*LensP3; LensP4z=zcomp(LensP4); SWunit=(1/LensP4z); SWLensP4=SWunit*LensP4; LensP5z=zcomp(LensP5); SWunit=(1/LensP5z); SWLensP5=SWunit*LensP5; LensP6z=zcomp(LensP6); SWunit=(1/LensP6z); SWLensP6=SWunit*LensP6; Pz=zcomp(P); SWunit=(1/Pz); SWP=SWunit*P; r_unit=tan(radians(fov/2)); judgeS=distance(SWP,SWSunP)/r_unit; judgeLP1=distance(SWP,SWLensP1)/r_unit; judgeLP2=distance(SWP,SWLensP2)/r_unit; judgeLP3=distance(SWP,SWLensP3)/r_unit; judgeLP4=distance(SWP,SWLensP4)/r_unit; judgeLP5=distance(SWP,SWLensP5)/r_unit; judgeLP6=distance(SWP,SWLensP6)/r_unit; if (judgeS