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

This commit is contained in:
AzaezelX 2019-07-14 10:44:50 -05:00
parent d67501a24e
commit 941d8c7eec
3 changed files with 7 additions and 14 deletions

View file

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

View file

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

View file

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