mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-26 06:45:36 +00:00
shift attenuation to probes in general.
This commit is contained in:
parent
67ae3d136b
commit
5a2ec2731f
8 changed files with 21 additions and 31 deletions
|
|
@ -351,8 +351,9 @@ vec4 compute4Lights( Surface surface,
|
|||
//Probe IBL stuff
|
||||
float defineSphereSpaceInfluence(vec3 wsPosition, vec3 wsProbePosition, float radius)
|
||||
{
|
||||
vec3 L = wsProbePosition.xyz - wsPosition;
|
||||
float contribution = 1.0 - length(L) / radius;
|
||||
float3 L = (wsProbePosition.xyz - wsPosition);
|
||||
float innerRadius = radius-(radius*atten);
|
||||
float contribution = 1.0-saturate(mix(length(L), radius-innerRadius, atten)/radius);
|
||||
return saturate(contribution);
|
||||
}
|
||||
|
||||
|
|
@ -436,7 +437,7 @@ vec4 computeForwardProbes(Surface surface,
|
|||
}
|
||||
else if (inProbeConfigData[i].r == 1) //sphere
|
||||
{
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, inProbeConfigData[i].g)*atten;
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, inProbeConfigData[i].g, inProbeConfigData[i].b*atten);
|
||||
}
|
||||
|
||||
if (contribution[i]>0.0)
|
||||
|
|
@ -593,7 +594,7 @@ vec4 debugVizForwardProbes(Surface surface,
|
|||
}
|
||||
else if (inProbeConfigData[i].r == 1) //sphere
|
||||
{
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, inProbeConfigData[i].g);
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, inProbeConfigData[i].g, inProbeConfigData[i].b);
|
||||
if (contribution[i] > 0.0)
|
||||
probehits++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -352,10 +352,11 @@ float4 compute4Lights( Surface surface,
|
|||
}
|
||||
|
||||
//Probe IBL stuff
|
||||
float defineSphereSpaceInfluence(float3 wsPosition, float3 wsProbePosition, float radius)
|
||||
float defineSphereSpaceInfluence(float3 wsPosition, float3 wsProbePosition, float radius, float atten)
|
||||
{
|
||||
float3 L = wsProbePosition.xyz - wsPosition;
|
||||
float contribution = 1.0 - length(L) / radius;
|
||||
float3 L = (wsProbePosition.xyz - wsPosition);
|
||||
float innerRadius = radius-(radius*atten);
|
||||
float contribution = 1.0-saturate(lerp(length(L), radius-innerRadius, atten)/radius);
|
||||
return saturate(contribution);
|
||||
}
|
||||
|
||||
|
|
@ -441,7 +442,7 @@ float4 computeForwardProbes(Surface surface,
|
|||
}
|
||||
else if (inProbeConfigData[i].r == 1) //sphere
|
||||
{
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, inProbeConfigData[i].g)*atten;
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, inProbeConfigData[i].g, inProbeConfigData[i].b*atten);
|
||||
}
|
||||
|
||||
if (contribution[i]>0.0)
|
||||
|
|
@ -599,7 +600,7 @@ float4 debugVizForwardProbes(Surface surface,
|
|||
}
|
||||
else if (inProbeConfigData[i].r == 1) //sphere
|
||||
{
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, inProbeConfigData[i].g);
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, inProbeConfigData[i].g, inProbeConfigData[i].b);
|
||||
if (contribution[i] > 0.0)
|
||||
probehits++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ void main()
|
|||
}
|
||||
else if (probeConfigData[i].r == 1) //sphere
|
||||
{
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, probePosArray[i].xyz, probeConfigData[i].g)*atten;
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, probePosArray[i].xyz, probeConfigData[i].g, probeConfigData[i].b*atten);
|
||||
}
|
||||
|
||||
if (contribution[i]>0.0)
|
||||
|
|
|
|||
|
|
@ -83,12 +83,12 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
|||
|
||||
float atten =1.0-(length(eyePosWorld-probePosArray[i].xyz)/maxProbeDrawDistance);
|
||||
if (probeConfigData[i].r == 0) //box
|
||||
{
|
||||
{
|
||||
contribution[i] = defineBoxSpaceInfluence(surface.P, worldToObjArray[i], probeConfigData[i].b)*atten;
|
||||
}
|
||||
else if (probeConfigData[i].r == 1) //sphere
|
||||
else if (probeConfigData[i].r == 1) //sphere
|
||||
{
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, probePosArray[i].xyz, probeConfigData[i].g)*atten;
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, probePosArray[i].xyz, probeConfigData[i].g, probeConfigData[i].b*atten);
|
||||
}
|
||||
|
||||
if (contribution[i]>0.0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue