D3DXFresnelTerm
Microsoft DirectX 9.0 SDK Update (October 2004)

D3DXFresnelTerm Function


Calculate the Fresnel term.

Syntax

FLOAT WINAPI D3DXFresnelTerm(      

    FLOAT CosTheta,     FLOAT RefractionIndex );

Parameters

CosTheta
[in] The value must be between 0 and 1.
RefractionIndex
[in] The refraction index of a material. The value must be greater than 1.

Return Value

This function returns the Fresnel term for unpolarized light. CosTheta is the cosine of the incident angle.

Remarks

To find the Fresnel term (F):

If A is angle of incidence and B is the angle of refraction, then

F = 0.5 * [tan2(A - B) / tan2(A + B) + sin2(A - B) / sin2(A + B)]
  = 0.5 * sin2(A - B) / sin2(A + B) * [cos2(A + B) / cos2(A - B) + 1]

Let r   = sina(A) / sin(B)      (the relative refractive index)
Let c   = cos(A)
Let g   = (r2 + c2 - 1)1/2

Then, expanding using the trig identities and simplifying, you get:

F = 0.5 * (g + c)2 / (g - c)2 * ([c(g + c) - 1]2 / [c(g - c) + 1]2 + 1)

Function Information

Headerd3dx9math.h
Import libraryd3dx9.lib
Minimum operating systems Windows 98


© 2004 Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center.