Merge pull request #379 from Azaezel/alpha40_lightreview

light review (hdr and metalness vs direct lighting)
This commit is contained in:
Brian Roberts 2020-11-16 04:24:41 -06:00 committed by GitHub
commit d8e82d1ba6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 12 deletions

View file

@ -61,5 +61,5 @@ void main()
average = vec4( 0.0f, 0.0f, 0.0f, 1.0f );
// Write the colour to the bright-pass render target
OUT_col = hdrEncode( average );
OUT_col = hdrEncode( saturate(average) );
}

View file

@ -58,5 +58,5 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
average = float4( 0.0f, 0.0f, 0.0f, 1.0f );
// Write the colour to the bright-pass render target
return hdrEncode( average );
return hdrEncode( saturate(average) );
}

View file

@ -231,24 +231,24 @@ vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq);
vec3 Fr = D * F * Vis;
#if (CAPTURING == 1)
return mix(Fd + Fr,surface.f0,surface.metalness);
#ifdef CAPTURING
return saturate(mix(Fd + Fr,surface.f0,surface.metalness));
#else
return Fd + Fr;
return saturate(Fd + Fr);
#endif
}
vec3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float shadow)
{
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0.0f) * shadow * lightIntensity;
vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity*(1.0-surface.metalness), 0.0f);
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
}
vec3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, vec3 lightColor, float lightIntensity, float radius, float shadow)
{
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0.0f) * shadow * lightIntensity * attenuation;
vec3 factor = lightColor * max(surfaceToLight.NdotL * shadow * lightIntensity * attenuation*(1.0-surface.metalness), 0.0f);
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
}

View file

@ -232,24 +232,24 @@ float3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq);
float3 Fr = D * F * Vis;
#if CAPTURING == true
return lerp(Fd + Fr,surface.f0,surface.metalness);
#ifdef CAPTURING
return saturate(lerp(Fd + Fr,surface.f0,surface.metalness));
#else
return Fd + Fr;
return saturate(Fd + Fr);
#endif
}
float3 getDirectionalLight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float shadow)
{
float3 factor = lightColor * max(surfaceToLight.NdotL, 0.0f) * shadow * lightIntensity;
float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity*(1.0-surface.metalness), 0.0f) ;
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
}
float3 getPunctualLight(Surface surface, SurfaceToLight surfaceToLight, float3 lightColor, float lightIntensity, float radius, float shadow)
{
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
float3 factor = lightColor * max(surfaceToLight.NdotL, 0.0f) * shadow * lightIntensity * attenuation;
float3 factor = lightColor * max(surfaceToLight.NdotL* shadow * lightIntensity * attenuation*(1.0-surface.metalness), 0.0f) ;
return evaluateStandardBRDF(surface,surfaceToLight) * factor;
}