Fixed probe cubemap reindexing assignment

Fixed BRDF texture binding in forward pass so it doesn't screw with the probes or regular lighting results during bakes
Fixed early-out check on probe manager so probes can be rendered during reflect pass as well.
This commit is contained in:
Areloch 2019-07-10 23:41:55 -05:00
parent f8750dd8ed
commit 98f50a4453
2 changed files with 7 additions and 5 deletions

View file

@ -817,7 +817,7 @@ void ReflectionProbe::bake()
PROBEMGR->bakeProbe(this);
setMaskBits(StaticDataMask);
setMaskBits(-1);
}
//-----------------------------------------------------------------------------

View file

@ -381,7 +381,7 @@ void RenderProbeMgr::unregisterProbe(U32 probeIdx)
//recalculate all the probe's indicies just to be sure
for (U32 i = 0; i < mRegisteredProbes.size(); i++)
{
mRegisteredProbes[i].mProbeIdx == i;
mRegisteredProbes[i].mProbeIdx = i;
}
//rebuild our probe data
@ -666,8 +666,8 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
shaderConsts->setSafe(probeShaderConsts->mSkylightCubemapIdxSC, (float)skyLightIdx);
if (mBRDFTexture.isValid())
GFX->setTexture(2, mBRDFTexture);
if(probeShaderConsts->mBRDFTextureMap->getSamplerRegister() != -1 && mBRDFTexture.isValid())
GFX->setTexture(probeShaderConsts->mBRDFTextureMap->getSamplerRegister(), mBRDFTexture);
if(probeShaderConsts->mProbeSpecularCubemapSC->getSamplerRegister() != -1)
GFX->setCubeArrayTexture(probeShaderConsts->mProbeSpecularCubemapSC->getSamplerRegister(), mPrefilterArray);
@ -721,7 +721,7 @@ void RenderProbeMgr::render( SceneRenderState *state )
_setupStaticParameters();
// Early out if nothing to draw.
if (!RenderProbeMgr::smRenderReflectionProbes || !state->isDiffusePass() || (mEffectiveProbeCount == 0 && mSkylightCubemapIdx == -1))
if (!RenderProbeMgr::smRenderReflectionProbes || (!state->isDiffusePass() && !state->isReflectPass()) || (mEffectiveProbeCount == 0 && mSkylightCubemapIdx == -1))
{
getProbeArrayEffect()->setSkip(true);
return;
@ -927,6 +927,8 @@ void RenderProbeMgr::bakeProbe(ReflectionProbe *probe)
U32 endMSTime = Platform::getRealMilliseconds();
F32 diffTime = F32(endMSTime - startMSTime);
probe->setMaskBits(-1);
Con::warnf("RenderProbeMgr::bake() - Finished bake! Took %g milliseconds", diffTime);
}