雨亭

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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

posted on 2011-09-01 23:08  雨亭  阅读(338)  评论(0编辑  收藏  举报