Final report

387 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
387
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Final report

  1. 1. Rigid Body Car Driving SimulationCooper Findley, Charles Moyes, and Shentong Wang December 10, 2010
  2. 2. Contents1 Objective 42 Prior Work 5 2.1 Flight Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2 Racer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.3 Commercial Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Rigid Body Dynamics Simulation 8 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.2 Numerical Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.3 Resting Contact . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.3.1 Analytical Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.4 Collision Detection and Response . . . . . . . . . . . . . . . . . . . . . . . . 10 3.4.1 Collision Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.4.2 Newton’s Law of Restitution . . . . . . . . . . . . . . . . . . . . . . . 10 3.4.3 Tangential Coulomb Friction . . . . . . . . . . . . . . . . . . . . . . . 104 Car Driving Model 11 4.1 Longitudinal Forces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.1.1 Resistance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.1.2 Brake Force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.1.3 Engine Force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.1.4 Pacejka Tire Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.2 Lateral Force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.3 Longitudinal Force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 Graphical Improvements 19 5.1 Normal Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 5.2 Dynamic Cube Environment Mapping . . . . . . . . . . . . . . . . . . . . . 20 5.3 High Dynamic Range Lighting . . . . . . . . . . . . . . . . . . . . . . . . . . 21 5.4 Motion Blur . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 5.5 Atmospheric Scattering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 1
  3. 3. 6 Human Computer Interaction 25 6.1 Keyboard and Mouse Controls . . . . . . . . . . . . . . . . . . . . . . . . . . 26 6.2 Heads-Up Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 6.3 Steering Wheel Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 6.4 Haptic Force Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 6.4.1 Pacejka Aligning Moment (Mz ) . . . . . . . . . . . . . . . . . . . . . 26 6.5 Sound Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 Future Plans 28 7.1 Height Map Terrain Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 7.2 Suspension/Weight Distribution Model . . . . . . . . . . . . . . . . . . . . . 28 7.3 Wheel-Body Joint Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . 28 7.4 Improved Collision Detection . . . . . . . . . . . . . . . . . . . . . . . . . . 29 7.5 Physics Stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 7.6 Simulation Accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 7.7 Racing Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 Conclusion 319 References 32 2
  4. 4. List of Figures 1.1 An early version showing rigid body dynamics and car driving . . . . . . . . 4 2.1 Prior Work: Flight Simulation Project . . . . . . . . . . . . . . . . . . . . . 5 2.2 A proof-of-concept screenshot from Racer . . . . . . . . . . . . . . . . . . . 6 2.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 . . . . . . . . . . . . . . . . . . . . . . 12 4.2 Engine torque curve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.3 Car Transmission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4.4 Drive Torque Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4.5 Gear shift map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.6 Lateral Pacejka function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.7 Slip angle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.8 Longitudinal Pacejka function . . . . . . . . . . . . . . . . . . . . . . . . . . 18 5.1 The normal map for the concrete barrier . . . . . . . . . . . . . . . . . . . . 19 5.2 The diffuse texture map for the concrete barrier . . . . . . . . . . . . . . . . 20 5.3 The resulting scene rendered with bump mapping . . . . . . . . . . . . . . . 20 5.4 The car model rendered using dynamic environment mapping . . . . . . . . 21 5.5 The car model rendered using high dynamic range lighting . . . . . . . . . . 22 5.6 A close-up of the high dynamic range lighting . . . . . . . . . . . . . . . . . 22 5.7 Motion blurring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.8 A diagram illustrating atmospheric scattering . . . . . . . . . . . . . . . . . 23 6.1 HCI hardware setup diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 6.2 Logitech USB steering wheel controller . . . . . . . . . . . . . . . . . . . . . 27 7.1 ROAM-ing terrain (Real-time Optimally Adapting Meshes) . . . . . . . . . . 28 7.2 A canonical mass-spring-damper system . . . . . . . . . . . . . . . . . . . . 29 7.3 A “Hinge-2” joint from the Open Dynamics Engine . . . . . . . . . . . . . . 29 8.1 Final result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 3
  5. 5. Chapter 1ObjectiveThe 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
  6. 6. Chapter 2Prior WorkVarious existing games and simulations inspired our effort throughout this project:2.1 Flight SimulationThe 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
  7. 7. 2.2 RacerThe open source game racer found athttp://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 Racer2.3 Commercial GamesPerhaps 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
  8. 8. Figure 2.3: A screenshot showcasing the highly realistic commerical game, Gran Turismo 5 7
  9. 9. Chapter 3Rigid Body Dynamics Simulation3.1 IntroductionThe 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−1 JT λ = ncp(A, b) ut+1 = ut + M−1 JT λ + ∆tM−1 fext st+1 = st + ∆tSut+1 A screenshot of a rigid body test demo with a box resting on the ground follows:3.2 Numerical IntegrationThe 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
  10. 10. Figure 3.1: Rigid body dynamics test simulation3.3 Resting Contact3.3.1 Analytical MethodContact 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 SolverThe projected Gauss-Seidel solver was implemented using the optimizations suggested in theErleben paper. i−1 n−1 − j=0 Li,j λk+1 − j j=i+1 Ui,j λk − bi j λk+1 i = Di,i The projection step enforces the friction cone and the linear complementarity problemconstraints: λk+1 = min(max(λloi , λk+1 , λhii ) i i We added a relaxation term ω = 0.25 to the iteration step given in the paper. 9
  11. 11. 3.4 Collision Detection and Response3.4.1 Collision DetectionCollision 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 RestitutionNewton’s Law of Restitution is used to compute the collision response impulses: AB −(1 + e)v1 · n j= n·n 1 MA + 1 MB + I−1 (rAP × n) × rAP + I−1 (rBP × n) × rBP · n A B 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 FrictionCoulomb 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
  12. 12. Chapter 4Car Driving ModelThe 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 ForcesLongitudinal 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 ResistanceResistance forces oppose the motion of the car.Fluid Dynamic DragFluid dynamic drag is computed using the v 2 drag equation (an equation that is all-too-familiar to flight simulation developers): 1 v FD = − ρACd (v · v) 2 ||v|| The drag coefficient Cd = 0.4257 for a Corvette C5 sports car was used in this simulation.Rolling ResistanceThe rolling resistance is the frictional force opposing the motion of the wheels spinning onthe road: 11
  13. 13. Figure 4.1: Longitudinal forces acting on the car F = Crr Nf where Crr = 12.8 was the parameter value used for the simulation.4.1.2 Brake ForceThe brake force model used in this simulation is a simple linear model discussed in Monster’sarticle “Car Physics for Games”: Fbraking = −u ∗ Cbraking4.1.3 Engine ForceThe engine is treated as a black box that provides torque for the purposes of simplifying thissimulation without losing too much accuracy.Torque CurvesEngine torque is provided as a function of engine RPM: Short performed quadratic regression in his paper to come up with an analytical equation: TM ax = 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
  14. 14. Figure 4.2: Engine torque curveGearbox ModelFor 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 Ratio First gear g1 2.66 Second gear g2 1.78 Third gear g3 1.30 Fourth gear g4 1.0 Fifth gear g5 0.74 Sixth gear g6 0.50 Reverse gR 2.90 Differential 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
  15. 15. Figure 4.3: Car Transmissionresulting in different torque curves for each gear: Figure 4.4: Drive Torque CurvesAutomatic Shifter LogicAn 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
  16. 16. Figure 4.5: Gear shift map4.1.4 Pacejka Tire ModelThe 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−1 Bx − E(Bx − tan−1 (Bx))]CoefficientsCoefficients 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
  17. 17. Lateral Coefficients Longitudinal Coefficients Aligning Moment Coefficients a0 = 1.5 b0 = 1.65 c0 = 2.2 a1 = −40 b1 = 0 c1 = −3.9 a2 = 1600 b2 = 1688 c2 = −3.9 a3 = 2600 b3 = 0 c3 = −1.26 a4 = 8.7 b4 = 229 c4 = −8.2 a5 = 0.014 b5 = 0 c5 = 0.025 a6 = −0.24 b6 = 0 c6 = 0 a7 = 1.0 b7 = 0 c7 = 0.044 a8 = −0.03 b8 = −10 c8 = −0.58 a9 = −0.0013 b9 = 0 c9 = 0.18 a10 = −0.15 b10 = 0 c10 = 0.043 a111 = −8.5 b11 = 0 c11 = 0.048 a112 = −0.29 b12 = 1.65 c12 = −0.0035 a12 = 17.8 - c13 = −0.18 a3 = −2.4 - c14 = 0.14 - - c15 = −1.029 - - c16 = 0.27 - - c17 = −1.14.2 Lateral ForceA graph of the lateral force Pacejka model follows:Slip AngleA 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: vy β = tan−1 vx4.3 Longitudinal ForceA graph of the longitudinal force Pacejka model follows:Slip RatioSimilarly, 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: ωw Rw − vlong σ= |vlong | 16
  18. 18. Figure 4.6: Lateral Pacejka function Figure 4.7: Slip angleElliptical Force ConstraintIt 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: 2 Fx Fy = Fy0 ∗ 1− F x0 17
  19. 19. 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
  20. 20. Chapter 5Graphical Improvements5.1 Normal MappingNormal 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
  21. 21. Figure 5.2: The diffuse texture map for the concrete barrier Figure 5.3: The resulting scene rendered with bump mapping5.2 Dynamic Cube Environment MappingA 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
  22. 22. 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 mapping5.3 High Dynamic Range LightingHigh 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 BlurMotion blurring was implemented as well by Mark using a shader that runs on the GPU: 21
  23. 23. 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
  24. 24. Figure 5.7: Motion blurring5.5 Atmospheric ScatteringAn 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: Pb −h Iv (λ) = Is (λ) × K(λ) × F (θ, g) × (exp × exp(−t(P Pc , λ) − t(P Pa , λ)))ds Pa H0 t is a function of optical depth, which describes the average atmospheric density acrossa ray of light: 23
  25. 25. Pb −h t(Pa Pb , λ) = 4π × K(λ) × exp ds Pa H0 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: 3 × (1 − g 2 ) 1 + cos2 θ F (θ, g) = × 2 × (2 + g 2 ) (1 + g 2 − 2 × g × cosθ) 3 2 The integrals are evaluated using Riemann sums on the GPU in GLSL shaders. 24
  26. 26. Chapter 6Human Computer InteractionThis project allowed for some interesting experimentation in human-computer interaction. Figure 6.1: HCI hardware setup diagram 25
  27. 27. 6.1 Keyboard and Mouse ControlsThe keyboard controls are as follows: Functionality Key Camera 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 DisplayThe 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 ControllerA 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 Feedback6.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−1 Bx − 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
  28. 28. Figure 6.2: Logitech USB steering wheel controllerempirically 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 EffectsSound 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
  29. 29. Chapter 7Future Plans7.1 Height Map Terrain EngineA 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 ModelWork on suspension/weight distribution by modelling mass-spring-dashpot system for eachtire.7.3 Wheel-Body Joint ConstraintsSupport 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
  30. 30. Figure 7.2: A canonical mass-spring-damper systemEngine: Figure 7.3: A “Hinge-2” joint from the Open Dynamics Engine7.4 Improved Collision DetectionBox-triangle mesh collision detection using the SOLID collision detection library.7.5 Physics StabilityAdditional tweaking to improve the stability of the physics simulation, particularly whenrunning at low framerates.7.6 Simulation AccuracyFinding more accurate coefficient values and implementing more advanced car physics modelsto improve the simulation accuracy. 29
  31. 31. 7.7 Racing GameTurning the car driving simulation into a full-fledged racing game. 30
  32. 32. Chapter 8ConclusionThe 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
  33. 33. Chapter 9ReferencesSeveral 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

×