mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Revert "take ibl amount into account for translucent opacity"
This commit is contained in:
parent
e9a8961543
commit
854bea3246
|
|
@ -3055,7 +3055,7 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
|
|||
Var *ibl = (Var *)LangElement::find("ibl");
|
||||
if (!ibl)
|
||||
{
|
||||
ibl = new Var("ibl", "float4");
|
||||
ibl = new Var("ibl", "float3");
|
||||
}
|
||||
|
||||
Var* eyePos = (Var*)LangElement::find("eyePosWorld");
|
||||
|
|
@ -3086,7 +3086,7 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
|
|||
//Reflection vec
|
||||
String computeForwardProbes = String(" @ = computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t");
|
||||
computeForwardProbes += String("@,@,@,@,@,@,\r\n\t\t");
|
||||
computeForwardProbes += String("@,@); \r\n");
|
||||
computeForwardProbes += String("@,@).rgb; \r\n");
|
||||
|
||||
meta->addStatement(new GenOp(computeForwardProbes.c_str(), new DecOp(ibl), surface, cubeMips, numProbes, worldToObjArray, probeConfigData, inProbePosArray, refScaleArray, inRefPosArray, eyePos,
|
||||
skylightCubemapIdx, SkylightDamp, BRDFTexture, WetnessTexture, accumTime, dampness,
|
||||
|
|
@ -3100,7 +3100,7 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
|
|||
ambient->constSortPos = cspPass;
|
||||
}
|
||||
meta->addStatement(new GenOp(" @.rgb *= @.rgb;\r\n", ibl, ambient));
|
||||
meta->addStatement(new GenOp(" @ = @;\r\n", curColor, ibl));
|
||||
meta->addStatement(new GenOp(" @.rgb = @.rgb;\r\n", curColor, ibl));
|
||||
|
||||
output = meta;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3143,7 +3143,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
Var* ibl = (Var*)LangElement::find("ibl");
|
||||
if (!ibl)
|
||||
{
|
||||
ibl = new Var("ibl", "float4");
|
||||
ibl = new Var("ibl", "float3");
|
||||
}
|
||||
|
||||
Var* eyePos = (Var*)LangElement::find("eyePosWorld");
|
||||
|
|
@ -3174,7 +3174,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
|
||||
String computeForwardProbes = String(" @ = computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t");
|
||||
computeForwardProbes += String("@,@,TORQUE_SAMPLER2D_MAKEARG(@),TORQUE_SAMPLER2D_MAKEARG(@), @, @,\r\n\t\t");
|
||||
computeForwardProbes += String("TORQUE_SAMPLERCUBEARRAY_MAKEARG(@),TORQUE_SAMPLERCUBEARRAY_MAKEARG(@)); \r\n");
|
||||
computeForwardProbes += String("TORQUE_SAMPLERCUBEARRAY_MAKEARG(@),TORQUE_SAMPLERCUBEARRAY_MAKEARG(@)).rgb; \r\n");
|
||||
|
||||
meta->addStatement(new GenOp(computeForwardProbes.c_str(), new DecOp(ibl), surface, cubeMips, numProbes, worldToObjArray, probeConfigData, inProbePosArray, refScaleArray, inRefPosArray, eyePos,
|
||||
skylightCubemapIdx, SkylightDamp, BRDFTexture, WetnessTexture, accumTime, dampness,
|
||||
|
|
@ -3188,7 +3188,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
|
|||
ambient->constSortPos = cspPass;
|
||||
}
|
||||
meta->addStatement(new GenOp(" @.rgb *= @.rgb;\r\n", ibl, ambient));
|
||||
meta->addStatement(new GenOp(" @ = @;\r\n", curColor, ibl));
|
||||
meta->addStatement(new GenOp(" @.rgb = @.rgb;\r\n", curColor, ibl));
|
||||
|
||||
output = meta;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue