mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Merge pull request #1424 from Azaezel/alpha41/brdfFixes
unmangle brdfTexture. again.
This commit is contained in:
commit
42eda97364
5 changed files with 24 additions and 12 deletions
Binary file not shown.
|
|
@ -319,7 +319,7 @@ float computeSpecOcclusion( float NdotV , float AO , float roughness )
|
||||||
|
|
||||||
float roughnessToMipLevel(float roughness, float numMips)
|
float roughnessToMipLevel(float roughness, float numMips)
|
||||||
{
|
{
|
||||||
return saturate((roughness * numMips) - (pow(roughness, 6.0) * (numMips * 0.125)));
|
return roughness * (numMips+1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 compute4Lights( Surface surface,
|
vec4 compute4Lights( Surface surface,
|
||||||
|
|
@ -585,10 +585,14 @@ 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 * lerp(surface.baseColor.rgb, vec3(0.04f,0.04f,0.04f), surface.metalness);
|
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;
|
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));
|
||||||
|
horizon *= horizon;
|
||||||
|
|
||||||
// Final color output after environment lighting
|
// Final color output after environment lighting
|
||||||
vec3 finalColor = diffuse + specularCol;
|
vec3 finalColor = diffuse + specularCol * horizon;
|
||||||
finalColor *= surface.ao;
|
finalColor *= surface.ao;
|
||||||
|
|
||||||
if(isCapturing == 1)
|
if(isCapturing == 1)
|
||||||
|
|
@ -738,10 +742,14 @@ 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 * lerp(surface.baseColor.rgb, vec3(0.04f,0.04f,0.04f), surface.metalness);
|
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;
|
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));
|
||||||
|
horizon *= horizon;
|
||||||
|
|
||||||
// Final color output after environment lighting
|
// Final color output after environment lighting
|
||||||
vec3 finalColor = diffuse + specularCol;
|
vec3 finalColor = diffuse + specularCol * horizon;
|
||||||
finalColor *= surface.ao;
|
finalColor *= surface.ao;
|
||||||
|
|
||||||
if(isCapturing == 1)
|
if(isCapturing == 1)
|
||||||
|
|
|
||||||
|
|
@ -320,7 +320,7 @@ float computeSpecOcclusion( float NdotV , float AO , float roughness )
|
||||||
|
|
||||||
float roughnessToMipLevel(float roughness, float numMips)
|
float roughnessToMipLevel(float roughness, float numMips)
|
||||||
{
|
{
|
||||||
return saturate((roughness * numMips) - (pow(roughness, 6.0) * (numMips * 0.125)));
|
return roughness * (numMips+1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
float4 compute4Lights( Surface surface,
|
float4 compute4Lights( Surface surface,
|
||||||
|
|
@ -591,7 +591,7 @@ 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 * lerp(surface.baseColor.rgb, 0.04f, surface.metalness);
|
float3 diffuse = irradiance * lerp(surface.baseColor.rgb, 0.04f, surface.metalness);
|
||||||
float3 specularCol = ((specular + surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
|
float3 specularCol = ((specular * surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
|
||||||
|
|
||||||
float horizonOcclusion = 1.3;
|
float horizonOcclusion = 1.3;
|
||||||
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
||||||
|
|
@ -748,7 +748,7 @@ 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 * lerp(surface.baseColor.rgb, 0.04f, surface.metalness);
|
float3 diffuse = irradiance * lerp(surface.baseColor.rgb, 0.04f, surface.metalness);
|
||||||
float3 specularCol = ((specular + surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
|
float3 specularCol = ((specular * surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
|
||||||
|
|
||||||
float horizonOcclusion = 1.3;
|
float horizonOcclusion = 1.3;
|
||||||
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
||||||
|
|
|
||||||
|
|
@ -206,10 +206,14 @@ 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 * lerp(surface.baseColor.rgb, vec3(0.04f,0.04f,0.04f), surface.metalness);
|
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;
|
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));
|
||||||
|
horizon *= horizon;
|
||||||
|
|
||||||
// Final color output after environment lighting
|
// Final color output after environment lighting
|
||||||
vec3 finalColor = diffuse + specularCol;
|
vec3 finalColor = diffuse + specularCol * horizon;
|
||||||
finalColor *= surface.ao;
|
finalColor *= surface.ao;
|
||||||
|
|
||||||
if(isCapturing == 1)
|
if(isCapturing == 1)
|
||||||
|
|
|
||||||
|
|
@ -194,14 +194,14 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
||||||
|
|
||||||
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 * lerp(surface.baseColor.rgb, 0.04f, surface.metalness);
|
float3 diffuse = irradiance * lerp(surface.baseColor.rgb, 0.04f, surface.metalness);
|
||||||
float3 specularCol = ((specular + surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
|
float3 specularCol = ((specular * surface.baseColor.rgb) * envBRDF.x + envBRDF.y)*surface.metalness;
|
||||||
|
|
||||||
float horizonOcclusion = 1.3;
|
float horizonOcclusion = 1.3;
|
||||||
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
||||||
horizon *= horizon;
|
horizon *= horizon;
|
||||||
|
|
||||||
// Final color output after environment lighting
|
// Final color output after environment lighting
|
||||||
float3 finalColor = diffuse + specularCol;
|
float3 finalColor = diffuse + specularCol*horizon;
|
||||||
finalColor *= surface.ao;
|
finalColor *= surface.ao;
|
||||||
|
|
||||||
if(isCapturing == 1)
|
if(isCapturing == 1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue