by Rajshree Chabukswar, Adam T. Lake, and Mary R. Lee, Intel® Software Solutions Group
Learn how to decouple rendering and physical simulation in a multi-threaded environment with a simple physical simulation demonstration. The sample code provided with this paper can either be used as an example or adapted directly into your game engine.
This paper demonstrates bouncing spheres within a cube with sphere-sphere and sphere-plane collision detection mechanisms implemented using Newtonian physics. Initially, spheres collide with each other and the walls of the enclosing cube. After collision is detected, collision response code is executed to calculate the new velocity. The user has an option to run either a multi-threaded or single threaded version. Threading is implemented to compute physics equations in a separate thread while rendering takes place in the main thread.
The goal is to showcase how to use separate threads to perform CPU intensive physics computations independent of the actual rendering process. It is beneficial to use multiple threads to perform different tasks since future processor architectures are moving towards multiple cores. Hence, the performance of an application can be increased by having multiple threads work individually to take advantage of available CPU cycles. The paper first discusses the basics of this implementation followed by the physics concepts used in our demo. Future work and reference section is also included.