clipping the lighting result via ciel was causing banding issues with specular maps with alpha channels. rev2. also addresses the warning:

"warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them" since it was coming from the same line
This commit is contained in:
Azaezel 2014-03-18 05:52:54 -05:00
parent 29d7fe310d
commit 52ef23d0ec
2 changed files with 3 additions and 2 deletions

View file

@ -533,7 +533,8 @@ void DeferredPixelSpecularGLSL::processPix( Vector<ShaderComponent*> &component
AssertFatal( lightInfoSamp, "Something hosed the deferred features! Can't find lightInfoSample" );
// (a^m)^n = a^(m*n)
meta->addStatement( new GenOp( " @ = pow(d_specular, ceil(@ / @)) * @;\r\n", specDecl, specPow, constSpecPow, specStrength ) );
meta->addStatement( new GenOp( " @ = pow( abs(@), max((@ / AL_ConstantSpecularPower),1.0f)) * @;\r\n",
specDecl, d_specular, specPow, specStrength ) );
LangElement *specMul = new GenOp( "@ * @", specCol, specular );
LangElement *final = specMul;

View file

@ -479,7 +479,7 @@ void DeferredPixelSpecularHLSL::processPix( Vector<ShaderComponent*> &component
"DeferredPixelSpecularHLSL::processPix - Something hosed the deferred features!" );
// (a^m)^n = a^(m*n)
meta->addStatement( new GenOp( " @ = pow( @, ceil(@ / AL_ConstantSpecularPower)) * @;\r\n",
meta->addStatement( new GenOp( " @ = pow( abs(@), max((@ / AL_ConstantSpecularPower),1.0f)) * @;\r\n",
specDecl, d_specular, specPow, specStrength ) );
LangElement *specMul = new GenOp( "float4( @.rgb, 0 ) * @", specCol, specular );