Export (0) Print
Expand All
abs
all
any
cos
ddx
ddy
dot
dst
exp
fma
lit
log
mad
max
min
mul
pow
rcp
sin
tan
Expand Minimize

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

ItemDescription

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

 

Minimum Shader Model

This function is supported in the following shader models.

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

 

See also

Intrinsic Functions (DirectX HLSL)

 

 

Community Additions

ADD
Show:
© 2014 Microsoft