 		 0.0052, -0.0144,  1.0090
 );
 
-// global shader variables
-float varX_InTxtUnits;
-float varY_InTxtUnits;
-float dH = 0.0f;
-float orgU;
-float orgV;
-
 // function declarations
 void mainBRDFMap();
 void mainRenderGeometry();

	for (float n = boundaries.x; n <= boundaries.y; n = n + 1) {
		// values between 0.38 and 0.78 microns
		float lval = (dir*spacing/n);
			
		// rescale them to [0,1]
		float y = (lval-lambda_min)/(lambda_max-lambda_min);
		spectrumContribution += ( blend3(vec3(f * (y - 0.75), f * (y - 0.5), f * (y - 0.25))) ); 

		
	vec3 totalXYZ = 0.1*cdiff.xyz + eps;
	totalXYZ = getBRDF_RGB_T_D65(M_Adobe_XRNew, totalXYZ);
	float fac = (getShadowMaskFactor(lightDir, Pos)*gainFactor(lightDir, Pos));
	fac = (fac < 0.0) ? 0.0 : fac;
	frag_shaded = anis*vec4(gammaCorrect(fac*totalXYZ, 2.3), 1.0);
}

//Models the effect of diffraction using BRDF maps.
void mainBRDFMap(){
	float thetaR = asin(sqrt(o_org_pos.x*o_org_pos.x + o_org_pos.y*o_org_pos.y ));
	float phiR = atan(o_org_pos.y, o_org_pos.x);
	vec3 k1 = vec3(0.0f);
