MCPcopy Create free account
hub / github.com/RenderKit/embree / fresnelConductor

Function fresnelConductor

tutorials/common/tutorial/optics.h:68–76  ·  view source on GitHub ↗

! Computes fresnel coefficient for conductor medium with complex * refraction index (eta,k). The cosine has to be positive. */

Source from the content-addressed store, hash-verified

66/*! Computes fresnel coefficient for conductor medium with complex
67 * refraction index (eta,k). The cosine has to be positive. */
68inline Vec3fa fresnelConductor(const float cosi, const Vec3fa& eta, const Vec3fa& k)
69{
70 const Vec3fa tmp = eta*eta + k*k;
71 const Vec3fa Rpar = (tmp * (cosi*cosi) - 2.0f*eta*cosi + Vec3fa(1.0f)) *
72 rcp(tmp * (cosi*cosi) + 2.0f*eta*cosi + Vec3fa(1.0f));
73 const Vec3fa Rper = (tmp - 2.0f*eta*cosi + Vec3fa(cosi*cosi)) *
74 rcp(tmp + 2.0f*eta*cosi + Vec3fa(cosi*cosi));
75 return 0.5f * (Rpar + Rper);
76}
77
78// =======================================================
79struct FresnelConductor {

Callers 2

evalFunction · 0.85

Calls 2

Vec3faClass · 0.50
rcpFunction · 0.50

Tested by

no test coverage detected