Final report

33
Rigid Body Car Driving Simulation Cooper Findley, Charles Moyes, and Shentong Wang December 10, 2010

description

 

Transcript of Final report

Page 1: Final report

Rigid Body Car Driving Simulation

Cooper Findley, Charles Moyes, and Shentong Wang

December 10, 2010

Page 2: Final report

Contents

1 Objective 4

2 Prior Work 52.1 Flight Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2 Racer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.3 Commercial Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

3 Rigid Body Dynamics Simulation 83.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83.2 Numerical Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83.3 Resting Contact . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.3.1 Analytical Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.4 Collision Detection and Response . . . . . . . . . . . . . . . . . . . . . . . . 10

3.4.1 Collision Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.4.2 Newton’s Law of Restitution . . . . . . . . . . . . . . . . . . . . . . . 103.4.3 Tangential Coulomb Friction . . . . . . . . . . . . . . . . . . . . . . . 10

4 Car Driving Model 114.1 Longitudinal Forces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4.1.1 Resistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114.1.2 Brake Force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124.1.3 Engine Force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124.1.4 Pacejka Tire Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

4.2 Lateral Force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164.3 Longitudinal Force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

5 Graphical Improvements 195.1 Normal Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195.2 Dynamic Cube Environment Mapping . . . . . . . . . . . . . . . . . . . . . 205.3 High Dynamic Range Lighting . . . . . . . . . . . . . . . . . . . . . . . . . . 215.4 Motion Blur . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215.5 Atmospheric Scattering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

1

Page 3: Final report

6 Human Computer Interaction 256.1 Keyboard and Mouse Controls . . . . . . . . . . . . . . . . . . . . . . . . . . 266.2 Heads-Up Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266.3 Steering Wheel Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266.4 Haptic Force Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

6.4.1 Pacejka Aligning Moment (Mz) . . . . . . . . . . . . . . . . . . . . . 266.5 Sound Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

7 Future Plans 287.1 Height Map Terrain Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . 287.2 Suspension/Weight Distribution Model . . . . . . . . . . . . . . . . . . . . . 287.3 Wheel-Body Joint Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . 287.4 Improved Collision Detection . . . . . . . . . . . . . . . . . . . . . . . . . . 297.5 Physics Stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297.6 Simulation Accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297.7 Racing Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

8 Conclusion 31

9 References 32

2

Page 4: Final report

List of Figures

1.1 An early version showing rigid body dynamics and car driving . . . . . . . . 4

2.1 Prior Work: Flight Simulation Project . . . . . . . . . . . . . . . . . . . . . 52.2 A proof-of-concept screenshot from Racer . . . . . . . . . . . . . . . . . . . 62.3 A screenshot showcasing the highly realistic commerical game, Gran Turismo 5 7

3.1 Rigid body dynamics test simulation . . . . . . . . . . . . . . . . . . . . . . 9

4.1 Longitudinal forces acting on the car . . . . . . . . . . . . . . . . . . . . . . 124.2 Engine torque curve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134.3 Car Transmission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144.4 Drive Torque Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144.5 Gear shift map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154.6 Lateral Pacejka function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174.7 Slip angle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174.8 Longitudinal Pacejka function . . . . . . . . . . . . . . . . . . . . . . . . . . 18

5.1 The normal map for the concrete barrier . . . . . . . . . . . . . . . . . . . . 195.2 The diffuse texture map for the concrete barrier . . . . . . . . . . . . . . . . 205.3 The resulting scene rendered with bump mapping . . . . . . . . . . . . . . . 205.4 The car model rendered using dynamic environment mapping . . . . . . . . 215.5 The car model rendered using high dynamic range lighting . . . . . . . . . . 225.6 A close-up of the high dynamic range lighting . . . . . . . . . . . . . . . . . 225.7 Motion blurring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235.8 A diagram illustrating atmospheric scattering . . . . . . . . . . . . . . . . . 23

6.1 HCI hardware setup diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . 256.2 Logitech USB steering wheel controller . . . . . . . . . . . . . . . . . . . . . 27

7.1 ROAM-ing terrain (Real-time Optimally Adapting Meshes) . . . . . . . . . . 287.2 A canonical mass-spring-damper system . . . . . . . . . . . . . . . . . . . . 297.3 A “Hinge-2” joint from the Open Dynamics Engine . . . . . . . . . . . . . . 29

8.1 Final result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

3

Page 5: Final report

Chapter 1

Objective

The objective of this project was to physically model the experience of driving a car. In orderto accomplish this, a physics simulation will be used, along with realistic graphical renderingof the car and the environment. The basic idea of the project is to implement an OpenGL3D car driving simulation in C++. We used the SDL libraries, along with GLEW and thelinear algebra library, Armadillo. A robust rigid body dynamics simulation was developedas part of the project. The emphasis was to have as realistic physics as possible, and to usea variety of graphical rendering techniques commonly found in commercial games. Becausethis was a large-scale collaborative project, we used SVN as a version control system. Theproject can be subdivided into three main subsystems: the rigid body dynamics engine, thecar physics model, and the graphics rendering engine.

Figure 1.1: An early version showing rigid body dynamics and car driving

4

Page 6: Final report

Chapter 2

Prior Work

Various existing games and simulations inspired our effort throughout this project:

2.1 Flight Simulation

The flight simulation that I wrote several years ago provided much background knowledgefor implementing this project. Like the car driving simulation, the flight simulation fea-tures a rigid body dynamics engine for physics. It also gave me much-needed experience inmathematically modelling realistic phenomena using differential equations and forces. Theflight simulation project lacked one of the main challenges of the car driving simulation –resting contact forces. I managed to use a really crude implementation of the impulse-basedmethod for resolving the contact forces while the plane was on the runway since the terrainwas approximately planar locally.

Figure 2.1: Prior Work: Flight Simulation Project

5

Page 7: Final report

2.2 Racer

The open source game racer found at

http://www.racer.nl/

was another inspiration for this project. Like this project, it aims to model the experience ofdriving a car as realistically as possible. An interesting thing to note is that like this project,Racer, uses the Pacejka tire model to model the longitudinal and lateral forces on each tirewhile the car is on the ground. Moreover, Racer implements many of the same graphicaleffects as this project, including atmospheric scattering. A proof-of-concept screenshot fromRacer follows. Racer focuses more on the simulation front than trying to be an arcade racinggame. Also, a key observation is that Racer uses a flexible configuration file system thatstores simulation parameter values for each car. This idea will prove to be useful for tweakingvalues in the simulation, as the number of coefficients needed to model a car to any level ofdetail is quite large.

Figure 2.2: A proof-of-concept screenshot from Racer

2.3 Commercial Games

Perhaps the most impressive commercial car driving/racing game is the newly-released GranTurismo 5. This newest release emphasized having photo-realistic graphics rendering ca-pabilities. Although it is far beyond the scope of this project, it serves as inspiration, and itprovides a formidable goal to compete with.

6

Page 8: Final report

Figure 2.3: A screenshot showcasing the highly realistic commerical game, Gran Turismo 5

7

Page 9: Final report

Chapter 3

Rigid Body Dynamics Simulation

3.1 Introduction

The rigid body dynamics simulation component of this project provided support for New-tonian physics simulation. The physics engine was implemented based on Kenny Erleben’s“Velocity-Based Shock Propagation for Multibody Dynamics Animation” paper. It uses aprojected, relaxed Gauss-Seidel solver to analytically determine contact forces:

~b = J(~ut + ∆tM−1 ~fext)

A = JM−1JT

~λ = ncp(A,~b)

~ut+1 = ~ut + M−1JT~λ+ ∆tM−1 ~fext

~st+1 = ~st + ∆tS~ut+1

A screenshot of a rigid body test demo with a box resting on the ground follows:

3.2 Numerical Integration

The Euler method of numerical integration is used to timestep the simulation by computingupdated velocities and positions for each body. It is represented in matrix-form as discussedin the Erleben paper. We needed a stable integrator to solve the dynamics equations. Prof.James suggested using a reverse Euler method. This worked fine for our needs. The Time-Corrected Verlet method was also researched, along with the fourth-order Runge-Kuttamethod.

xn+1 = xn + f(tn, vn)∆t

vn+1 = vn + g(tn, xn)∆t

8

Page 10: Final report

Figure 3.1: Rigid body dynamics test simulation

3.3 Resting Contact

3.3.1 Analytical Method

Contact forces were computed analytically using a relaxed Gauss-Seidel solver. To improvesimulation stability, I also manually resolved penetration at each time step.

Projected Relaxed Gauss-Seidel Solver

The projected Gauss-Seidel solver was implemented using the optimizations suggested in theErleben paper.

~λk+1i =

−∑i−1

j=0 Li,j~λk+1j −

∑n−1j=i+1 Ui,j

~λkj −~biDi,i

The projection step enforces the friction cone and the linear complementarity problemconstraints:

~λk+1i = min(max(~λloi ,

~λk+1i , ~λhii)

We added a relaxation term ω = 0.25 to the iteration step given in the paper.

9

Page 11: Final report

3.4 Collision Detection and Response

3.4.1 Collision Detection

Collision detection right now is limited to simple box-plane collision testing. A future planis to utilize the SOLID collision detection library so that the car can collide with arbitrary“polygon soup” meshes such as the concrete barrier on the racetrack.

3.4.2 Newton’s Law of Restitution

Newton’s Law of Restitution is used to compute the collision response impulses:

j =−(1 + e)vAB

1 · n

n · n(

1MA

+ 1MB

)+[(

I−1A (rAP × n)

)× rAP +

(I−1B (rBP × n)

)× rBP

]· n

It is represented in Matrix form as part of the ~b vector used in the rigid body systemof equations discussed in the Erleben paper. This is an elegant way to add bouncing as acollision response to the simulation.

3.4.3 Tangential Coulomb Friction

Coulomb friction was also incorporate in the rigid body solver using extra constraints on λas discussed in the Ereleben paper:

Ff ≤ µFn

The Coulomb friction turned out to be convenient for modelling the rolling resistanceforces that affect the car’s tires. We later switched from using the built-in Coulomb frictionto just applying it ourselves as a separate longitudinal resistance force.

10

Page 12: Final report

Chapter 4

Car Driving Model

The force-based car physics model can be divided into longitudinal forces and lateral forces.By computing the resultant force vector acting on the car (with some degree of physicalaccuracy), the car can be simulated within the rigid body dynamics simulation engine. Atthe heart of the simulation is the Pacejka tire model, which determines both the lateral andlongitudinal forces on the car as functions of slip ratio and slip angle (soon to be defined)respectively. A limiting factor was the availability of empirical coefficients and data. Forexample, the Pacejka coefficients are jealously guarded by car manufacturers, so finding gooddata required a scavenger hunt on the Internet.

4.1 Longitudinal Forces

Longitudinal forces were implemented using the model discussed in Short et al.’s “Simulationof Vehicle Longitudinal Dynamics” paper. This paper described force-based models for thevarious longitudinal forces acting on a car, primarily derived from empirical data:

4.1.1 Resistance

Resistance forces oppose the motion of the car.

Fluid Dynamic Drag

Fluid dynamic drag is computed using the v2 drag equation (an equation that is all-too-familiar to flight simulation developers):

FD = −1

2ρACd(v · v)

v

||v||The drag coefficient Cd = 0.4257 for a Corvette C5 sports car was used in this simulation.

Rolling Resistance

The rolling resistance is the frictional force opposing the motion of the wheels spinning onthe road:

11

Page 13: Final report

Figure 4.1: Longitudinal forces acting on the car

F = CrrNf

where Crr = 12.8 was the parameter value used for the simulation.

4.1.2 Brake Force

The brake force model used in this simulation is a simple linear model discussed in Monster’sarticle “Car Physics for Games”:

Fbraking = −u ∗ Cbraking

4.1.3 Engine Force

The engine is treated as a black box that provides torque for the purposes of simplifying thissimulation without losing too much accuracy.

Torque Curves

Engine torque is provided as a function of engine RPM:Short performed quadratic regression in his paper to come up with an analytical equation:

TMax = 528.7 + 0.152R− 0.0000217R2

He suggested that using higher-order polynomials may provide improved fit; however, forour needs, this quadratic model should suffice.

12

Page 14: Final report

Figure 4.2: Engine torque curve

Gearbox Model

For a realistic car simulation, it is essential to model the transmission/gear box of the caritself.

Gear and Difference Ratios Gear ratios were provided in Marco Monster’s paper forthe aforementioned Corvette sports car:

Gear Constant RatioFirst gear g1 2.66

Second gear g2 1.78Third gear g3 1.30Fourth gear g4 1.0Fifth gear g5 0.74Sixth gear g6 0.50

Reverse gR 2.90Differential ratio xd 3.42

In order to compute the drive torque from the engine torque, the engine torque is scaledby the gear ratio, the differential, and the transmission efficiency (0.7 for our simulation),

13

Page 15: Final report

Figure 4.3: Car Transmission

resulting in different torque curves for each gear:

Figure 4.4: Drive Torque Curves

Automatic Shifter Logic

An automatic transmission is implemented from a shifter map discussed in Short’s paper:Based on the throttle position and the current RPM, the gear for the car can be deter-

mined.

14

Page 16: Final report

Figure 4.5: Gear shift map

4.1.4 Pacejka Tire Model

The Pacejka model is an empirically derived model for computing the longitudinal and lateralforces acting on each car tire. The lateral forces are important for steering and skidding. ThePacejka curves are functions of slip angle/ratio and wheel load that compute these forces.Each Pacejka model fits an equation of the form:

y(x) = D sin[C tan−1Bx− E(Bx− tan−1(Bx))]

Coefficients

Coefficients were borrowed from Brian Beckman’s The Physics of Racing series of articlessince empirical tire coefficient data is very hard to find elsewhere. Note that the aligningmoment coefficients allow feedback forces that the driver feels at the steering wheel to becomputed. The coefficients used in this simulation are reproduced in the following table:

15

Page 17: Final report

Lateral Coefficients Longitudinal Coefficients Aligning Moment Coefficientsa0 = 1.5 b0 = 1.65 c0 = 2.2a1 = −40 b1 = 0 c1 = −3.9a2 = 1600 b2 = 1688 c2 = −3.9a3 = 2600 b3 = 0 c3 = −1.26a4 = 8.7 b4 = 229 c4 = −8.2a5 = 0.014 b5 = 0 c5 = 0.025a6 = −0.24 b6 = 0 c6 = 0a7 = 1.0 b7 = 0 c7 = 0.044a8 = −0.03 b8 = −10 c8 = −0.58a9 = −0.0013 b9 = 0 c9 = 0.18a10 = −0.15 b10 = 0 c10 = 0.043a111 = −8.5 b11 = 0 c11 = 0.048a112 = −0.29 b12 = 1.65 c12 = −0.0035a12 = 17.8 - c13 = −0.18a3 = −2.4 - c14 = 0.14

- - c15 = −1.029- - c16 = 0.27- - c17 = −1.1

4.2 Lateral Force

A graph of the lateral force Pacejka model follows:

Slip Angle

A quantity known as slip angle determines the lateral forces. It is defined as the anglebetween the velocity vector of the car and its orientation:

Mathematically, its definition is:

β = tan−1

(vyvx

)

4.3 Longitudinal Force

A graph of the longitudinal force Pacejka model follows:

Slip Ratio

Similarly, a quantity known as slip ratio determines the longitudinal forces. The slip ratiois the amount of slip between the tire and the road surface. This slipping creates a frictionforce that drives the car forward. Mathematically, it is defined as:

σ =ωwRw − vlong

|vlong|

16

Page 18: Final report

Figure 4.6: Lateral Pacejka function

Figure 4.7: Slip angle

Elliptical Force Constraint

It is important to note that these forces have to be constrained so that reside within thefriction cone of the car tire. Racer implements this constraint quite succinctly as:

Fy = Fy0 ∗

√√√√(1−(Fx

Fx0

)2)

17

Page 19: Final report

Figure 4.8: Longitudinal Pacejka function

where Fx0 is the maximum lateral force possible. The downside is that this model alwaysfavors the longitudinal forces. From these Pacejka forces, along with the longitudinal vehicledynamics model, a realistic force-based model for a car driving simulation was implemented.

18

Page 20: Final report

Chapter 5

Graphical Improvements

5.1 Normal Mapping

Normal mapping allows for more realistic rendering of bumpy surfaces within the game. Wemodulate the normals using a texture map that stores each normal for each pixel in a compactRGB format. The texture map stores the normals in a tangent space with respect to thetextures, necessitating an extra coordinate system transformation. Normal mapping allowsthe lighting calculations to take in account the surface details, as shown in the followingfigures:

Figure 5.1: The normal map for the concrete barrier

19

Page 21: Final report

Figure 5.2: The diffuse texture map for the concrete barrier

Figure 5.3: The resulting scene rendered with bump mapping

5.2 Dynamic Cube Environment Mapping

A crucial element of photorealistic rendering is accurately reproducing the reflected light onshiny metal surfaces. This effect is particularly necessary for rendering a car. We dynamically

20

Page 22: Final report

compute the reflections by rendering off-screen into six axis-aligned cube faces from thelocation of the car. We then fetch samples from these textures using a reflection vectorcomputed within a GLSL shader in order to render the reflections on the car. The resultis that the reflections are not static – they dynamically reflect the car’s surroundings, andthey take in account the changing sky color.

Figure 5.4: The car model rendered using dynamic environment mapping

5.3 High Dynamic Range Lighting

High dynamic range lighting is a graphical effect found in many commercial games, wheretextures are stored in floating point format, and rendering is performed off-screen into twofloating point textures – a low dynamic range texture and a high dynamic range texture.The main advantage of high dynamic range lighting is that the contrast ratio of the imagecan be much higher since light values are no longer clamped to reside within the [0, 1] range.The high dynamic range texture is blurred using a Gaussian filter for a so-called bloom effectaround the bright areas, and then the two textures are composited to form the final image.Moreover, a tonemapping operator scales the RGB light intensities to within the [0, 1] rangeused by a conventional computer monitor. A graphical demonstration of some of the effectspossible with high dynamic range lighting follows.

5.4 Motion Blur

Motion blurring was implemented as well by Mark using a shader that runs on the GPU:

21

Page 23: Final report

Figure 5.5: The car model rendered using high dynamic range lighting

Figure 5.6: A close-up of the high dynamic range lighting

22

Page 24: Final report

Figure 5.7: Motion blurring

5.5 Atmospheric Scattering

An atmospheric scattering model was implemented to analytically compute the sky colorwith beautiful results from Sean O’Neil’s “Accurate Atmospheric Scattering” article in GPUGems 2. Atmospheric scattering calculations allow us to have a full day-night cycle withcolorful sunrises and sunsets. A brief overview of the mathematics used follows (one canconsult the article for more details):

Figure 5.8: A diagram illustrating atmospheric scattering

Here is the main integral that needs to be evaluated per-vertex on the three RGB wave-lengths:

Iv(λ) = Is(λ)×K(λ)× F (θ, g)×∫ Pb

Pa

(exp

(−hH0

)× exp(−t(PPc, λ)− t(PPa, λ)))ds

t is a function of optical depth, which describes the average atmospheric density acrossa ray of light:

23

Page 25: Final report

t(PaPb, λ) = 4π ×K(λ)×∫ Pb

Pa

exp

(−hH0

)ds

The Henyey-Greenstein phase function (responsible for the light and dark areas in thesky towards its zenith) in polar coordinates is also needed where g is a tunable parameterthat affects the eccentricity of the elliptical shape. Rayleigh scattering, which predominatesthe sky, is a special case where g = 0:

F (θ, g) =3× (1− g2)2× (2 + g2)

× 1 + cos2θ

(1 + g2 − 2× g × cosθ) 32

The integrals are evaluated using Riemann sums on the GPU in GLSL shaders.

24

Page 26: Final report

Chapter 6

Human Computer Interaction

This project allowed for some interesting experimentation in human-computer interaction.

Figure 6.1: HCI hardware setup diagram

25

Page 27: Final report

6.1 Keyboard and Mouse Controls

The keyboard controls are as follows:

Functionality KeyCamera Pan Forward [W]

Camera Pan Backward [S]Camera Pan Left [A]

Camera Pan Right [D]Mouse Look Toggle [TAB]

Car Accelerate [Up Arrow]Car Brake [Down Arrow]

Car Steer Left [Left Arrow]Car Steer Right [Right Arrow]Car Gear Down [,]

Car Gear Up [.]Car Horn [H]

6.2 Heads-Up Display

The heads-up display provides the driver with the same kinds of instrumentation as anactual car. A rear-view mirror is simulated using an off-screen FBO render buffer, along withspeedometer and tachometer gauges that use OpenGL’s orthographic rendering functionality.

6.3 Steering Wheel Controller

A Logitech USB steering wheel controller was interfaced and calibrated using the configura-tion system as a hardware input device for controlling the car. This provides for a much morerealistic driving experience than merely using the traditional keyboard and mouse controls.

6.4 Haptic Force Feedback

6.4.1 Pacejka Aligning Moment (Mz)

One of the more interesting features of the steering wheel controller is its ability to providehaptic feedback forces to the user. The Pacejka model allows these feedback forces to bedetermined. Using the Pacejka aligning moment (Mz) equation allows the feedback forcethat the driver feels at the wheel to be computed:

y(x) = D sin[C tan−1Bx− E(Bx− tan−1(Bx))]

By applying this force using the hardware force feedback functionality of the steeringwheel, haptic feedback forces can be applied to the user. This is the same model that theRacer uses to determine its feedback forces. The parameter values are B, C, D, and E are

26

Page 28: Final report

Figure 6.2: Logitech USB steering wheel controller

empirically determined coefficients. Unfortunately, actually telling the haptic hardware toapply these forces to the steering wheel required a switch to SDL 1.3 beta, which could notbe completed in time.

6.5 Sound Effects

Sound effects are used for the car horn, the engine whine (which varies in timbre withrespect to the engine RPM), and the skidding (once the slip angle goes beyond a certaincut-off value).

27

Page 29: Final report

Chapter 7

Future Plans

7.1 Height Map Terrain Engine

A height map terrain engine using the ROAM (Real-time Optimally Adapting Meshes)algorithm for level-of-detail to allow for non-flat driving surfaces.

Figure 7.1: ROAM-ing terrain (Real-time Optimally Adapting Meshes)

7.2 Suspension/Weight Distribution Model

Work on suspension/weight distribution by modelling mass-spring-dashpot system for eachtire.

7.3 Wheel-Body Joint Constraints

Support for advanced joint constraints in the rigid body solver’s Jacobian matrix so that thetires can be modelled as separate bodies as demonstrated by Russell Smith’s Open Dynamics

28

Page 30: Final report

Figure 7.2: A canonical mass-spring-damper system

Engine:

Figure 7.3: A “Hinge-2” joint from the Open Dynamics Engine

7.4 Improved Collision Detection

Box-triangle mesh collision detection using the SOLID collision detection library.

7.5 Physics Stability

Additional tweaking to improve the stability of the physics simulation, particularly whenrunning at low framerates.

7.6 Simulation Accuracy

Finding more accurate coefficient values and implementing more advanced car physics modelsto improve the simulation accuracy.

29

Page 31: Final report

7.7 Racing Game

Turning the car driving simulation into a full-fledged racing game.

30

Page 32: Final report

Chapter 8

Conclusion

The results of this project was a drivable simulation with realistic graphical rendering,physics, and sound effects. The steering wheel controller provides a realistic and inter-esting way of controlling the simulation. Moreover, the graphical rendering capabilities arequite on-par with the Racer simulation.

Figure 8.1: Final result

High-definition videos, along with full source code, is provided with this project submis-sion.

31

Page 33: Final report

Chapter 9

References

Several references have been consulted:

• Robert Bridson Nonconvex Rigid Bodies with Stacking

http://www.graphics.stanford.edu/papers/rigid_bodies-sig03/

• Doug James CS 5643: Physically Based Animation for Computer Graphics

http://www.cs.cornell.edu/courses/cs5643/2010sp/

• David Baraff Fast Contact Force Computation for Nonpenetrating Rigid Bodies

http://www.cs.cmu.edu/~baraff/papers/sig94.pdf

• Jonathan Dummer A Simple Time-Corrected Verlet Integration Method

http://www.gamedev.net/reference/programming/features/verlet/

• Marco Monster Car Physics for Games

http://home.planet.nl/~monstrous/tutcar.html

• Brian Beckman The Physics of Racing

http://phors.locost7.info/contents.htm

• Pacejka’s Magic Formula

http://www.racer.nl/reference/pacejka.htm

• Mark Duchaineau, et al. ROAMing Terrain: Real-time Optimally Adapting Meshes

http://www.llnl.gov/graphics/ROAM/roam.pdf

32