normalize (DirectX HLSL)
Normalizes the specified floating-point vector according to x / length(x).
ret normalize(x) |
---|
Parameters
- x
-
[in] The specified floating-point vector.
Return Value
The normalized x parameter. If the length of the x parameter is 0, the result is indefinite.
Remarks
The normalize HLSL intrinsic function uses the following formula: x / length(x).
在编写漫反射光照的时候,错用 normalize 函数。导致光照颜色显示不正确.
code:
float4 lightdirection = normal( LightDir );