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

Item Description
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_l scalar float 1
n_dot_h scalar float 1
m scalar float 1
ret vector float 4

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

See also

Intrinsic Functions (DirectX HLSL)