blender/intern/cycles/kernel/osl/nodes/node_fresnel.h
Ton Roosendaal da376e0237 Cycles render engine, initial commit. This is the engine itself, blender modifications and build instructions will follow later.
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
2011-04-27 11:58:34 +00:00

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;
}