|
@@ -228,6 +228,7 @@ float3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
|
|
{
|
|
{
|
|
// Compute Fresnel term
|
|
// Compute Fresnel term
|
|
float3 F = F_Schlick(surface.f0, surfaceToLight.HdotV);
|
|
float3 F = F_Schlick(surface.f0, surfaceToLight.HdotV);
|
|
|
|
+ F += lerp(0.04f, surface.baseColor.rgb, surface.metalness);
|
|
|
|
|
|
// GGX Normal Distribution Function
|
|
// GGX Normal Distribution Function
|
|
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughness);
|
|
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughness);
|
|
@@ -589,12 +590,17 @@ float4 computeForwardProbes(Surface surface,
|
|
}
|
|
}
|
|
|
|
|
|
float2 envBRDF = TORQUE_TEX2DLOD(BRDFTexture, float4(surface.NdotV, surface.roughness,0,0)).rg;
|
|
float2 envBRDF = TORQUE_TEX2DLOD(BRDFTexture, float4(surface.NdotV, surface.roughness,0,0)).rg;
|
|
- float3 diffuse = irradiance * surface.baseColor.rgb * (1.0 - surface.metalness);
|
|
|
|
- float3 specularCol = specular * lerp(envBRDF.y, envBRDF.x, surface.metalness * (1.0 - surface.roughness));
|
|
|
|
|
|
+ float3 diffuse = irradiance * lerp(surface.baseColor.rgb, 0.04f, surface.metalness);
|
|
|
|
+ float3 specularCol = ((specular + surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
|
|
|
|
+
|
|
|
|
+ float horizonOcclusion = 1.3;
|
|
|
|
+ float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
|
|
|
+ horizon *= horizon;
|
|
|
|
|
|
// Final color output after environment lighting
|
|
// Final color output after environment lighting
|
|
float3 finalColor = diffuse + specularCol;
|
|
float3 finalColor = diffuse + specularCol;
|
|
finalColor *= surface.ao;
|
|
finalColor *= surface.ao;
|
|
|
|
+
|
|
if(isCapturing == 1)
|
|
if(isCapturing == 1)
|
|
return float4(lerp((finalColor), surface.baseColor.rgb,surface.metalness),0);
|
|
return float4(lerp((finalColor), surface.baseColor.rgb,surface.metalness),0);
|
|
else
|
|
else
|
|
@@ -741,13 +747,17 @@ float4 debugVizForwardProbes(Surface surface,
|
|
}
|
|
}
|
|
|
|
|
|
float2 envBRDF = TORQUE_TEX2DLOD(BRDFTexture, float4(surface.NdotV, surface.roughness,0,0)).rg;
|
|
float2 envBRDF = TORQUE_TEX2DLOD(BRDFTexture, float4(surface.NdotV, surface.roughness,0,0)).rg;
|
|
- float3 diffuse = irradiance * surface.baseColor.rgb * (1.0 - surface.metalness);
|
|
|
|
- float3 specularCol = specular * lerp(envBRDF.y, envBRDF.x, surface.metalness * (1.0 - surface.roughness));
|
|
|
|
|
|
+ float3 diffuse = irradiance * lerp(surface.baseColor.rgb, 0.04f, surface.metalness);
|
|
|
|
+ float3 specularCol = ((specular + surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
|
|
|
|
+
|
|
|
|
+ float horizonOcclusion = 1.3;
|
|
|
|
+ float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
|
|
|
+ horizon *= horizon;
|
|
|
|
|
|
- specularCol *= surface.metalness + (1.0 - surface.roughness);
|
|
|
|
// Final color output after environment lighting
|
|
// Final color output after environment lighting
|
|
float3 finalColor = diffuse + specularCol;
|
|
float3 finalColor = diffuse + specularCol;
|
|
finalColor *= surface.ao;
|
|
finalColor *= surface.ao;
|
|
|
|
+
|
|
if(isCapturing == 1)
|
|
if(isCapturing == 1)
|
|
return float4(lerp((finalColor), surface.baseColor.rgb,surface.metalness),0);
|
|
return float4(lerp((finalColor), surface.baseColor.rgb,surface.metalness),0);
|
|
else
|
|
else
|