mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
brdf calc fixes from mar, rake roughness into account for translucent reflections
This commit is contained in:
parent
5893355d0a
commit
681caf9392
|
|
@ -226,9 +226,11 @@ 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);
|
||||
|
|
@ -592,8 +594,8 @@ 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)),1.0);
|
||||
surface.baseColor.rgb = lerp(surface.baseColor.rgb, vec3(1.0,1.0,1.0), reflectionOpacity*surface.roughness);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -226,9 +226,11 @@ 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);
|
||||
|
|
@ -596,8 +598,9 @@ float4 computeForwardProbes(Surface surface,
|
|||
irradiance = lerp(irradiance,TORQUE_TEXCUBEARRAYLOD(irradianceCubemapAR, surface.N, skylightCubemapIdx, 0).xyz,alpha);
|
||||
specular = lerp(specular,TORQUE_TEXCUBEARRAYLOD(specularCubemapAR, surface.R, skylightCubemapIdx, lod).xyz,alpha);
|
||||
}
|
||||
float reflectionOpacity = clamp(surface.baseColor.a, max(length(specular),length(irradiance)),1.0);
|
||||
surface.baseColor.rgb = lerp(surface.baseColor.rgb, float3(1.0,1.0,1.0), reflectionOpacity*surface.roughness);
|
||||
|
||||
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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue