Physics simulations in real-time 3D experiences depend on discrete time steps to update motion, collisions, and forces. When objects move too far between frames—due to frame drops, high velocities, or gravity—they may pass through solid surfaces without registering a collision. This issue is known as tunneling.
Substepping addresses this by splitting each frame’s physics update into multiple smaller steps, ensuring more accurate collision detection and stable character movement.
Core Concept
- Without substepping:
- Each frame applies physics once, so a character might “jump” a large distance in a single step.
- Collisions within that gap can be skipped.
- With substepping:
- The frame’s time interval is divided into smaller increments.
- Physics calculations and collision checks occur more frequently, reducing the risk of missing surfaces.
This technique is particularly important in VR and WebXR, where dropped frames and rapid player movement can easily break immersion.
How Substepping Works
- Fixed Interval Updates
- Physics runs at a constant timestep (for example, 60 times per second), independent of rendering speed.
- Even if rendering slows, physics continues in smaller, reliable increments.
- Frame Drop Compensation
- During heavy GPU load or stutters, more than one physics step may be required to “catch up.”
- Substepping divides the accumulated time into several mini-steps rather than applying a single oversized jump.
- Handling Gravity and Velocity
- Gravity applies acceleration over time.
- Without substeps, a long frame can cause a character to fall too far in one update, bypassing the ground.
- Substeps apply gravity in smaller increments, ensuring smooth contact with surfaces.
Core Techniques
- Fixed Timestep Simulation
- Use a consistent physics step size, rather than tying updates to fluctuating framerates.
- Substep Limitations
- Cap the maximum number of substeps per frame to avoid runaway calculations during extreme stalls.
- Hybrid Methods
- Combine substepping with other techniques such as Continuous Collision Detection (CCD) for very fast objects like bullets.
Use Cases
- VR Characters → Prevents the player avatar from clipping through the floor during dropped frames.
- Vehicles → Maintains stable wheel contact on fast-moving cars.
- Platform Games → Ensures characters interact properly with fast-moving platforms.
- Falling Objects → Keeps physics consistent under heavy gravity.
Advantages
- Greatly reduces tunneling without requiring expensive continuous collision checks.
- Keeps physics stable under varying framerates.
- Improves character grounding and collision reliability in VR/WebXR.
Limitations
- More substeps = higher CPU cost.
- Extreme velocities may still require CCD.
- Needs tuning per device (desktop vs. mobile) for best balance between accuracy and performance.