D3DXFresnelTerm 函数

来源:互联网 发布:沪江小d mac版 编辑:程序博客网 时间:2024/05/10 19:39

D3DXFresnelTerm 函数


计算菲涅耳系数。

定义:

FLOAT WINAPI D3DXFresnelTerm(      

    FLOAT CosTheta,
    FLOAT RefractionIndex
);

参数:

CosTheta

[in] 本值必须在 01之间。

RefractionIndex

[in] The refraction index of a material. The value must be greater than 1.

返回值:

本函数返回非偏振光的菲涅耳系数。CosTheta是入射角的COS值。

说明:

下面说明怎么样计算非偏振光的菲涅耳系数(F):

如果A是入射角,B是折射角,那么就可以用下面公式计算,

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]
 
r   = sina(A) / sin(B)      (折射系数)
 c   = cos(A)
 g   = (r2 + c2 - 1)1/2

然后作简化运算后,就会得到下面公式:

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

函数信息:

Header

d3dx9math.h

Import library

d3dx9.lib

Minimum operating systems

Windows 98