Added fetch for BRDF texture for forward rendering use, re-enabled brdf logic in the lighting shader and got the probe arrays properly sampling into forward as well.

TODO: core::rendering pref on the BRDF texture instead of hardcode path, add best-pick logic for forward probes and double-check ogl forward is playing nice.
This commit is contained in:
Areloch 2019-05-02 00:05:12 -05:00
parent 98a3ff604a
commit 4e557aec83
6 changed files with 40 additions and 21 deletions

View file

@ -370,7 +370,7 @@ float4 computeForwardProbes(Surface surface,
float lod = surface.roughness*cubeMips;
float alpha = 1;
/*for (i = 0; i < numProbes; ++i)
for (i = 0; i < numProbes; ++i)
{
float contrib = contribution[i];
if (contrib != 0)
@ -382,7 +382,7 @@ float4 computeForwardProbes(Surface surface,
specular += TORQUE_TEXCUBEARRAYLOD(specularCubemapAR, dir, cubemapIdx, lod).xyz * contrib;
alpha -= contrib;
}
}*/
}
if (hasSkylight && alpha > 0.001)
{
@ -394,16 +394,16 @@ float4 computeForwardProbes(Surface surface,
//energy conservation
float3 kD = 1.0.xxx - F;
kD *= clamp(1.0 - surface.metalness, 0.2, 1);
kD *= 1.0 - surface.metalness;
//apply brdf
//Do it once to save on texture samples
float2 brdf = TORQUE_TEX2DLOD(BRDFTexture,float4(surface.roughness, surface.NdotV, 0.0, 0.0)).xy;
//specular *= brdf.x * F + brdf.y;
specular *= brdf.x * F + brdf.y;
//final diffuse color
float3 diffuse = kD * irradiance * surface.baseColor.rgb;
float4 finalColor = float4(diffuse + specular, 1.0);
float4 finalColor = float4(diffuse + specular, 1);
return finalColor;
}