refract - HLSL

Returns the refraction vector given the entering ray direction i, the surface normal n, and the refraction index ri. If the angle between i and n is too great for a given eta, refract returns (0,0,0).

Syntax

ret refract(i, n, ri)

Where:

Name In/Out Template Type Component Type Size
i in vector float any
n in vector float same dimension(s) as input i
ri in scalar float 1
refraction vector out vector float same dimension(s) as input i

Minimum Shader Version

This intrinsic function is supported in the following (or above) shader versions:

Vertex Shader Pixel Shader
vs_1_1 ps_2_0

See Also

HLSL Intrinsic Functions