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.




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


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


[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)