Ver código fonte

refbox calc parity, and killed off some doubled up alpha subtraction

AzaezelX 6 anos atrás
pai
commit
e83eabcb87

+ 2 - 2
Engine/source/renderInstance/renderProbeMgr.cpp

@@ -639,8 +639,8 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData,
          probeWorldToObjArray[effectiveProbeCount] = curEntry.getTransform();
 
          Point3F refPos = curEntry.getPosition() + curEntry.mProbeRefOffset;
-         Point3F refBoxMin = refPos - curEntry.mProbeRefScale * curEntry.getTransform().getScale();
-         Point3F refBoxMax = refPos + curEntry.mProbeRefScale * curEntry.getTransform().getScale();
+         Point3F refBoxMin = refPos - curEntry.mProbeRefScale/2 * curEntry.getTransform().getScale();
+         Point3F refBoxMax = refPos + curEntry.mProbeRefScale/2 * curEntry.getTransform().getScale();
 
          refBoxMinArray[mEffectiveProbeCount] = Point4F(refBoxMin.x, refBoxMin.y, refBoxMin.z, 0);
          refBoxMaxArray[mEffectiveProbeCount] = Point4F(refBoxMax.x, refBoxMax.y, refBoxMax.z, 0);

+ 1 - 4
Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl

@@ -385,11 +385,8 @@ float4 computeForwardProbes(Surface surface,
       {
          blendFactor[i] *= invBlendSumWeighted;
          contribution[i] *= blendFactor[i];
-         alpha -= contribution[i];
       }
    }
-   else
-      alpha -= blendSum;
 
 #if DEBUGVIZ_ATTENUATION == 1
       float contribAlpha = 1;
@@ -432,7 +429,7 @@ float4 computeForwardProbes(Surface surface,
    for (i = 0; i < numProbes; ++i)
    {
       float contrib = contribution[i];
-      if (contrib != 0)
+      if (contrib > 0.0f)
       {
          int cubemapIdx = probeConfigData[i].a;
          float3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refBoxMinArray[i].xyz, refBoxMaxArray[i].xyz, inRefPosArray[i].xyz);

+ 4 - 8
Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/reflectionProbeArrayP.hlsl

@@ -61,8 +61,8 @@ float4 main(PFXVertToPix IN) : SV_TARGET
    //Set up our struct data
    float contribution[MAX_PROBES];
 
-   //if (alpha > 0)
-   //{
+   if (alpha > 0)
+   {
       //Process prooooobes
       for (i = 0; i < numProbes; ++i)
       {
@@ -113,11 +113,8 @@ float4 main(PFXVertToPix IN) : SV_TARGET
          {
                blendFactor[i] *= invBlendSumWeighted;
                contribution[i] *= blendFactor[i];
-               alpha -= contribution[i];
          }
       }
-      else
-         alpha -= blendSum;
       
 #if DEBUGVIZ_ATTENUATION == 1
       float contribAlpha = 1;
@@ -144,7 +141,7 @@ float4 main(PFXVertToPix IN) : SV_TARGET
 
       return float4(finalContribColor, 1);
 #endif
-   //}
+   }
 #endif
 
    float3 irradiance = float3(0, 0, 0);
@@ -158,11 +155,10 @@ float4 main(PFXVertToPix IN) : SV_TARGET
 #endif
 
 #if SKYLIGHT_ONLY == 0
-   alpha = 1;
    for (i = 0; i < numProbes; ++i)
    {
       float contrib = contribution[i];
-      if (contrib != 0)
+      if (contrib > 0.0f)
       {
          int cubemapIdx = probeConfigData[i].a;
          float3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refBoxMinArray[i].xyz, refBoxMaxArray[i].xyz, inRefPosArray[i].xyz);