color diffuus (normal Normaal; float Brilliance=1, Diffuus = .7) { normal Nn=normalize(Normaal),Ln; color kleur=0; extern point P; extern vector L; extern color Cl; illuminance(P,Nn,PI/2) { Ln = normalize(L); kleur += Cl*pow(Ln.Nn,Brilliance)*Diffuus; } return kleur; } surface rook2 (float scale=1, vuurgrootte=1,vuurgrootte2=-1, vuurfalloff=1,edgefalloff=1, brilliance=1, diffuus=.8, transparantie=1, helderheid=10, helderheid2=5, maxhelderheid=10, lengte=80; vector Centrum=0; color Ambient=0) { vector Punt=P/scale; vector PuntT=P-Centrum; vector Norm=normalize(N); vector V=normalize(I); float afstand = length(P-Centrum); float opac = pow (abs(Norm.V), edgefalloff); //*afstand/lengte); float ruis=noise(Punt); float ruis2=noise(Punt+15); float ruis3=noise(Punt/10); vector ruis3p=noise(Punt/10)/10; float ruis4=1; color rookkleur=diffuus(N+ruis3p,1,3)*(.5+ruis4*.5); float ruis3b=1-ruis3*min(pow(afstand/vuurgrootte,1/vuurfalloff),1); float rookopacity=pow(opac,1+afstand/lengte)*ruis3b*(.8+ruis*.2)-pow(afstand/lengte,5); float ruis5=noise((Punt/10)+Centrum*.5); if (vuurgrootte2<0) vuurgrootte2=lengte/2; color vuurkleur1=mix((1,.2,.1)*helderheid2,(1,1,1),min(pow(afstand/vuurgrootte2,.25),1)); color vuurkleur=mix(vuurkleur1,(1,1,1),ruis5); vuurkleur=mix((1,1,1),vuurkleur,helderheid/maxhelderheid); color vuurbol=mix((1,.2,.05),(0,0,0),min(pow(afstand/vuurgrootte,1/vuurfalloff),1))*float(noise(P*.25/scale))*float(noise(PuntT*.5/scale))*float(noise(PuntT*1.5/scale))*5; Ci=vuurkleur*rookkleur+Ambient; Oi=max(rookopacity,0); }