فهرست منبع

tweaked the updating behavior in the probe manager so calling updateProbes just flags a ProbesDirty bool, which is used to kick the update of the static parameters when the bin's render() is called
that way if multiple probes get updated at once, we don't hit the update loop for each one, which is obviously silly
also fixed the 'probes' cubemaps aren't ready until you nudge them'
turns out when we were setting out global var which we used for the irradiance and prefilter cubemap paths, it was being set AFTER the probes got loaded
so it was using an invalid path to look up the cubemaps
-@areloch

AzaezelX 6 سال پیش
والد
کامیت
b5436b6cb7

+ 6 - 28
Engine/source/renderInstance/renderProbeMgr.cpp

@@ -182,7 +182,8 @@ void ProbeShaderConstants::_onShaderReload()
 RenderProbeMgr::RenderProbeMgr()
 : RenderBinManager(RenderPassManager::RIT_Probes, 1.0f, 1.0f),
    mLastShader(nullptr),
-   mLastConstants(nullptr)
+   mLastConstants(nullptr),
+	mProbesDirty(false)
 {
    mEffectiveProbeCount = 0;
    mMipCount = 0;
@@ -372,7 +373,7 @@ PostEffect* RenderProbeMgr::getProbeArrayEffect()
 
 void RenderProbeMgr::updateProbes()
 {
-	_setupStaticParameters();
+	mProbesDirty = true;
 }
 
 void RenderProbeMgr::_setupStaticParameters()
@@ -457,31 +458,7 @@ void RenderProbeMgr::_setupStaticParameters()
       mEffectiveProbeCount++;
    }
 
-   /*if (mEffectiveProbeCount != 0)
-   {
-      bool useOldWay = false;
-      if (useOldWay)
-      {
-         //old static way
-         mPrefilterArray = GFXCubemapArrayHandle(GFX->createCubemapArray());
-         mIrradianceArray = GFXCubemapArrayHandle(GFX->createCubemapArray());
-
-         mPrefilterArray->init(cubeMaps.address(), cubeMaps.size());
-         mIrradianceArray->init(irradMaps.address(), irradMaps.size());
-      }
-      else
-      {
-         //faked static way by doing it via update
-         for (U32 i = 0; i < cubemapIdxes.size(); i++)
-         {
-            U32 probeIdx = cubemapIdxes[i];
-
-            const U32 cubeIndex = ProbeRenderInst::all[probeIdx]->mCubemapIndex;
-            mIrradianceArray->updateTexture(irradMaps[i], cubeIndex);
-            mPrefilterArray->updateTexture(cubeMaps[i], cubeIndex);
-         }
-      }
-   }*/
+   mProbesDirty = false;
 }
 
 void RenderProbeMgr::updateProbeTexture(ProbeRenderInst* probe)
@@ -772,7 +749,8 @@ void RenderProbeMgr::render( SceneRenderState *state )
    if (getProbeArrayEffect() == nullptr)
       return;
 
-   //updateProbes();
+   if (mProbesDirty)
+	   _setupStaticParameters();
 
    // Early out if nothing to draw.
    if (!RenderProbeMgr::smRenderReflectionProbes || !state->isDiffusePass() || (!ProbeRenderInst::all.size() || mEffectiveProbeCount == 0 || mCubeMapCount != 0 ) && !hasSkylight)

+ 2 - 0
Engine/source/renderInstance/renderProbeMgr.h

@@ -166,6 +166,8 @@ class RenderProbeMgr : public RenderBinManager
 
    Vector<U32> mRegisteredProbes;
 
+   bool mProbesDirty;
+
    //maximum number of allowed probes
    static const U32 PROBE_MAX_COUNT = 250;
    //maximum number of rendered probes per frame adjust as needed

+ 4 - 1
Templates/Full/game/core/scripts/client/missionDownload.cs

@@ -40,6 +40,10 @@ function clientCmdMissionStartPhase1(%seq, %missionName, %musicTrack)
    // These need to come after the cls.
    echo ("*** New Mission: " @ %missionName);
    echo ("*** Phase 1: Download Datablocks & Targets");
+   
+   $Client::MissionFile = %missionName;
+   $pref::ReflectionProbes::CurrentLevelPath = filePath($Client::MissionFile) @ "/" @ fileBase($Client::MissionFile) @ "/probes/";
+   
    onMissionDownloadPhase1(%missionName, %musicTrack);
    commandToServer('MissionStartPhase1Ack', %seq);
 }
@@ -89,7 +93,6 @@ function clientCmdMissionStartPhase3(%seq,%missionName)
    echo ("*** Phase 3: Mission Lighting");
    $MSeq = %seq;
    $Client::MissionFile = %missionName;
-   $pref::ReflectionProbes::CurrentLevelPath = filePath($Client::MissionFile) @ "/" @ fileBase($Client::MissionFile) @ "/probes/";
 
    // Need to light the mission before we are ready.
    // The sceneLightingComplete function will complete the handshake