Graphics Reference
In-Depth Information
force, G is the gravitational constant, m 1 and m 2 are the masses of the two objects, and r is
the distance between their center of mass:
(12.6)
According to this relationship, we can see that the closer two objects are to each
other, the greater the attractive gravitational force between them becomes. In addition,
the more massive the objects are the greater this force is as well. This makes sense when
considering a black hole, which represents a singularity of infinitely large mass (this is a
simplification, but it will serve as an adequate explanation for our purposes). If an object
approaches a black hole, at some point it will be too close to the black hole and will be
dragged into it. The acceleration of the particle caused by the gravitational force is calcu-
lated with Newton's second law, which is shown in Equation (12.7). The acceleration can
be found by dividing the gravitational force by the mass of the object that it is acting on:
(12.7)
In the context of our simulation, the black hole will represent a very large mass instead
of an infinite mass, due to the obvious calculation issues with using infinite numbers. Each
particle will have a fixed mass and will be subjected to the gravitational pull of the black hole.
In addition to the gravitational effects on the particles, they will be created with a randomized
initial velocity as they are emitted from the particle emitter. This will let the user see where
the particle emissions are coming from, in addition to where they are being attracted to. To
calculate the particle velocity after each simulation step, we will use Equation (12.8) where
v 0 is the initial velocity at the beginning of the time step, a is the acceleration caused by the
gravitational force, and t is the amount of time that has passed in this time step:
(12.8)
After the new velocity of the particle has been determined, we can determine the modi-
fied position of the particle over the current time step. This is performed as shown in Equation
(12.9). With these basic physical interactions clarified, we can continue to the implementa-
tion design that will use the GPU to efficiently simulate how these bodies will interact:
(12.9)
12.2.2 Implementation Design
The concept of a particle system is well known, but implementing one with the help
of the new features of Direct3D 11 is not. In this section we will explore one possible
Search WWH ::




Custom Search