mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-19 06:33:49 +00:00
cleanups and perf: only need to subtract the alpha post-blending, not pre and post, contribution>1 shouldn't happen, so max(result,0) suffices, and no need for a for-all-probes-loop if we already know ya only got one probe hitting the pixel under examination.
This commit is contained in:
parent
679c2c7fb0
commit
9b2b87c569
1 changed files with 10 additions and 14 deletions
|
|
@ -202,34 +202,30 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
|||
probehits++;
|
||||
}
|
||||
|
||||
if (probes[i].contribution>1 || probes[i].contribution<0)
|
||||
probes[i].contribution = 0;
|
||||
probes[i].contribution = max(probes[i].contribution,0);
|
||||
|
||||
blendSum += probes[i].contribution;
|
||||
invBlendSum += (1.0f - probes[i].contribution);
|
||||
|
||||
alpha -= probes[i].contribution;
|
||||
}
|
||||
|
||||
// Weight0 = normalized NDF, inverted to have 1 at center, 0 at boundary.
|
||||
// And as we invert, we need to divide by Num-1 to stay normalized (else sum is > 1).
|
||||
// respect constraint B.
|
||||
// Weight1 = normalized inverted NDF, so we have 1 at center, 0 at boundary
|
||||
// and respect constraint A.
|
||||
for (i = 0; i < numProbes; i++)
|
||||
if (probehits>1.0)
|
||||
{
|
||||
if (probehits>1.0)
|
||||
{
|
||||
blendFactor[i] = ((probes[i].contribution / blendSum)) / (probehits - 1);
|
||||
for (i = 0; i < numProbes; i++)
|
||||
{
|
||||
blendFactor[i] = ((probes[i].contribution / blendSum)) / (probehits - 1);
|
||||
blendFactor[i] *= ((probes[i].contribution) / invBlendSum);
|
||||
blendFacSum += blendFactor[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
blendFactor[i] = probes[i].contribution;
|
||||
blendFacSum = probes[i].contribution;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
blendFactor[i] = probes[i].contribution;
|
||||
blendFacSum = probes[i].contribution;
|
||||
}
|
||||
|
||||
|
||||
// Normalize blendVal
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue