Corrected ARM BRDF formula. Thanks SmileTheory

This commit is contained in:
Robert Beckebans 2016-01-17 13:41:26 +01:00
parent 8f1512dc5e
commit 9c324b53d1
2 changed files with 3 additions and 3 deletions

View file

@ -94,7 +94,7 @@ void main( PS_IN fragment, out PS_OUT result )
half3 halfAngleVector = normalize( lightVector + viewVector );
half hdotN = saturate( dot3( halfAngleVector, localNormal ) );
half hdotN = clamp( dot3( halfAngleVector, localNormal ), 0.0, 1.0 );
#if 0 //defined(USE_PBR)
@ -151,7 +151,7 @@ void main( PS_IN fragment, out PS_OUT result )
// disney GGX
float D = ( hdotN * hdotN ) * ( rrrr - 1.0 ) + 1.0;
float VFapprox = ( ldotH * ldotH ) * ( roughness + 0.5 );
half3 specularBRDF = ( rrrr / ( 4.0 * PI * D * D * VFapprox ) ) * reflectColor;
half3 specularBRDF = ( rrrr / ( 4.0 * PI * D * D * VFapprox ) ) * ldotN * reflectColor;
//specularBRDF = half3( 0.0 );
#if 0

View file

@ -331,7 +331,7 @@ void main( PS_IN fragment, out PS_OUT result )
// disney GGX
float D = ( hdotN * hdotN ) * ( rrrr - 1.0 ) + 1.0;
float VFapprox = ( ldotH * ldotH ) * ( roughness + 0.5 );
half3 specularBRDF = ( rrrr / ( 4.0 * PI * D * D * VFapprox ) ) * reflectColor;
half3 specularBRDF = ( rrrr / ( 4.0 * PI * D * D * VFapprox ) ) * ldotN * reflectColor;
//specularBRDF = half3( 0.0 );
#if 0