mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
clean up brdf
it was loading in the wrong colorspace, and there as a mix of texture/textureLOD refs leading to inconsistencies
This commit is contained in:
parent
3b2f8be521
commit
61dbbf7102
6 changed files with 18 additions and 22 deletions
|
|
@ -238,7 +238,7 @@ bool RenderProbeMgr::onAdd()
|
||||||
mCubeSlotCount = PROBE_ARRAY_SLOT_BUFFER_SIZE;
|
mCubeSlotCount = PROBE_ARRAY_SLOT_BUFFER_SIZE;
|
||||||
|
|
||||||
String brdfTexturePath = GFXTextureManager::getBRDFTexturePath();
|
String brdfTexturePath = GFXTextureManager::getBRDFTexturePath();
|
||||||
if (!mBRDFTexture.set(brdfTexturePath, &GFXTexturePersistentProfile, "BRDFTexture"))
|
if (!mBRDFTexture.set(brdfTexturePath, &GFXTexturePersistentSRGBProfile, "BRDFTexture"))
|
||||||
{
|
{
|
||||||
Con::errorf("RenderProbeMgr::onAdd: Failed to load BRDF Texture");
|
Con::errorf("RenderProbeMgr::onAdd: Failed to load BRDF Texture");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -584,9 +584,8 @@ vec4 computeForwardProbes(Surface surface,
|
||||||
|
|
||||||
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
|
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
|
||||||
vec3 diffuse = irradiance * surface.baseColor.rgb * (1.0 - surface.metalness);
|
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 specularCol = specular * (F_Schlick(surface.f0, surface.NdotV) * envBRDF.x + envBRDF.y);
|
|
||||||
specularCol *= surface.metalness + (1.0 - surface.roughness);
|
|
||||||
// Final color output after environment lighting
|
// Final color output after environment lighting
|
||||||
vec3 finalColor = diffuse + specularCol;
|
vec3 finalColor = diffuse + specularCol;
|
||||||
finalColor *= surface.ao;
|
finalColor *= surface.ao;
|
||||||
|
|
@ -737,8 +736,8 @@ vec4 debugVizForwardProbes(Surface surface,
|
||||||
|
|
||||||
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
|
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
|
||||||
vec3 diffuse = irradiance * surface.baseColor.rgb * (1.0 - surface.metalness);
|
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 specularCol = specular * (F_Schlick(surface.f0, surface.NdotV) * envBRDF.x + envBRDF.y);
|
|
||||||
specularCol *= surface.metalness + (1.0 - surface.roughness);
|
specularCol *= surface.metalness + (1.0 - surface.roughness);
|
||||||
// Final color output after environment lighting
|
// Final color output after environment lighting
|
||||||
vec3 finalColor = diffuse + specularCol;
|
vec3 finalColor = diffuse + specularCol;
|
||||||
|
|
|
||||||
|
|
@ -588,11 +588,10 @@ float4 computeForwardProbes(Surface surface,
|
||||||
specular = lerp(specular,TORQUE_TEXCUBEARRAYLOD(specularCubemapAR, surface.R, skylightCubemapIdx, lod).xyz,alpha);
|
specular = lerp(specular,TORQUE_TEXCUBEARRAYLOD(specularCubemapAR, surface.R, skylightCubemapIdx, lod).xyz,alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
float2 envBRDF = TORQUE_TEX2D(BRDFTexture, float2(surface.NdotV, surface.roughness)).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 diffuse = irradiance * surface.baseColor.rgb * (1.0 - surface.metalness);
|
||||||
|
float3 specularCol = specular * lerp(envBRDF.y, envBRDF.x, surface.metalness * (1.0 - surface.roughness));
|
||||||
float3 specularCol = specular * (F_Schlick(surface.f0, surface.NdotV) * envBRDF.x + envBRDF.y);
|
|
||||||
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;
|
||||||
|
|
@ -741,10 +740,10 @@ float4 debugVizForwardProbes(Surface surface,
|
||||||
return float4(irradiance, 0);
|
return float4(irradiance, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
float2 envBRDF = TORQUE_TEX2D(BRDFTexture, float2(surface.NdotV, surface.roughness)).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 diffuse = irradiance * surface.baseColor.rgb * (1.0 - surface.metalness);
|
||||||
|
float3 specularCol = specular * lerp(envBRDF.y, envBRDF.x, surface.metalness * (1.0 - surface.roughness));
|
||||||
float3 specularCol = specular * (F_Schlick(surface.f0, surface.NdotV) * envBRDF.x + envBRDF.y);
|
|
||||||
specularCol *= surface.metalness + (1.0 - surface.roughness);
|
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;
|
||||||
|
|
|
||||||
|
|
@ -206,9 +206,8 @@ void main()
|
||||||
|
|
||||||
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
|
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
|
||||||
vec3 diffuse = irradiance * surface.baseColor.rgb * (1.0 - surface.metalness);
|
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 specularCol = specular * (F_Schlick(surface.f0, surface.NdotV) * envBRDF.x + envBRDF.y);
|
|
||||||
specularCol *= surface.metalness + (1.0 - surface.roughness);
|
|
||||||
// Final color output after environment lighting
|
// Final color output after environment lighting
|
||||||
vec3 finalColor = diffuse + specularCol;
|
vec3 finalColor = diffuse + specularCol;
|
||||||
finalColor *= surface.ao;
|
finalColor *= surface.ao;
|
||||||
|
|
|
||||||
|
|
@ -192,16 +192,15 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
||||||
return float4(irradiance, 1);
|
return float4(irradiance, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float2 envBRDF = TORQUE_TEX2D(BRDFTexture, float2(surface.NdotV, surface.roughness)).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 diffuse = irradiance * surface.baseColor.rgb * (1.0 - surface.metalness);
|
||||||
|
float3 specularCol = specular * lerp(envBRDF.y, envBRDF.x, surface.metalness * (1.0 - surface.roughness));
|
||||||
|
|
||||||
float3 specularCol = specular * (F_Schlick(surface.f0, surface.NdotV) * envBRDF.x + envBRDF.y);
|
|
||||||
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
|
||||||
{
|
{
|
||||||
return float4((finalColor*ambientColor), 0);
|
return float4((finalColor*ambientColor), 0);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue