mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
changes a bit of the probecount logic to be based on probehit aka, how many probes specifically are hitting a given pixel. allows for attenuation-blended probe to probe, and full-override probe to skylight.
This commit is contained in:
parent
d83dac0bcf
commit
3afbdff871
1 changed files with 12 additions and 8 deletions
|
|
@ -177,6 +177,7 @@ float4 main( PFXVertToPix IN ) : SV_TARGET
|
||||||
float blendFacSum = 0;
|
float blendFacSum = 0;
|
||||||
float invBlendSum = 0;
|
float invBlendSum = 0;
|
||||||
int skyID = 0;
|
int skyID = 0;
|
||||||
|
float probehits = 0;
|
||||||
//Set up our struct data
|
//Set up our struct data
|
||||||
ProbeData probes[MAX_PROBES];
|
ProbeData probes[MAX_PROBES];
|
||||||
|
|
||||||
|
|
@ -197,10 +198,12 @@ float4 main( PFXVertToPix IN ) : SV_TARGET
|
||||||
if (probes[i].type == 0) //box
|
if (probes[i].type == 0) //box
|
||||||
{
|
{
|
||||||
probes[i].contribution = defineBoxSpaceInfluence(surface, probes[i], IN.wsEyeRay);
|
probes[i].contribution = defineBoxSpaceInfluence(surface, probes[i], IN.wsEyeRay);
|
||||||
|
probehits++;
|
||||||
}
|
}
|
||||||
else if (probes[i].type == 1) //sphere
|
else if (probes[i].type == 1) //sphere
|
||||||
{
|
{
|
||||||
probes[i].contribution = defineSphereSpaceInfluence(surface, probes[i], IN.wsEyeRay);
|
probes[i].contribution = defineSphereSpaceInfluence(surface, probes[i], IN.wsEyeRay);
|
||||||
|
probehits++;
|
||||||
}
|
}
|
||||||
else //skylight
|
else //skylight
|
||||||
{
|
{
|
||||||
|
|
@ -223,9 +226,9 @@ float4 main( PFXVertToPix IN ) : SV_TARGET
|
||||||
// and respect constraint A.
|
// and respect constraint A.
|
||||||
for (i = 0; i < numProbes; i++)
|
for (i = 0; i < numProbes; i++)
|
||||||
{
|
{
|
||||||
if (numProbes>1)
|
if (probehits>1.0)
|
||||||
{
|
{
|
||||||
blendFactor[i] = ((probes[i].contribution / blendSum)) / (numProbes - 1);
|
blendFactor[i] = ((probes[i].contribution / blendSum)) / (probehits - 1);
|
||||||
blendFactor[i] *= ((probes[i].contribution) / invBlendSum);
|
blendFactor[i] *= ((probes[i].contribution) / invBlendSum);
|
||||||
blendFacSum += blendFactor[i];
|
blendFacSum += blendFactor[i];
|
||||||
}
|
}
|
||||||
|
|
@ -243,14 +246,15 @@ float4 main( PFXVertToPix IN ) : SV_TARGET
|
||||||
blendFacSum = 1.0f;
|
blendFacSum = 1.0f;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (probehits>1.0)
|
||||||
float invBlendSumWeighted = 1.0f / blendFacSum;
|
|
||||||
for (i = 0; i < numProbes; ++i)
|
|
||||||
{
|
{
|
||||||
blendFactor[i] *= invBlendSumWeighted;
|
float invBlendSumWeighted = 1.0f / blendFacSum;
|
||||||
probes[i].contribution = blendFactor[i];
|
for (i = 0; i < numProbes; ++i)
|
||||||
|
{
|
||||||
|
blendFactor[i] *= invBlendSumWeighted;
|
||||||
|
probes[i].contribution = blendFactor[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUGVIZ_ATTENUATION == 1
|
#if DEBUGVIZ_ATTENUATION == 1
|
||||||
float attenVis = 0;
|
float attenVis = 0;
|
||||||
for (i = 0; i < numProbes; ++i)
|
for (i = 0; i < numProbes; ++i)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue