Download

[Chaos][Bug][4.26]Bug in AABB.ispc resulting a bad Bounding Box in Intel x64 platform.

**Conclusion:
I found what caused this bug in GrowToInclude(uniform FVector8 &MinMax, const uniform FVector8& V)
The function is missing two comparison phases.
For the FVector4 version of GrowToInclude, there are 4 comparisons done:


 MinToNewSpace Min? MinForward
MaxToNewSpace Max? MinForward
MinToNewSpace Min? MaxForward
MaxToNewSpace Max? MaxForward

But for FVector8, there are two comparisons missing:
The Max vector of MinMaxToNewSpace’s Max part with ForwardVectorTransform’s Min part;
The Min vector of MinMaxToNewSpace’s Min part with ForwardVectorTransform’s Max part;**

This is how fixed code look like:



inline static void GrowToInclude(uniform FVector8 &MinMax, const uniform FVector8& V)
{
const uniform FVector8 MinV = SetVector8(
(MinMax.V[0] < V.V[4] ? MinMax.V[0] : V.V[4] ),
(MinMax.V[1] < V.V[5] ? MinMax.V[1] : V.V[5] ),
(MinMax.V[2] < V.V[6] ? MinMax.V[2] : V.V[6] ),
(MinMax.V[3] < V.V[7] ? MinMax.V[3] : V.V[7] ),
FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX);


const uniform FVector8 MaxV = SetVector8(-FLT_MAX, -FLT_MAX, -FLT_MAX, -FLT_MAX,
(MinMax.V[4] > V.V[0] ? MinMax.V[4] :V.V[0]),
(MinMax.V[5] > V.V[1] ? MinMax.V[5] :V.V[1]),
(MinMax.V[6] > V.V[2] ? MinMax.V[6] :V.V[2]),
(MinMax.V[7] > V.V[3] ? MinMax.V[7] :V.V[3]));


MinMax = VectorMin(MinMax, MinV);
MinMax = VectorMax(MinMax, MaxV);
}


I will submit a request to git.

So I recently started to learn Chaos and it’s subsystems and found a bug.
To reproduce:
1:Enable chaos and compile the editor;
2:Put a Cone into scene and set rotation to (Pitch=-9.492981,Yaw=-56.521393,Roll=-131.228333)
3:Enable following CVars:

  • p.Chaos.DebugDrawing 1
  • p.Chaos.Solver.DebugDrawBounds 1
    Hit simulate, you’ll see a bad bounding box

To do some additional test, you could try to cast a ray trace:
3332.gif

I found that the dev team has fixed this bug:


inline static void GrowToInclude(uniform FVector8 &MinMax, const uniform FVector8& V)
{
const uniform FVector8 VReverse = SetVector8(V.V[4], V.V[5], V.V[6], V.V[7], V.V[0], V.V[1], V.V[2], V.V[3]);

const uniform FVector8 Min = VectorMin(VectorMin(MinMax, V), VReverse);
const uniform FVector8 Max = VectorMax(VectorMax(MinMax, V), VReverse);

MinMax = SetVector8(Min.V[0], Min.V[1], Min.V[2], Min.V[3], Max.V[4], Max.V[5], Max.V[6], Max.V[7]);
}