"Fossies" - the Fresh Open Source Software Archive

Member "aqsis-1.8.2/shaders/light/shadowspot.sl" (24 Aug 2012, 1088 Bytes) of package /linux/privat/aqsis-1.8.2.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 light shadowspot(
    2     float intensity = 1;
    3     color lightcolor = 1;
    4     point from = point "shader" (0, 0, 0);
    5     point to =   point "shader" (0, 0, 1);
    6     float coneangle = radians(30);
    7     float conedeltaangle = radians(5);
    8     float beamdistribution = 2;
    9     string shadowname = "";
   10     float samples = 16;
   11     float width = 1;
   12 	float blur = 0;
   13 	float falloff = 2)
   14 {
   15     float atten, cosangle;
   16     uniform point A = (to - from) / length(to - from);
   17     uniform float cosoutside = cos(coneangle);
   18     uniform float cosinside  = cos(coneangle - conedeltaangle);
   19 
   20     illuminate (from, A, coneangle) {
   21         cosangle = (L . A) / length(L);
   22         if( falloff == 2 )
   23 			atten = pow(cosangle, beamdistribution) / (L . L);
   24 		else if( falloff == 1 )
   25 			atten = pow(cosangle, beamdistribution) / (length(L)/2);
   26 		else
   27 			atten = pow(cosangle, beamdistribution);
   28 			
   29         atten *= smoothstep(cosoutside, cosinside, cosangle);
   30         Cl = atten * intensity * lightcolor;
   31         if (shadowname != "")
   32             Cl *= 1 - shadow(shadowname, Ps, "blur", blur, "width", width);
   33     }
   34 }