Returns a refraction vector using an entering ray, a surface normal, and a refraction index.

ret refract(i, n, ?)


Item Description
[in] A floating-point, ray direction vector.
[in] A floating-point, surface normal vector.
[in] A floating-point, refraction index scalar.

Return Value

A floating-point, refraction vector. If the angle between the entering ray i and the surface normal n is too great for a given refraction index ?, the return value is (0,0,0).

Type Description

Name Template Type Component Type Size
i vector float any
n vector float same dimension(s) as input i
? scalar float 1
refraction vector vector float same dimension(s) as input i

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
Shader Model 2 (DirectX HLSL) and higher shader models yes
Shader Model 1 (DirectX HLSL) yes (vs_1_1 only)

See also

Intrinsic Functions (DirectX HLSL)