diff --git a/Engine/source/gfx/gl/gfxGLCubemap.cpp b/Engine/source/gfx/gl/gfxGLCubemap.cpp index 5c9c1d819..ba06662ad 100644 --- a/Engine/source/gfx/gl/gfxGLCubemap.cpp +++ b/Engine/source/gfx/gl/gfxGLCubemap.cpp @@ -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 { diff --git a/Engine/source/renderInstance/renderProbeMgr.cpp b/Engine/source/renderInstance/renderProbeMgr.cpp index e2c1630e4..cdde3777a 100644 --- a/Engine/source/renderInstance/renderProbeMgr.cpp +++ b/Engine/source/renderInstance/renderProbeMgr.cpp @@ -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 diff --git a/Templates/Full/game/shaders/common/lighting.hlsl b/Templates/Full/game/shaders/common/lighting.hlsl index a1d035f5d..7cdc3d484 100644 --- a/Templates/Full/game/shaders/common/lighting.hlsl +++ b/Templates/Full/game/shaders/common/lighting.hlsl @@ -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; } \ No newline at end of file