da376e0237
Cycles uses code from some great open source projects, many thanks them: * BVH building and traversal code from NVidia's "Understanding the Efficiency of Ray Traversal on GPUs": http://code.google.com/p/understanding-the-efficiency-of-ray-traversal-on-gpus/ * Open Shading Language for a large part of the shading system: http://code.google.com/p/openshadinglanguage/ * Blender for procedural textures and a few other nodes. * Approximate Catmull Clark subdivision from NVidia Mesh tools: http://code.google.com/p/nvidia-mesh-tools/ * Sobol direction vectors from: http://web.maths.unsw.edu.au/~fkuo/sobol/ * Film response functions from: http://www.cs.columbia.edu/CAVE/software/softlib/dorf.php
22 lines
471 B
C
22 lines
471 B
C
|
|
float fresnel_dielectric(vector Incoming, normal Normal, float eta)
|
|
{
|
|
/* compute fresnel reflectance without explicitly computing
|
|
the refracted direction */
|
|
float c = fabs(dot(Incoming, Normal));
|
|
float g = eta * eta - 1 + c * c;
|
|
float result;
|
|
|
|
if(g > 0) {
|
|
g = sqrt(g);
|
|
float A =(g - c)/(g + c);
|
|
float B =(c *(g + c)- 1)/(c *(g - c)+ 1);
|
|
result = 0.5 * A * A *(1 + B * B);
|
|
}
|
|
else
|
|
result = 1.0; /* TIR (no refracted component) */
|
|
|
|
return result;
|
|
}
|
|
|