Windows Dev Center

abs
all
any
cos
ddx
ddy
dot
dst
exp
fma
lit
log
mad
max
min
mul
pow
rcp
sin
tan
Expand Minimize

lit

Returns a lighting coefficient vector.

ret lit(n_dot_l, n_dot_h, m)

 

This function returns a lighting coefficient vector (ambient, diffuse, specular, 1) where:

  • ambient = 1.
  • diffuse = ((n • l) < 0) ? 0 : n • l.
  • specular = ((n • l) < 0) || ((n • h) < 0) ? 0 : ((n • h) * m).

Where the vector n is the normal vector, l is the direction to light and h is the half vector.

Parameters

ItemDescription

n_dot_l

[in] The dot product of the normalized surface normal and the light vector.

n_dot_h

[in] The dot product of the half-angle vector and the surface normal.

m

[in] A specular exponent.

 

Return Value

The lighting coefficient vector.

Type Description

Name Template Type Component Type Size
n_dot_lscalar float 1
n_dot_hscalar float 1
mscalar float 1
retvector float 4

 

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) yes (vs_1_1 only)

 

See also

Intrinsic Functions (DirectX HLSL)

 

 

Community Additions

ADD
Show:
© 2015 Microsoft