Revert "take ibl amount into account for translucent opacity"

This commit is contained in:
Brian Roberts 2025-12-15 13:53:31 -06:00 committed by GitHub
parent e9a8961543
commit 854bea3246
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 25 deletions

View file

@ -226,11 +226,9 @@ float getDistanceAtt( vec3 unormalizedLightVector , float invSqrAttRadius )
vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
{
if (surface.depth >= 0.9999f)
return float3(0.0,0.0,0.0);
// Compute Fresnel term
vec3 F = F_Schlick(surface.f0, surfaceToLight.HdotV);
F += lerp(vec3(0.04f,0.04f,0.04f), surface.baseColor.rgb, surface.metalness);
// GGX Normal Distribution Function
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughness);
@ -594,12 +592,9 @@ vec4 computeForwardProbes(Surface surface,
specular = mix(specular,textureLod(specularCubemapAR, vec4(surface.R, skylightCubemapIdx), lod).xyz, alpha);
}
float reflectionOpacity = clamp(surface.baseColor.a, max(length(specular),length(irradiance))*surface.roughness,1.0);
surface.baseColor.rgb = lerp(surface.baseColor.rgb, vec3(reflectionOpacity,reflectionOpacity,reflectionOpacity), surface.roughness);
updateSurface(surface);
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
vec3 diffuse = irradiance * lerp(surface.baseColor.rgb, vec3(0.04f,0.04f,0.04f), surface.metalness);
vec3 specularCol = ((specular * surface.f0) * envBRDF.x + envBRDF.y)*surface.metalness;
vec3 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));
@ -610,10 +605,10 @@ vec4 computeForwardProbes(Surface surface,
finalColor *= surface.ao;
if(isCapturing == 1)
return vec4(lerp((finalColor), surface.baseColor.rgb,surface.metalness),surface.baseColor.a);
return vec4(lerp((finalColor), surface.baseColor.rgb,surface.metalness),0);
else
{
return vec4(finalColor, reflectionOpacity);
return vec4(finalColor, 0);
}
}

View file

@ -226,11 +226,9 @@ float getDistanceAtt( float3 unormalizedLightVector , float invSqrAttRadius )
float3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
{
if (surface.depth >= 0.9999f)
return float3(0.0,0.0,0.0);
// Compute Fresnel term
float3 F = F_Schlick(surface.f0, surfaceToLight.HdotV);
F += lerp(0.04f, surface.baseColor.rgb, surface.metalness);
// GGX Normal Distribution Function
float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughness);
@ -599,26 +597,23 @@ float4 computeForwardProbes(Surface surface,
specular = lerp(specular,TORQUE_TEXCUBEARRAYLOD(specularCubemapAR, surface.R, skylightCubemapIdx, lod).xyz,alpha);
}
float reflectionOpacity = clamp(surface.baseColor.a, max(length(specular),length(irradiance))*surface.roughness,1.0);
surface.baseColor.rgb = lerp(surface.baseColor.rgb, float3(reflectionOpacity,reflectionOpacity,reflectionOpacity), surface.roughness);
surface.Update();
float2 envBRDF = TORQUE_TEX2DLOD(BRDFTexture, float4(surface.NdotV, surface.roughness,0,0)).rg;
float3 diffuse = irradiance * lerp(surface.baseColor.rgb, 0.04f, surface.metalness);
float3 specularCol = ((specular * surface.f0) * envBRDF.x + envBRDF.y)*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
float3 finalColor = diffuse + specularCol* horizon;
float3 finalColor = diffuse + specularCol;
finalColor *= surface.ao;
if(isCapturing == 1)
return float4(lerp((finalColor), surface.baseColor.rgb, surface.metalness),surface.baseColor.a);
return float4(lerp((finalColor), surface.baseColor.rgb,surface.metalness),0);
else
{
return float4(finalColor, reflectionOpacity);
return float4(finalColor, 0);
}
}