Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualAshaman73

Posted 26 September 2012 - 06:12 AM

Edit: removed code due wrong assumption

#2Ashaman73

Posted 26 September 2012 - 05:14 AM

From the hlsl doc friom 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:
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);

PARTNERS