mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 08:04:40 +00:00
Merge pull request #859 from Azaezel/alpha401/probleblendblunder
probe blend adjustments
This commit is contained in:
commit
00d67475e7
4 changed files with 35 additions and 19 deletions
|
|
@ -382,6 +382,7 @@ vec4 computeForwardProbes(Surface surface,
|
||||||
float probehits = 0;
|
float probehits = 0;
|
||||||
//Set up our struct data
|
//Set up our struct data
|
||||||
float contribution[MAX_FORWARD_PROBES];
|
float contribution[MAX_FORWARD_PROBES];
|
||||||
|
float blendCap = 0;
|
||||||
for (i = 0; i < numProbes; ++i)
|
for (i = 0; i < numProbes; ++i)
|
||||||
{
|
{
|
||||||
contribution[i] = 0;
|
contribution[i] = 0;
|
||||||
|
|
@ -401,21 +402,24 @@ vec4 computeForwardProbes(Surface surface,
|
||||||
contribution[i] = 0.0;
|
contribution[i] = 0.0;
|
||||||
|
|
||||||
blendSum += contribution[i];
|
blendSum += contribution[i];
|
||||||
|
blendCap = max(contribution[i],blendCap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (probehits > 1.0)//if we overlap
|
if (probehits > 0.0)
|
||||||
{
|
{
|
||||||
invBlendSum = (probehits - blendSum)/(probehits-1); //grab the remainder
|
invBlendSum = (probehits - blendSum)/probehits; //grab the remainder
|
||||||
for (i = 0; i < numProbes; i++)
|
for (i = 0; i < numProbes; i++)
|
||||||
{
|
{
|
||||||
blendFactor[i] = contribution[i]/blendSum; //what % total is this instance
|
blendFactor[i] = contribution[i]/blendSum; //what % total is this instance
|
||||||
blendFactor[i] *= blendFactor[i] / invBlendSum; //what should we add to sum to 1
|
blendFactor[i] *= blendFactor[i]/invBlendSum; //what should we add to sum to 1
|
||||||
blendFacSum += blendFactor[i]; //running tally of results
|
blendFacSum += blendFactor[i]; //running tally of results
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < numProbes; ++i)
|
for (i = 0; i < numProbes; ++i)
|
||||||
{
|
{
|
||||||
contribution[i] *= blendFactor[i]/blendFacSum; //normalize
|
//normalize, but in the range of the highest value applied
|
||||||
|
//to preserve blend vs skylight
|
||||||
|
contribution[i] = blendFactor[i]/blendFacSum*blendCap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -386,6 +386,8 @@ float4 computeForwardProbes(Surface surface,
|
||||||
float probehits = 0;
|
float probehits = 0;
|
||||||
//Set up our struct data
|
//Set up our struct data
|
||||||
float contribution[MAX_FORWARD_PROBES];
|
float contribution[MAX_FORWARD_PROBES];
|
||||||
|
|
||||||
|
float blendCap = 0;
|
||||||
//Process prooooobes
|
//Process prooooobes
|
||||||
for (i = 0; i < numProbes; ++i)
|
for (i = 0; i < numProbes; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -406,21 +408,24 @@ float4 computeForwardProbes(Surface surface,
|
||||||
contribution[i] = 0.0;
|
contribution[i] = 0.0;
|
||||||
|
|
||||||
blendSum += contribution[i];
|
blendSum += contribution[i];
|
||||||
|
blendCap = max(contribution[i],blendCap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (probehits > 1.0)//if we overlap
|
if (probehits > 0.0)
|
||||||
{
|
{
|
||||||
invBlendSum = (probehits - blendSum)/(probehits-1); //grab the remainder
|
invBlendSum = (probehits - blendSum)/probehits; //grab the remainder
|
||||||
for (i = 0; i < numProbes; i++)
|
for (i = 0; i < numProbes; i++)
|
||||||
{
|
{
|
||||||
blendFactor[i] = contribution[i]/blendSum; //what % total is this instance
|
blendFactor[i] = contribution[i]/blendSum; //what % total is this instance
|
||||||
blendFactor[i] *= blendFactor[i] / invBlendSum; //what should we add to sum to 1
|
blendFactor[i] *= blendFactor[i]/invBlendSum; //what should we add to sum to 1
|
||||||
blendFacSum += blendFactor[i]; //running tally of results
|
blendFacSum += blendFactor[i]; //running tally of results
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < numProbes; ++i)
|
for (i = 0; i < numProbes; ++i)
|
||||||
{
|
{
|
||||||
contribution[i] *= blendFactor[i]/blendFacSum; //normalize
|
//normalize, but in the range of the highest value applied
|
||||||
|
//to preserve blend vs skylight
|
||||||
|
contribution[i] = blendFactor[i]/blendFacSum*blendCap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ void main()
|
||||||
//Set up our struct data
|
//Set up our struct data
|
||||||
float contribution[MAX_PROBES];
|
float contribution[MAX_PROBES];
|
||||||
|
|
||||||
|
float blendCap = 0;
|
||||||
if (alpha > 0)
|
if (alpha > 0)
|
||||||
{
|
{
|
||||||
//Process prooooobes
|
//Process prooooobes
|
||||||
|
|
@ -101,21 +102,24 @@ void main()
|
||||||
contribution[i] = 0;
|
contribution[i] = 0;
|
||||||
|
|
||||||
blendSum += contribution[i];
|
blendSum += contribution[i];
|
||||||
|
blendCap = max(contribution[i],blendCap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (probehits > 1.0)//if we overlap
|
if (probehits > 0.0)
|
||||||
{
|
{
|
||||||
invBlendSum = (probehits - blendSum)/(probehits-1); //grab the remainder
|
invBlendSum = (probehits - blendSum)/probehits; //grab the remainder
|
||||||
for (i = 0; i < numProbes; i++)
|
for (i = 0; i < numProbes; i++)
|
||||||
{
|
{
|
||||||
blendFactor[i] = contribution[i]/blendSum; //what % total is this instance
|
blendFactor[i] = contribution[i]/blendSum; //what % total is this instance
|
||||||
blendFactor[i] *= blendFactor[i] / invBlendSum; //what should we add to sum to 1
|
blendFactor[i] *= blendFactor[i]/invBlendSum; //what should we add to sum to 1
|
||||||
blendFacSum += blendFactor[i]; //running tally of results
|
blendFacSum += blendFactor[i]; //running tally of results
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < numProbes; ++i)
|
for (i = 0; i < numProbes; ++i)
|
||||||
{
|
{
|
||||||
contribution[i] *= blendFactor[i]/blendFacSum; //normalize
|
//normalize, but in the range of the highest value applied
|
||||||
|
//to preserve blend vs skylight
|
||||||
|
contribution[i] = blendFactor[i]/blendFacSum*blendCap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,8 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
||||||
float probehits = 0;
|
float probehits = 0;
|
||||||
//Set up our struct data
|
//Set up our struct data
|
||||||
float contribution[MAX_PROBES];
|
float contribution[MAX_PROBES];
|
||||||
|
|
||||||
|
float blendCap = 0;
|
||||||
if (alpha > 0)
|
if (alpha > 0)
|
||||||
{
|
{
|
||||||
//Process prooooobes
|
//Process prooooobes
|
||||||
|
|
@ -93,21 +94,23 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
||||||
contribution[i] = 0.0;
|
contribution[i] = 0.0;
|
||||||
|
|
||||||
blendSum += contribution[i];
|
blendSum += contribution[i];
|
||||||
|
blendCap = max(contribution[i],blendCap);
|
||||||
}
|
}
|
||||||
|
if (probehits > 0.0)
|
||||||
if (probehits > 1.0)//if we overlap
|
|
||||||
{
|
{
|
||||||
invBlendSum = (probehits - blendSum)/(probehits-1); //grab the remainder
|
invBlendSum = (probehits - blendSum)/probehits; //grab the remainder
|
||||||
for (i = 0; i < numProbes; i++)
|
for (i = 0; i < numProbes; i++)
|
||||||
{
|
{
|
||||||
blendFactor[i] = contribution[i]/blendSum; //what % total is this instance
|
blendFactor[i] = contribution[i]/blendSum; //what % total is this instance
|
||||||
blendFactor[i] *= blendFactor[i] / invBlendSum; //what should we add to sum to 1
|
blendFactor[i] *= blendFactor[i]/invBlendSum; //what should we add to sum to 1
|
||||||
blendFacSum += blendFactor[i]; //running tally of results
|
blendFacSum += blendFactor[i]; //running tally of results
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < numProbes; ++i)
|
for (i = 0; i < numProbes; ++i)
|
||||||
{
|
{
|
||||||
contribution[i] *= blendFactor[i]/blendFacSum; //normalize
|
//normalize, but in the range of the highest value applied
|
||||||
|
//to preserve blend vs skylight
|
||||||
|
contribution[i] = blendFactor[i]/blendFacSum*blendCap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue