reflect

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

ret reflect(i, n)

 

Parameters

ItemDescription

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
ivector float any
nvector float same dimension(s) as input i
retvector float same dimension(s) as input i

 

Minimum Shader Model

This function is supported in the following shader models.

Shader ModelSupported
Shader Model 1 (DirectX HLSL) and higher shader modelsyes

 

See also

Intrinsic Functions (DirectX HLSL)

 

 

Show: