Blender V2.61 - r43446

node_fresnel.h

Go to the documentation of this file.
00001 
00002 float fresnel_dielectric(vector Incoming, normal Normal, float eta)
00003 {
00004     /* compute fresnel reflectance without explicitly computing
00005        the refracted direction */
00006     float c = fabs(dot(Incoming, Normal));
00007     float g = eta * eta - 1 + c * c;
00008     float result;
00009 
00010     if(g > 0) {
00011         g = sqrt(g);
00012         float A =(g - c)/(g + c);
00013         float B =(c *(g + c)- 1)/(c *(g - c)+ 1);
00014         result = 0.5 * A * A *(1 + B * B);
00015     }
00016     else
00017         result = 1.0;  /* TIR (no refracted component) */
00018 
00019     return result;
00020 }
00021