reflect

Returns a reflection vector using an incident ray and a surface normal.

ret reflect(i, n)

Parameters

Item Description
i
[in] A floating-point, incident vector.
n
[in] A floating-point, normal vector.

Return Value

A floating-point, reflection vector.

Remarks

This function calculates the reflection vector using the following formula: v = i - 2 * n * dot(i n) .

Type Description

Name Template Type Component Type Size
i vector float any
n vector float same dimension(s) as input i
ret 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 1 (DirectX HLSL) and higher shader models yes

See also

Intrinsic Functions (DirectX HLSL)