Download
chapter 14 n.
Skip this Video
Loading SlideShow in 5 Seconds..
CHAPTER 14 PowerPoint Presentation

CHAPTER 14

168 Vues Download Presentation
Télécharger la présentation

CHAPTER 14

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. CHAPTER 14 Physics Modeling © 2008 Cengage Learning EMEA

  2. LEARNING OBJECTIVES • In this chapter you will learn about: • The fundamentals of physics • Time • Position • Mass and weight • Velocity • Acceleration • Force • Momentum • Physics modeling and implementation • Linear momentum • Gravitational pull • Trajectory paths • Friction • Object collisions • Implementing a particle system

  3. FUNDAMENTALS OF PHYSICS • Video games originally featured a very small amount of physics simulation, with games like Breakout (released by Atari in 1976) incorporating a limited degree of collision detection and response to simulate the destruction of bricks upon collision with a ball, as well as the bouncing of this ball upon impact with the movable paddle.

  4. FUNDAMENTALS OF PHYSICS • During the 1990s, concepts such as gravity and the fundamental laws of physics were steadily finding their way into games. • It wasn’t, however, until the release of games like Valve Software’s Half Life 2 that true physics simulation really contributed to the overall game play experience. • Half Life 2 included numerous physics-based puzzles where the player, for example, had to use gravity by removing bricks from one end of a pulley system to lower the other end, etc. • Physics has thus found its way into games for the realistic simulation of object-player interaction as well as for the animation of objects based on exerted forces and environmental resistance.

  5. FUNDAMENTALS OF PHYSICS • One interesting development in the world of physics is dedicated Physics Processing Units or PPUs.

  6. FUNDAMENTALS OF PHYSICS • Most physics simulations are based on Newton’s laws of motion – three laws describing the relationship between the forces influencing a rigid body and the resulting motion of this body. • Newton’s laws of motion can be summarized as follows: 1 The first law: law of inertia: - A body in motion will remain in motion unless a net force is exerted upon it. 2 The second law: law of acceleration: - The net force of a particle is the rate of change of its linear momentum. - Momentum is the mass of the body multiplied by its velocity. - The force on a body is thus its mass multiplied by its acceleration (F = ma). 3 The third law: law of reciprocal actions: - To every action there is an equal and opposite reaction.

  7. FUNDAMENTALS OF PHYSICS • Computer games will rarely implement physics or Newton’s laws of motion down to the letter. • Doing so will leave little if any processing power for the game’s AI, networking, game loop, etc. • We will thus rather outline the physics needed and simulate the required effects as close to real life as possible, hence creating an extremely close approximation but using a lot of optimizations and assumptions to simplify the original laws of motion.

  8. Time • Time is perhaps the most critical part of any simulation – an abstract concept spanning science, philosophy and art. • Time in the real word is, of course, a basic concept and a core element of the human intellectual structure. • In physics, time is considered a fundamental quantity meaning that it can’t be defined in terms of other quantities such as force or momentum because these concepts are already defined in terms of time.

  9. Time • When designing an algorithm for use in a simple game (such as the Breakout example previously discussed) it is more common to define time around the game’s frame rate than in terms of seconds, minutes, hours, and so forth. • For most of these games, one frame is normally taken as one second or one time-step. • More advanced games, such as 3D first-person shooters, require a real time system operating independently from the game’s frame rate. • Using real time (seconds) as opposed to virtual time (frames) is required when modeling movement and forces without the end result being unrealistically influenced by changes in the game’s frame rate.

  10. Position • Each point in 3D space can be identified in terms of an x-, y- and z-coordinate – the point’s spatial position.

  11. Mass and Weight • Mass is a fundamental concept describing an object’s atomic mass or the amount of matter used to make up an object. • The physical concept of mass must not be confused with the weight of an object. • Weight is directly proportional to the amount of gravitational pull exerted upon the mass of an object, for example, a person might weigh 80 kilograms on earth but will only weigh about 14 kilograms on the moon. • The mass of this person will however remain constant.

  12. Velocity • Velocity can be described as the rate of change of an object’s position. Velocity, measured in meters per second (m/s), has both magnitude (speed) and direction, and is thus described as a vector quantity. • We use the following formula to mathematically describe velocity (v):

  13. Acceleration • Acceleration is the rate of change of velocity. Acceleration, measured in meters per second2 (m/s2), has both magnitude and direction, and is thus also described as a vector quantity. • We use the following formula to mathematically describe acceleration (a):

  14. Force • Force is the physical action exerted upon an object to accelerate it. • There is thus a relationship between the mass of the object, the force exerted upon it and the resulting acceleration; and according to Newton’s second law of motion, we can calculate the force (F) on a body by multiplying its mass (m) with its acceleration (a), resulting in the following equation:

  15. Force

  16. Momentum • Momentum is the product of mass and velocity, i.e. a property inherent to objects in motion. • We use the following formula to mathematically describe momentum (P):

  17. PHYSICS MODELING AND IMPLEMENTATION • Simulating Newtonian physics through the use of quantities such as mass, acceleration, velocity, friction, momentum, and force allows for the prediction of object behaviour under certain conditions. • Physics modeling is generally implemented as part of a physics engine. • Physics engines are classified into two classes: real-time engines such as the Havok physics engine and high-precision physics engines such as those used by scientists. • Real-time physics engines ‘approximate’ physics modeling to balance computational accuracy with the speed of the simulation. • Scientific physics engines are employed by organizations like NASA and universities for various simulations

  18. PHYSICS MODELING AND IMPLEMENTATION

  19. Linear Momentum • Action-oriented games without collisions would simply not work. Whether it’s a projectile fired from a weapon striking a monster, a car skidding across the Daytona Speedway or the player activating a switch; without the ability to simulate one object striking another we would simply not ‘have game.’ • At the core of collision simulation is the conservation and transfer of momentum.

  20. Linear Momentum • A well-known example demonstrating the conservation and transfer of momentum is Newton’s cradle – a device consisting of five (or more) pendulums neighbouring one another.

  21. Gravitational Pull • When looking at any early 1990s side-scrolling game, such as Super Mario World or Commander Keen, one can quickly see the effect of gravity on the player. • For example, jumping vertically into the air is quickly followed by the game character returning to its previous position. • This is an early example of gravity in games, with modern games modeling gravity much more closely. • Gravity is the natural phenomenon where objects attract each other due to each object being surrounded by a gravitational field. • Simulating gravity in games does not generally require advanced calculations that involve the universal gravitational constant or the exact mass of an object.

  22. Gravitational Pull [see the textbook for an example and detailed discussion].

  23. Trajectory Paths • Without accurate projectile simulation, we would not be able to model bomb drops from aeroplanes, a kickoff in a football game, or the trajectory of a baseball after being hit by a batter.

  24. Trajectory Paths • Trajectory can be described as the path or course travelled by an object. • Calculating this path often requires the consideration of gravitational forces, aerodynamic factors, wind shear, etc. • For most game-based implementations we’ll assume uniform gravity while negating wind and other aerodynamic factors. [see the textbook for an example and detailed discussion].

  25. Friction • Friction, stemming from electromagnetic forces between atomic particles, is an energy-consuming force between two objects in contact. • The most common form of friction is known as Coulomb friction. [see the textbook for an example and detailed discussion].

  26. Introduction to Object Collisions • The game Asteroids illustrates the basic problem of collision detection and response in one of the simplest forms possible.

  27. Introduction to Object Collisions • The game Breakout features a ball that can either bounce from the boundaries of the game window or movable paddle while also destroying bricks upon collision. • Bouncing the ball off the screen boundaries requires very basic collision detection mainly because we already know where the boundaries of the screen are while at the same time only considering collisions with two horizontal and two vertical edges. • Also, an object such as the ball in Breakout will always reflect at an angle equal and opposite to its initial incoming angle.

  28. Introduction to Object Collisions [see the textbook for an example and detailed discussion].

  29. PARTICLE SYSTEMS • A particle system is a graphics subsystem used to simulate certain natural phenomena such as fire, smoke, sparks, explosions, dust, magic spells, trail effects, etc.

  30. PARTICLE SYSTEMS • Particle systems are usually implemented using three stages: • the setup stage • the simulation stage • the rendering stage. [see the textbook for an example and detailed discussion].