faceforward
Flips the surface-normal (if needed) to face in a direction opposite to i; returns the result in n.
ret faceforward(n, i, ng) |
---|
This function uses the following formula: -n sign(dot(i, ng)).
Parameters
Item | Description |
---|---|
n |
[in] The resulting floating-point surface-normal vector. |
i |
[in] A floating-point, incident vector that points from the view position to the shading position. |
ng |
[in] A floating-point surface-normal vector. |
Return Value
A floating-point, surface normal vector that is facing the view direction.
Type Description
Name | Template Type | Component Type | Size |
---|---|---|---|
n | vector | float | any |
i | vector | float | same dimension(s) as input n |
ng | vector | float | same dimensions as input n |
ret | vector | float | same dimensions as input n |
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) | vs_1_1 and ps_1_4 |