Box3D implemented wide SIMD to process multiple edge pairs simultaneously, improving collision detection speed in its physics engine.
Box3D implemented wide SIMD to process multiple edge pairs simultaneously, improving collision detection speed in its physics engine.
The approach, called wide SIMD, allows a single edge from one hull to be compared with four edges from another hull in a single operation. Narrow SIMD processes individual 3‑vector elements using standard intrinsics, providing smaller performance gains. The technique is applicable in three dimensions, where 2‑D vector SIMD does not offer the same opportunity.
The convex pile benchmark uses 5120 convex hulls, each containing 32 points and 89 edges, referred to as a boulder. Box3D’s Separating Axis Test (SAT) determines contact normals and points by testing faces against vertices and edges of opposing hulls. With two hulls, the algorithm must evaluate face‑vertex, vertex‑face, and edge‑edge combinations, resulting in a quadratic number of tests.
In the benchmark, edge‑edge tests dominate execution time. With 12 edges per hull, SIMD offers limited benefit because data must be rearranged into a structure of arrays format. When each hull contains 89 edges, the algorithm performs 7921 edge‑edge comparisons, and wide SIMD can test four edges at once, reducing the number of operations.
The author reported performance numbers from testing on an AMD 7950X running at 4.42 GHz, showing the following times for a 500‑step simulation: scalar 40706 ms, SSE2 17337 ms, and AVX2‑Lite 15762 ms at one thread; the scalar column reflects the contact solver running in scalar mode, indicating the full simulation duration. Performance improved by more than twofold with SSE2 and by an additional 10 % with AVX2‑Lite as thread count increased, with the best time reaching 5292 ms using eight threads.
Box3D currently implements SSE2 intrinsics only; Box2D provides AVX2 support. Enabling the AVX2 architecture in Box3D yields measurable speed improvements, though the gain is smaller than the difference between scalar and SSE2. The optimization benefits complex hulls, such as those encountered during destruction events, and does not affect simple box‑box collisions.
The author provided a video comparison showing frame timings, and noted that further AVX2 implementation testing eight edges at a time is planned. The 128‑edge storage limit in Box3D may constrain future hull complexity, and converting hulls to meshes could mitigate quadratic growth but reduces suitability for dynamic bodies.
- Publisher
- Hacker News
- Reliability
- high
- Published
- 7/26/2026, 10:00:17 AM
- Retrieved
- 7/26/2026, 10:00:17 AM
- Relevance
- 80%
- Confidence
- 85%

