Merge branch 'PBR_ProbeArrayGLWIP' of https://github.com/Areloch/Torque3D into PBR_ProbeArrayGLWIP

This commit is contained in:
AzaezelX 2019-04-29 00:32:40 -05:00
commit de385bc220
3 changed files with 14 additions and 14 deletions

View file

@ -357,7 +357,7 @@ void GFXGLCubemapArray::init(GFXCubemapHandle *cubemaps, const U32 cubemapCount)
if (isCompressed)
{
const U32 mipDataSize = getCompressedSurfaceSize(mFormat, mSize, mSize, currentMip);
glCompressedTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, currentMip, GFXGLTextureInternalFormat[mFormat], 0, 0, i * 6 + face, 0, mipDataSize, pixelData);
glCompressedTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, currentMip, 0, 0, i * 6 + face, mipSize, mipSize, 1, GFXGLTextureFormat[mFormat], GFXGLTextureType[mFormat], pixelData);
}
else
{
@ -418,7 +418,7 @@ void GFXGLCubemapArray::updateTexture(const GFXCubemapHandle &cubemap, const U32
if (isCompressed)
{
const U32 mipDataSize = getCompressedSurfaceSize(mFormat, mSize, mSize, currentMip);
glCompressedTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, currentMip, GFXGLTextureInternalFormat[mFormat], 0, 0, slot * 6 + face, 0, mipDataSize, pixelData);
glCompressedTexSubImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, currentMip, 0, 0, slot * 6 + face, mipSize, mipSize, 1, GFXGLTextureFormat[mFormat], GFXGLTextureType[mFormat], pixelData);
}
else
{

View file

@ -673,7 +673,7 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
continue;
}
}*/
if(!curEntry.mIsSkylight)
if (!curEntry.mIsSkylight)
{
/*probePositions[effectiveProbeCount] = curEntry.getPosition();
probeRefPositions[effectiveProbeCount] = curEntry.mProbeRefOffset;
@ -707,8 +707,7 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
}
//check for skylight action
if (probeShaderConsts->mHasSkylight->isValid()
&& probeShaderConsts->mSkylightIrradMap->isValid()
if (probeShaderConsts->mSkylightIrradMap->isValid()
&& probeShaderConsts->mSkylightSpecularMap->isValid())
{
//Array rendering

View file

@ -387,27 +387,28 @@ float4 computeForwardProbes(Surface surface,
}
}*/
if (hasSkylight && alpha > 0.001)
{
irradiance += TORQUE_TEXCUBELOD(skylightIrradMap, float4(surface.R, 0)).xyz * alpha;
specular += TORQUE_TEXCUBELOD(skylightSpecularMap, float4(surface.R, lod)).xyz * alpha;
}
//if (hasSkylight && alpha > 0.001)
//{
irradiance += TORQUE_TEXCUBELOD(skylightIrradMap, float4(surface.R, 0)).xyz;
specular = TORQUE_TEXCUBELOD(skylightSpecularMap, float4(surface.R, lod)).xyz;
//}
float3 F = FresnelSchlickRoughness(surface.NdotV, surface.f0, surface.roughness);
//energy conservation
float3 kD = 1.0.xxx - F;
kD *= clamp(1.0 - surface.metalness, 0.1, 1);
kD *= clamp(1.0 - surface.metalness, 0.2, 1);
//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 * surface.ao, 1.0);
float4 finalColor = float4(diffuse + specular, 1.0);
//finalColor = float4(max(diffuse, specular),1);
finalColor = float4(specular,1);
return finalColor;
}