Show differencesHistory of post edits
#2Ashaman73
Posted 26 September 2012 - 05:14 AM
From the hlsl doc friom here:
When you look at your code here:
Remarks The pow HLSL intrinsic function calculates xy. X Y Result < 0 any NAN > 0 == 0 1 == 0 > 0 0 == 0 < 0 inf > 0 < 0 1/X-Y
When you look at your code here:
// calculate the specular factor float specularValue = dot( lightValues.m_reflectionVector, float3( 0, 0, 1 ) ); float specularFactor = pow( max( specularValue, 1.0 ), matShininess );Then specularValue will get 0 and later negative when reaching perpendicular vectors, which is quite unstable, try this:
float specularValue = dot( lightValues.m_reflectionVector, float3( 0, 0, 1 ) ); specularValue = max(0.001, specularValue);
#1Ashaman73
Posted 26 September 2012 - 05:14 AM
From the hlsl doc:
When you look at your code here:
Remarks The pow HLSL intrinsic function calculates xy. X Y Result < 0 any NAN > 0 == 0 1 == 0 > 0 0 == 0 < 0 inf > 0 < 0 1/X-Y
When you look at your code here:
// calculate the specular factor float specularValue = dot( lightValues.m_reflectionVector, float3( 0, 0, 1 ) ); float specularFactor = pow( max( specularValue, 1.0 ), matShininess );Then specularValue will get 0 and later negative when reaching perpendicular vectors, which is quite unstable, try this:
float specularValue = dot( lightValues.m_reflectionVector, float3( 0, 0, 1 ) ); specularValue = max(0.001, specularValue);