mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-20 23:23:47 +00:00
getDistBoxToPoint max, not length nets us hard edges instea of drounded, float3 extents = probe.boxMax; isn't neded, can use unit space for that and put box min/max back to controlling the reflected boxe's scale. divnull safety
This commit is contained in:
parent
04a6130df8
commit
3aac1421cc
1 changed files with 4 additions and 4 deletions
|
|
@ -65,7 +65,7 @@ float defineSphereSpaceInfluence(Surface surface, ProbeData probe, float3 wsEyeR
|
|||
float getDistBoxToPoint(float3 pt, float3 extents)
|
||||
{
|
||||
float3 d = max(max(-extents - pt, 0), pt - extents);
|
||||
return length(d);
|
||||
return max(max(d.x,d.y),d.z);
|
||||
}
|
||||
|
||||
float defineBoxSpaceInfluence(Surface surface, ProbeData probe, float3 wsEyeRay)
|
||||
|
|
@ -74,7 +74,7 @@ float defineBoxSpaceInfluence(Surface surface, ProbeData probe, float3 wsEyeRay)
|
|||
|
||||
//float3 boxMinLS = mul(probe.worldToLocal, float4(probe.boxMin, 1.0)).xyz;
|
||||
//float3 extents = mul(probe.worldToLocal, float4(probe.boxMax, 1.0)).xyz;
|
||||
float3 extents = probe.boxMax;
|
||||
float3 extents = float3(1,1,1);//probe.boxMax;
|
||||
|
||||
/*float3 boxOuterRange = boxMaxLS;
|
||||
float3 boxInnerRange = boxOuterRange * 0.5;
|
||||
|
|
@ -92,7 +92,7 @@ float defineBoxSpaceInfluence(Surface surface, ProbeData probe, float3 wsEyeRay)
|
|||
float3 reducedExtents = extents - float3(transitionDistance, transitionDistance, transitionDistance);
|
||||
float distToBox = getDistBoxToPoint(surfPosLS * extents, reducedExtents);
|
||||
|
||||
float normalizedDistance = distToBox / transitionDistance;
|
||||
float normalizedDistance = distToBox / max(transitionDistance,0.0001);
|
||||
|
||||
// If closer than 70% to the probe radius, then full contribution is used.
|
||||
// For the other 30% we smoothstep and return contribution lower than 1 so other
|
||||
|
|
@ -376,4 +376,4 @@ float4 main( PFXVertToPix IN ) : SV_TARGET
|
|||
return float4(cubeColor, 1);
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue