mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
correct further flaws with albedo handling
This commit is contained in:
parent
5636ebc457
commit
9d7fdab193
|
|
@ -227,6 +227,7 @@ vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
|
|||
{
|
||||
// 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);
|
||||
|
|
@ -583,12 +584,13 @@ vec4 computeForwardProbes(Surface surface,
|
|||
}
|
||||
|
||||
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
|
||||
vec3 diffuse = irradiance * surface.baseColor.rgb * (1.0 - surface.metalness);
|
||||
vec3 specularCol = specular * lerp(envBRDF.y, envBRDF.x, surface.metalness * (1.0 - surface.roughness));
|
||||
vec3 diffuse = irradiance * lerp(surface.baseColor.rgb, vec3(0.04f,0.04f,0.04f), surface.metalness);
|
||||
vec3 specularCol = ((specular + surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
|
||||
|
||||
// Final color output after environment lighting
|
||||
vec3 finalColor = diffuse + specularCol;
|
||||
finalColor *= surface.ao;
|
||||
|
||||
if(isCapturing == 1)
|
||||
return vec4(lerp((finalColor), surface.baseColor.rgb,surface.metalness),0);
|
||||
else
|
||||
|
|
@ -735,13 +737,13 @@ vec4 debugVizForwardProbes(Surface surface,
|
|||
}
|
||||
|
||||
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
|
||||
vec3 diffuse = irradiance * surface.baseColor.rgb * (1.0 - surface.metalness);
|
||||
vec3 specularCol = specular * lerp(envBRDF.y, envBRDF.x, surface.metalness * (1.0 - surface.roughness));
|
||||
vec3 diffuse = irradiance * lerp(surface.baseColor.rgb, vec3(0.04f,0.04f,0.04f), surface.metalness);
|
||||
vec3 specularCol = ((specular + surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
|
||||
|
||||
specularCol *= surface.metalness + (1.0 - surface.roughness);
|
||||
// Final color output after environment lighting
|
||||
vec3 finalColor = diffuse + specularCol;
|
||||
finalColor *= surface.ao;
|
||||
|
||||
if(isCapturing == 1)
|
||||
return vec4(lerp((finalColor), surface.baseColor.rgb,surface.metalness),0);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -228,6 +228,7 @@ float3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
|
|||
{
|
||||
// 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);
|
||||
|
|
@ -589,12 +590,17 @@ float4 computeForwardProbes(Surface surface,
|
|||
}
|
||||
|
||||
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
|
||||
float3 finalColor = diffuse + specularCol;
|
||||
finalColor *= surface.ao;
|
||||
|
||||
if(isCapturing == 1)
|
||||
return float4(lerp((finalColor), surface.baseColor.rgb,surface.metalness),0);
|
||||
else
|
||||
|
|
@ -741,13 +747,17 @@ float4 debugVizForwardProbes(Surface surface,
|
|||
}
|
||||
|
||||
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
|
||||
float3 finalColor = diffuse + specularCol;
|
||||
finalColor *= surface.ao;
|
||||
|
||||
if(isCapturing == 1)
|
||||
return float4(lerp((finalColor), surface.baseColor.rgb,surface.metalness),0);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -205,12 +205,13 @@ void main()
|
|||
#endif
|
||||
|
||||
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
|
||||
vec3 diffuse = irradiance * surface.baseColor.rgb * (1.0 - surface.metalness);
|
||||
vec3 specularCol = specular * lerp(envBRDF.y, envBRDF.x, surface.metalness * (1.0 - surface.roughness));
|
||||
vec3 diffuse = irradiance * lerp(surface.baseColor.rgb, vec3(0.04f,0.04f,0.04f), surface.metalness);
|
||||
vec3 specularCol = ((specular + surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
|
||||
|
||||
// Final color output after environment lighting
|
||||
vec3 finalColor = diffuse + specularCol;
|
||||
finalColor *= surface.ao;
|
||||
|
||||
if(isCapturing == 1)
|
||||
OUT_col = vec4(lerp((finalColor), surface.baseColor.rgb,surface.metalness),0);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -187,18 +187,23 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
|||
}
|
||||
|
||||
#if DEBUGVIZ_SPECCUBEMAP == 1 && DEBUGVIZ_DIFFCUBEMAP == 0
|
||||
return float4(specular, 1);
|
||||
return float4(specular, 1);
|
||||
#elif DEBUGVIZ_DIFFCUBEMAP == 1
|
||||
return float4(irradiance, 1);
|
||||
#endif
|
||||
|
||||
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
|
||||
float3 finalColor = diffuse + specularCol;
|
||||
finalColor *= surface.ao;
|
||||
finalColor *= surface.ao;
|
||||
|
||||
if(isCapturing == 1)
|
||||
return float4(lerp(finalColor, surface.baseColor.rgb,surface.metalness),0);
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in a new issue