mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
suggested alterations to the probe.worldToLocal math feeding and usage (and a divnull safety for attenuation)
This commit is contained in:
parent
3afbdff871
commit
edcdd21379
2 changed files with 10 additions and 3 deletions
|
|
@ -69,11 +69,11 @@ float defineBoxSpaceInfluence(Surface surface, ProbeData probe, float3 wsEyeRay)
|
|||
float3 boxMinLS = mul(probe.worldToLocal, float4(probe.boxMin, 1.0)).xyz;
|
||||
float3 boxMaxLS = mul(probe.worldToLocal, float4(probe.boxMax, 1.0)).xyz;
|
||||
|
||||
float boxOuterRange = length(boxMaxLS - boxMinLS);
|
||||
float boxOuterRange = 2;//length(boxMaxLS - boxMinLS);
|
||||
float boxInnerRange = boxOuterRange / probe.attenuation;
|
||||
|
||||
float3 localDir = float3(abs(surfPosLS.x), abs(surfPosLS.y), abs(surfPosLS.z));
|
||||
localDir = (localDir - boxInnerRange) / (boxOuterRange - boxInnerRange);
|
||||
localDir = (localDir - boxInnerRange) / max((boxOuterRange - boxInnerRange),0.0001);
|
||||
|
||||
float contribution = max(localDir.x, max(localDir.y, localDir.z)) * -1;
|
||||
return contribution;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue