Navigation
Browse the developer docs

FH2 Modding Guide · Chapter 14

Cars in depth

You are adding or converting a car: files, materials, lights, animation, driver and sound.

By Trinculo54 · from the FH2 Modding Guide · CC BY 4.0 · copied 4 Dec 2026 · read the original, which may be newer

On this page

This chapter is about how Forza Horizon 2 loads, draws, animates and sounds a car, worked out from the exe and checked against every stock car. It is for anyone adding a car or writing a car converter: follow these rules and a new car loads, drives and looks right; break them and it crashes, loads for ever or drives on made-up numbers. Start with 14.1; the sections after it are the reference.

Addresses are for forza_durango_release_final.exe of 24 Nov 2015 (TimeDateStamp 0x565501ED, SizeOfImage 0x3A18000), image base 0x140000000. Each is given as an RVA (game+0x117DC10) and, the first time, in full (0x14117DC10).

How sure each fact is:

MarkMeaning here
proven in gamea car built that way was loaded and seen working
provedseen in the exe's code, or true of every stock file (offline evidence, but the strongest kind)
offline onlyread from the stock data or files, not traced in code and not tried in game
unconfirmedthe cause is clear but not traced to the instruction, or a best reading

The byte layouts of the shared formats (Grub bundles, models, textures, materials, the full carbin) are in chapter 10; this chapter repeats only what a car needs.

Contents

  1. Adding a car: the short path
  2. How the game loads a car
  3. The database
  4. The car zip
  5. Models and the carbin
  6. Materials and textures
  7. Lights
  8. Collision hull
  9. Factory colours, livery masks and Forzavista pins
  10. Livery designs
  11. Dash displays
  12. Animation
  13. The driver
  14. Cameras and locators
  15. Engine sound
  16. Pitfalls
  17. Open questions

14.1 Adding a car: the short path

Ground rules

A broken FH2 car almost never fails cleanly. It crashes, loads for ever, or drives with made-up numbers, and the game prints nothing. So check every rule before the car reaches the game.

  • How it fails:
    • A model blob the reader looks up without checking (Modl, Skel, Mrph) crashes the asset thread.
    • A model or material that never finishes loading hangs the car. Nothing in the exe ever marks a car model failed: the render model's state byte (+0x1C9) is only ever set to 1, 3, 4 or 5, so the scene waits for ever.
    • A database row that isn't there reads as INT_MAX or FLT_MAX, not 0 and not an error. The car loads with garbage physics.
  • Start from a stock FH2 car (the base) and replace as much of it as you can. Take the new car's carbin, models, locators, lights, collision hull, colours, livery masks, Forzavista pins, camera row and dash page. The base gives only what FH2 needs and an outside car can't supply:
    • the state machine (.gsf) and, unless they are written new, the Granny skeleton and part clips (doors, bonnet, boot, wipers, needles);
    • the 13 driver clips;
    • a stock engine sound name.
  • Pick the base by geometry, not by name or size. Score the steering-wheel hub (it matters most: the driver's hands are baked to it), seat camera, gauge needles, door, bonnet and boot hinges, wipers and lamps, in cm from the new car's. A car with its wheel on the other side never qualifies.
  • With a skeleton of its own, a car leans on the base far less. The skeleton, the part clips and the gauge ranges can be written new, and the state machine can be any stock car's (14.12). Cars built this way load and animate in game, and the same car built on a close base and on a poor one both work, the driver included (proven in game). Needles, hinges and wipers then no longer count when picking the base. What the base still decides: the 13 driver clips, the carbin's corner entries (wheels, brakes) and its set of upgradable parts, database defaults, the Locators.xml document, wiper textures, and every AO map the new car doesn't replace.
  • Check every build against a contract before installing: the model, carbin, file and database rules in this chapter, run on the car's zip and on a copy of the stock database with the car's SQL applied. The checker must pass all 354 stock cars first, or its rules are wrong.
  • Ids are forever. A save stores the car's Id and the Ids of the upgrades fitted to it. Never change a released car's Id, and never remove upgrade rows that a save may have fitted: the game crashes on load (14.16).
  • The engine sound name must be a stock one, or the car is silent (14.15).

Checklist

  1. Choose how to ship it.
    • Platform car packs (2.9.0 and later, the recommended way): a folder <Azimuth folder>\fh2-cars\<pack>\ with pack.ini, SQL, the zip and thumbnails. The platform gives each car a permanent Id (kept in fh2-mods\platform-car-ids.txt), merges the manifest lines, turns text names into string keys, links the pack's media under T:\fh2-platform\packs\<pack>\ and mounts it. Needs Azimuth 1.0 or later, and works with Extra Options 0.6.0 too. See Car packs.
    • An Extra Options mod: the zip in the mod's media\ folder (no manifest line needed), database.json and strings.json. See Add-on cars.
    • Install a car one way or the other, never both.
  2. Take an Id and keep it. Car packs hand out 3000-8999; a mod that adds a car itself uses 9000 and up (14.3).
  3. Pick the base car by geometry (above).
  4. Build the zip (14.4): the new car's models, carbin, materials, textures, lights, hull, colours, masks, pins, locators and dash, and the base's state machine, driver clips and anything else you keep.
  5. Write the database rows (14.3): Data_Car, every upgrade table, the camera row, the Autoshow bucket. In a car pack they go in its .sql files; a platform mod uses api->add_sql(...) (The game database); an EO mod uses database.json.
  6. Give it a name as a string-table key, not plain text. Car packs do this for you from 2.9.0; otherwise use api->set_string(...) (Strings) or EO's strings.json.
  7. Mount the zip. It needs a line in media\zipmanifest.xml, which car packs and EO mods add for you (4.4).
  8. Add the thumbnails (Thumbnails).
  9. Give it a stock engine sound name (14.15).
  10. Run the checker, then test with the saves backed up. Once players have the car, never remove it or its upgrade rows.

14.2 How the game loads a car

A car is a folder of files inside media\cars\<MediaName>.zip, read by a scene state machine that waits for each step and never gives up on a model or material. All of this is proved in code.

  1. CarScene::Scene (game+0x117DC10, 0x14117DC10) builds game:\media\cars\<media>\ and queues async reads (game+0x13D3CC0, 0x1413D3CC0): <media>.carbin, Lights.bin, LightPresets.bin, and animations\<media>.gsf if it exists.
  2. The scene state machine (game+0x11A1910, 0x1411A1910; state byte +0x80; it runs under a time budget) then:
    1. waits for the carbin; no carbin = the scene fails;
    2. deserializes it (scene game+0x11AECB0, 0x1411AECB0; each model game+0x11ADEE0, 0x1411ADEE0);
    3. requests the carbin's skeleton .modelbin and the same path as .gr2 (Granny);
    4. waits for both (either failing fails the scene) and for the .gsf (failure = "no gsf", accepted);
    5. waits for Lights.bin and LightPresets.bin (failure accepted);
    6. builds the parts (game+0x11B3DD0, 0x1411B3DD0; game+0x11B67E0, 0x1411B67E0); each render model requests its modelbin (game+0x11A0950, 0x1411A0950);
    7. polls every part (Part::Update, game+0x1195990, 0x141195990) until all reach state 3 (game+0x11A2560, 0x1411A2560).
  3. Locators.xml is read synchronously (game+0x119DBA0, 0x14119DBA0); missing = no locators.
  4. The resource worker (game+0x13D6DD0, 0x1413D6DD0) loads files; a missing file is state 6, "failed". A ModelResource (ModelResource::Load game+0x13F3D60, 0x1413F3D60, then Model::Load game+0x13F1D70, 0x1413F1D70) stays queued until every material instance in it is ready (game+0x10EF670, 0x1410EF670). There is no way out of that wait with a failure.
  5. A render model creates its instance only when its resource reaches state 4 (game+0x1195D20, 0x141195D20). A material instance is ready only when its parent .materialbin has loaded (game+0x10CCDE0, 0x1410CCDE0). Textures (game+0x10BE910, 0x1410BE910) and AO maps (game+0x1192590, 0x141192590) count "failed" as done.

So a missing or unreadable modelbin or materialbin makes the car load for ever. A missing texture is drawn with texture #1, "DebugOpaqueBlack" (table game+0x10D82E0, 0x1410D82E0). One exception is unexplained: a missing AO map inside the shared library also hung a car (14.17).

14.3 The database

The database is media\Stripped\gamedbRC.slt, plain SQLite with about 290 tables. Physics and handling live here, not in the zip. A car is a Data_Car row plus rows in the 43 upgrade tables, and every read the game does succeeds: a missing row, column or NULL comes back as INT_MAX (game+0x1090EA9, 0x141090EA9) or FLT_MAX (game+0x1090C0D, 0x141090C0D) from the record set (CRecordSet, vtable game+0x2E7AD68, 0x142E7AD68). The columns of Data_Car and its neighbours are listed in 4.5.1.

The 43 upgrade tables

The game knows a car's parts as 43 part enums (table at game+0x2E797F0, 0x142E797F0, 32 bytes each: table name, short name, UI category, flags; game+0x104C760, 0x14104C760, maps enum to name). Each table is keyed by one owner:

EnumsTables (List_Upgrade*)Keyed by
0-11Engine, Drivetrain, CarBody, Motor, Brakes, SpringDamper, AntiSwayFront, AntiSwayRear, TireCompound, RearWing, RimSizeFront, RimSizeRearOrdinal = the car's Id
12-29EngineCamshaft, Valves, Displacement, PistonsCompression, FuelSystem, Ignition, Exhaust, Intake, Flywheel, Manifold (21), RestrictorPlate, OilCooling, TurboSingle, TurboTwin, TurboQuad (24-26), CSC, DSC (27, 28), IntercoolerEngineID of the car's engine row
30-33DrivetrainClutch, Transmission, Driveline, DifferentialDrivetrainID
34-41CarBodyFrontBumper, RearBumper, Hood, SideSkirt, TireWidthFront, TireWidthRear, Weight, ChassisStiffnessCarBodyID
42MotorPartsMotorID

Flag bit 8 marks a visual part (enums 2, 8-11 and 34-41: the tables with a RequiresGraphics column); bit 16 means the game reads the part's ManufacturerID (game+0x371D70, 0x140371D70). Swaps, gearbox, torque and suspension columns are in 4.5.2.

How a car is built

  • The Car class (vtable game+0x2E6B0A0, 0x142E6B0A0). Slot 7 (game+0xF65AD0, 0x140F65AD0) loads the car, often as a background job; it runs game+0xF67270 (0x140F67270): stock part list, part levels (game+0x104B9C0, 0x14104B9C0), physics (game+0xF670D0, 0x140F670D0, then game+0x1056210, 0x141056210), CarTrackOffsets, WheelNormOffsets.
  • Slot 62 (game+0xF67DC0, 0x140F67DC0) builds the render description (game+0xF592D0, 0x140F592D0) from one INNER JOIN: Data_Car with List_Wheels (StockWheelID), RimSize front and rear, TireWidth front and rear, and Brakes, by the stock part Ids.
  • Stock part list (game+0x104D5F0, 0x14104D5F0, GetStockPartId): for enums 0-11, SELECT Id ... WHERE Ordinal = car AND IsStock = 1, the first row, or -1. Level is ignored. The engine, drivetrain, body and motor rows then give the owners of enums 12-42.
  • Physics (game+0x1056210): Data_Car (MediaName, ride heights), the 43 part Ids (stock, or the saved configuration), then one aspiration part: it walks enums 24, 25, 26, 27, 28, 21 (game+0x1E18B10, 0x141E18B10) and keeps the first present. Each part row is fetched by Id (Create{Car,Engine,Drivetrain,CarBody,Motor}PartUpgradeRecord, from game+0x10482F0, 0x1410482F0); a row whose owner column isn't the car's gives NULL, which the readers use unchecked. Sub-builders: engine game+0x105CCF0 (0x14105CCF0), tyres game+0x1058A20 (0x141058A20).

Rules every drivable stock car obeys

All proved over the stock database.

RuleIf broken
Exactly one stock row (IsStock = 1) for enums 0-2, 4-8, 10, 11; at most one RearWingFLT_MAX / INT_MAX physics
Exactly one stock engine sub-part for 12-20 and 23; drivetrain 30-33; body 34-41as above (2 stock cars have 2 weight rows: the first wins)
Exactly one stock aspiration part among 21, 24-28 (a naturally aspirated engine's is its manifold)none: the car never finishes loading; two: the first wins
Data_Engine, Data_Drivetrain, Data_CarBody rows; the stock camshaft's torque curve; the stock tyre compound, spring, anti-roll and aero physics rows; every upgrade row's physics Idsmade-up numbers
The render JOIN returns one rowno wheels, or a stall (unconfirmed)
DrivetypeID in List_DriveTyperead as FWD
PowertrainID in Powertrains (0-7)the Autoshow and garage crash; platform 2.9.0's database guard lists the car without a drivetrain and shows a red "Game database" row instead
MakeID leads to List_CarMake, then List_Countryleft out of the Autoshow's detail queries
ModelId = Id; not in TrafficCars; a Data_Car_Buckets row; a CameraOverrides rownot listed / not in car pools / default cameras
  • The exe never reads Data_Engine.AspirationID_Stock. AspirationTypeId is for display, the upgrade wizard and event rules only.
  • The stock manifold row does nothing to the physics (TorqueScale 1.0 in all 212 stock rows; the reader adds TorqueScale - 1). It matters only because a car needs some aspiration part.
  • Forced induction needs the matching stock row plus a stock intercooler row, and no manifold row as well.
  • The garage keeps the aspiration group {21, 24-28} to one part, drops the intercooler (29) when no forced induction is left, and resets the engine's sub-parts on an engine swap (game+0x2CD090, 0x1402CD090).

Electric cars

FH2's one electric car, the Tesla Model S (car 2101), shows the pattern (offline only: stock data, not traced in the exe):

  • A stock List_UpgradeMotor row naming a Data_Motor row (MotorID 23: mass, inertia, graph maxima, RedlineRPM 16,000, a List_TorqueCurve of 181 values peaking at 601 N m, an 85 kWh battery).
  • List_UpgradeMotorParts keyed by the motor: a stock row (TorqueScale 1.0) and three upgrades (1.1, 1.2, 1.3).
  • No List_UpgradeEngine rows, so none of the engine's sub-parts; the aspiration rule doesn't apply.
  • Data_Car: EngineConfigID 6, CylinderID 10, AspirationTypeId 8, Displacement 0. PowertrainID is only drive type and motor placement.
  • Motor torque curves are in 100 rpm steps from 0 and run a little past the redline before a cut-off. TorqueScale times the curve's highest value equals SimPeakTorque x 100.
  • The engine sound query reads Data_Motor.MediaName beside Data_Engine's.

Ids and the rows a new car needs

Stock cars use Ids up to 2501. Car packs hand out 3000-8999 and a mod that adds a car under its own Id uses 9000 and up (Id ranges). Keep the Id for ever: saves store it.

  • Data_Car: a copy of a stock car's row with the new Id, its own MediaName, ModelId = Id, ContentId 0 (no content licence to check), and its name, short name, price, year and thumbnail.
  • Every table keyed by Ordinal or CarId: List_Upgrade*, suspension and anti-roll bar physics, Combo_Colors, CameraOverrides, CarPartPositions, CarExceptions, Data_Car_Buckets. A car's own row Ids follow the game's convention, Id x 1000 + n. Combo_Colors rows take new Ids after the highest.
  • Rows those point at by an Id in the car's range, in a table with no car column: in practice the wings' own aero. 109 of 354 stock cars' wing rows name List_AeroPhysics rows numbered as the car's (the Escort RS Cosworth's 1272901 to 1272903).
  • Don't copy BucketListChallenges: it would put the car in a second challenge. Skip races, championships and colour exceptions too.
  • Engines, drivetrains, the body and the wheel can be shared with another car.
  • DisplayName must be a key into Stripped\StringTables\<language>\Data_Car.str (LSB2; 4.5.11). Plain text shows in the Autoshow but leaves the top bar blank ("2015 FORD"). Platform 2.9.0 turns text names in car packs into string keys (Data_Car.str keys from 0xFF00 up).
  • A car's media\cars\<MediaName>.zip needs a line in media\zipmanifest.xml.
  • Two mods writing the same car, engine or drivetrain Ids: the later mod's SQL fails and all of it rolls back.
  • The copy-and-renumber pattern as SQL is example 6 in 4.5.9.

Removing a car is the risky part. A bought car is stored in the save by Id, and every fitted part by its row Id. Removing a car, a pack or its upgrade rows can crash the game or move the player into another car (the exact behaviour isn't fully known). Tell players to back up their saves before they remove one.

Listing, the shop and ratings

  • The Autoshow reads Drivable_Data_Car (Data_Car minus TrafficCars), IsCarVisible(ModelId), a LEFT JOIN on List_CarMake (sorted by its DisplayName), and Data_Car_Buckets.
  • The upgrade shop builds a per-car view, View_UpgradeParts. It makes up a stock row when the aspiration part is missing (game+0x2D4610, 0x1402D4610), so the shop never shows that problem. An upgrade type shows when it has more than one row, or one non-stock row.
  • The upgrade wizard (game+0x371F80, 0x140371F80) prefers ManufacturerId 492 (Forza's own) for level-3 wings and front bumpers.
  • Part removals ("remove the rear wing / bumpers") are kit rows with RequiresGraphics = 0: level 4 in the wing and bumper tables, the car's own maker, AeroPhysicsID 19 (wing) or 20 (bumper). There are 116 stock rows; most have no carbin entry.
  • An unowned car shows its stored ratings (SpeedRating, HandlingRating, AccelerationRating, LaunchRating, BrakingRating), PerformanceIndex and ClassID; the PI shown is about 906 x PerformanceIndex + 127. Once owned, the game computes them and writes them back. Over the stock cars the ratings follow the Sim* figures closely enough to fit them.

Revs: inertia and engine braking

How fast an engine gains and loses revs comes from three values: Data_Engine.MomentInertia, the stock List_UpgradeEngineFlywheel.MomentInertia, and List_TorqueCurve.ZeroThrottleTorqueScale of the stock camshaft's curve (engine braking). Off the throttle, revs fall at zero-throttle torque / (engine inertia + flywheel inertia). On stock cars zero-throttle torque is about 0.47 of peak torque (median).

Take all three from the same engine. One engine's inertia with another's flywheel and engine braking made revs fall at half the right speed on some cars and twice on others. The rule is worked out from the data and proven in game on one car; the engine code isn't traced.

Values that are the same on every stock car

Of the physics columns a new car has to fill, 28 hold one value on all 336 stock cars: among them the 12 Steer* columns, the spring clamps, SwaybarDamping (2), the ABS columns and the differentials' RelVelClamp (50). Others follow a rule:

  • TirePivotX = tyre width / 1000, exactly.
  • The tyre grip scalar's maximum = mass / 2000 on 67 % of cars, and its clamp = 5 x the maximum.
  • ClutchMaxTorque is about 2.36 x peak torque.
  • Combo_Colors rows are not in the order of the colours in ManufacturerColors.bin: it is a separate swatch list.

14.4 The car zip

Everything about a car's look and motion is one zip, media\cars\<MediaName>.zip, listed in media\zipmanifest.xml. The files inside name each other by full lower-case game paths (game:\media\cars\<medianame>\...), so the media name appears inside the carbin, models, materials, light files and dash page.

A typical zip (FOR_MustangGT_15.zip) has 548 entries, 64 MB unpacked: 184 .vso and 72 .pso compiled shaders, 112 .swatchbin, 89 .modelbin, 33 .materialbin, 27 .gr2, 16 .xml, 4 .shaderbin, and one each of .gsf, .avpins, .carbin, .carbin_debug and .bin. Shared files live outside it: media\cars\_library\ (Materials.zip with 3,493 materials, Textures.zip, 1,041 car paints under _library\materials\carcolors\), media\_library\Shaders.zip, media\brakes\*.zip, and wheels through List_Wheels.

File (in the zip)What the game does with itMissing, broken or taken from another car
<MediaName>.carbinmodel list, placements, bones, LOD flags, paint zones, AO maps, upgradable partsmissing: the scene fails
scene\...\*.modelbinthe meshes, on bones (scene\Exterior\BumperF\bumperF_a.modelbin...)missing: loads for ever. Wrong counts: hang or crash
scene\<MediaName>_skeleton.modelbin and .gr2bone tree and rest pose (both are required)either missing: the scene fails. Another car's: parts pivot on its hinges
Animations\<MediaName>.gsf, Animations\*.gr2part clips: doors, bonnet, boot, wipers, needles, windows (game+0xF7BCC0, 0x140F7BCC0)another car's: parts turn about its pivots
scene\Drivers\default\*.gr2the driver's body place and hands, baked per car ($(DriverAnimFolder), game+0x138FE63, 0x14138FE63)another car's: hands miss the wheel
Locators.xmlshift and handbrake switches (game+0xF7C880, 0x140F7C880), seat camera (game+0xF7A2E0, 0x140F7A2E0), camera anchors, exhaust flames, Forzavista pin framesmissing: no locators
Lights.bin, LightPresets.binlamp glows and beams (path built at game+0x117E606, 0x14117E606)missing: accepted, no lights. Another car's: glows hang where its lamps were
physicsdefinition.bincollision hullanother car's: collides as that car's shape
ManufacturerColors.binfactory paint choicesanother car's: its palette
LiveryMasks\Masks.xml + masksvinyl projectionanother car's: vinyls misplaced
<MediaName>.avpinsForzavista points of interestanother car's: pins in the wrong places
Textures\*.swatchbinmaps the materials namemissing: drawn with texture #1
Textures\AO\*_AO.swatchbinper-part AO maps (TEXCOORD2)missing own: accepted (40 stock cars miss some)
Textures\AO\ground_AO.swatchbinthe shadow under the car, loaded by fixed path (game+0x138E3E0, 0x14138E3E0)another car's: its shadow's size
Materials\...\*.materialbincar-local materials (Materials\CarColors\ paints, badges)missing: loads for ever
Shaders\car-local shaders
UI\<MediaName>.xaml + UI\Textures\*dash display pageanother car's: shows in pieces on the screens
ThumbnailCamSettings.xml, AudioGlobals.xmlXML settings
Cinematics\HeroRear_subtitles_<LANG>.xmlcinematic subtitles
<MediaName>.carbin_debugbuild GUID, machine and date; not read
BuildNumber.txt, SizeReport.xml, other *_debugbuild leftovers

The database's CameraOverrides row goes with these files: it sets the cameras relative to the locators. Engine-audio modulation is outside the zip, in media\audio\cars\<sound name>.xml (14.15).

With Extra Options, a mod can patch a carbin instead of shipping it whole (Carbin JSON patches).

Renaming a copied car

Copying a stock car's zip and renaming it works if the new media name is exactly as long as the old one: every string and offset stays put. Rewrite the name in entry names and in file contents (ASCII and UTF-16), but not inside paths into the shared _library (some cars' library files carry their own name). Update the texture hashes inside the models to the new paths. Leave compiled shaders (.pso) alone: they name the car only in a debug path, and their bytes are checked when they load. Cars cloned this way are proven in game.

The zip's own layout

FH2's car zips keep entries in upper-case name order, with local headers carrying no extra fields; each entry's data offset is in a 0x1123 extra field of its central-directory record (Game zips). A generic zip library doesn't write that field, so write car zips with a writer that does.

Ground shadow

ground_AO.swatchbin covers a fixed footprint of about 7 m with the car's shadow drawn to scale. Its border background must be white (255): a darker border darkens the ground around the car.

Thumbnails

Data_Car.Thumbnail names game:\Media\Stripped\RC<n>\Thumbnail_<name>.png (stock cars use their Id as <name>), but the game actually reads Thumbnail_<name>_Big.swatchbin (816 x 459) and Thumbnail_<name>_Small.swatchbin (192 x 108) from media\Stripped\RC<n>.zip (name built at game+0x26E290, 0x14026E290). Both are BC7, one mip, on a transparent background. Loose files at that path in an override folder work too. The Autoshow writes the make and model over the _Big image's top left: keep that corner empty.

14.5 Models and the carbin

A modelbin is a Grub 1.0 bundle of blobs; the game trusts its counts and Ids completely, so every number has to match what is in the file. The general model layout is in 10.7; this section is what a car needs.

The Grub bundle

Models, textures (.swatchbin), materials (.materialbin) and MatIs are all Grub bundles (Grub bundles).

  • Header (1.0): burG, u8 1, u8 0, u16 blob count, u32 header size, u32 total size. Blob entries start at 0x10. The reader (game+0x13E6A60, 0x1413E6A60) checks no magic or version.
  • Blob entry, 24 bytes: tag (4 characters, stored reversed), u8 major, u8 minor, u16 metadata count, u32 metadata offset, u32 data offset, u32 size, u32 unpacked size. Car blobs aren't compressed.
  • Metadata follows the entries, each blob's in turn: (tag, u16 size << 4 | version, u16 offset from the entry), then the values. The header is padded to 4 bytes; each blob's data starts at a multiple of 4.
  • Metadata tags: Id (i32), Name, BBox (min and max, 2 x 3 f32), TRef.
BlobVersionWhat it holds
Modl1.1counts, the model's box, TRef
Mesh1.7one draw: material, bone, index range, layout, buffer references
VLay1.1a vertex layout
VerB1.0a vertex buffer
IndB1.0the index buffer
MBuf1.0damage morph buffer
ConBconstant buffer
Skinskin weights (rare on cars)
Mrph0.0morph data, needed when any mesh has a morph count
Skel0.0a copy of the car's skeleton
MatI1.0a material instance (14.6)

Modl and its counts

Modl 1.1 starts with four u16 counts: meshes (0), buffers (2: IndB, VerB, MBuf, Skin and ConB blobs), vertex layouts (4), MatIs (6). The reader sizes arrays by them, unbounded:

  • more blobs than the count = heap overflow; a buffer count lower than the real one crashes;
  • a MatI count that doesn't match = the car loads for ever;
  • BBox is in car space: the meshes' boxes moved by their bones;
  • TRef: u32 count, then texture Ids, each the CRC-32 of the texture's lower-case full path. Textures load without being listed;
  • the most any stock model has: 10 VLay, 16 VerB, 8 MBuf, 1 IndB, 25 buffers in all, 74 MatIs. Stay within these.

Modl and Skel are looked up unchecked: either missing crashes (game+0x13E7398, 0x1413E7398; game+0x13E7124, 0x1413E7124). Mrph is needed when any mesh's morph count is above 0; missing, it crashes too. In every stock mesh the morph count is above 0 exactly when the mesh has an MBuf. No blob reader has an upper version bound: a newer version is read as the old layout.

Mesh 1.7

OffsetTypeField
0i16material: a MatI's Id metadata (-1 for shadow meshes)
2i16bone
4u16LOD flags: bit 0 showroom, bits 1-6 LOD0-5
11u8skinning element count (0 = not skinned)
12u8morph count
17u32IndB Id
25i32start index
29i32base vertex
33i32index count
45u32vertex count
49u32vertex layout (VLay) Id
53u32vertex buffer reference count, then 16 bytes each: i32 VerB Id, u32 slot, u32 stride, u32 byte offset
then16i32 MBuf Id, i32 Skin Id, 8 bytes
then5 x 16UV transforms for TEXCOORD0-4: f32 offset_u, scale_u, offset_v, scale_v
  • MatI Ids must be exactly 0 to n-1 (all 12,517 stock models). A gap leaves the car loading for ever. A mesh's material is the MatI's Id metadata, not its place in the bundle; they are out of order in about two thirds of stock models.
  • A texture coordinate is drawn at u = offset_u + raw / 65535 x scale_u (the same for v), with the mesh's transform for that TEXCOORD.

Vertex layouts and buffers

VLay data: u16 name count, names (u32 length, text), u16 element count, elements (u16 name, u16 semantic index, u32 slot, u32 DXGI format, i32 offset, u32 class), a u32 packed format per element, u32 flags (TEXCOORD k = bit k, TANGENT k = bit 5 + k, COLOR0 = bit 10).

ElementA typical car part
POSITIONslot 0, R32G32B32_FLOAT (DXGI 6, packed 3), 12 bytes, a stream of its own
NORMALR16G16B16A16_FLOAT, w 0
TEXCOORD0-3R16G16_UNORM. TEXCOORD2 reads the AO map; TEXCOORD3 is the livery UV
TANGENT0-1R16G16B16A16_FLOAT, w = handedness ±1
COLOR0rare: 45 stock layouts (lamps, markers)
Attribute stride40 bytes (NORMAL at 0, TANGENT0 at 24, TANGENT1 at 32); flags 111
  • Glass adds TEXCOORD4 and TANGENT4 (a typical pane: TEXCOORD1, 2, 4 and TANGENT1, 4, flags 598). Glass shaders read TEXCOORD1, 2 and 4: a pane without them is invisible.
  • VerB and MBuf data: u32 count, u32 byte size, u16 stride, u16 element count, u32 format, then the data. IndB: the same 16-byte header. The D3D buffer is made from the blob with no length check.
  • Buffer Ids: the position stream is -1 and the others 0, 1, 2 and so on.
  • Several meshes often share one vertex buffer, each using its own block of vertices (both doors in one model; gauge needles beside the dash). A float position holds one place, so two meshes that need a vertex in different places each need their own copy.

Skeletons and bones

  • Skel data: u16 bone count, then per bone: u32 name length, name, i16 parent, u16 first child (0xFFFF = none), i16 next sibling (-1 = none), then a 4 x 4 matrix of floats (row vectors, translation in the last row): the bone's local transform.
  • Every vertex is in its bone's frame. World position = p x (bone's global matrix). To move a part to another skeleton and keep it in place, use p x G_old x inverse(G_new) with full 4 x 4 matrices (many bones are rotated: struts, wipers, spindles, paddles); normals and tangents turn with it.
  • Bone numbers differ between cars: renumber a mesh's bone by name. For a bone the skeleton lacks, put the mesh on its nearest ancestor that exists, moved to stay put (it then moves with that bone).
  • Every stock carbin's bone names are in the skeleton, each at its index.
  • A Skin blob holds two (half weight, half bone index) pairs per vertex. A part skinned to bones the skeleton lacks can be drawn whole, unskinned, in its rest pose: skinning count 0, Skin Id -1, Skin blobs removed.
  • skeleton.modelbin is a subset of skeleton.gr2's tree with the in-between nodes folded away (only <root> is extra). Keep the two files one skeleton: write both from the same world poses.
  • A car can carry a skeleton no stock car has (proven in game). More bones (67, where the stock car it was built from has 43), bones with names FH2 never uses, and a larger Skel copy in every model all load and draw. The exe itself asks for only a few bones by name: GrannyRootBone, root, body, driver, boneSteeringWheelSpindle, controlArm..., rotorLF_center / rotor_center and spindle.

The carbin

The carbin is version 5; its full byte layout is in 10.17. Strings are a u32 length and the text. The reader (game+0x11AECB0, models game+0x11ADEE0) reads fields in order by version and has no end-of-data check: a read past the end copies nothing. Draw groups use bits 0-4 only; LOD flags 0 become 0x7E.

  • Model entry: path, a 16-float placement matrix in rows (point p drawn at p x M[:3,:3] + M[3,:3], car space), a u16, its bone's name, 11 bytes, a u32 count, then (MatI name, u32 paint zones) per MatI. The AO maps it reads (..._AO.swatchbin) follow, before the next model's path.
  • Kit and plain models carry an identity matrix and sit on <root> (3,868 of 3,868 kit models): their vertices are in car space. Only corner parts (wheels, brakes, calipers, under scene\_library\Scene\) carry real matrices. Calipers are placed apart from their rotors (a typical rear caliper 0.137 m behind and 0.033 m above the hub, turned 15°). FH2 never draws right-side models as mirrored left ones.
  • Upgradable parts: sections u16 3, u32 part type, u32 n, then n entries of 45 bytes (u16 3, u8 level, u8 flag, u32 part Id, u32 body Id (-1 = the car's own), u8, 8 floats). Part types: 9 = rear wing (the only car-level one); 34, 35, 36, 37, 40, 41 = bumpers, side skirts, bonnet, roll cage (body-level). Each upgradable model has a part list before its path: u32 kind, u32 n, n x u32 part Id, u16 15, then the path.
  • Part Ids are database row Ids. In all 354 stock carbins every part Id is the car's Id x 1000 + n. A model whose (part Id, body Id) matches no database row isn't drawn. A new car with its own Id must have its rear-wing Ids changed, and every part and body Id if it has a body of its own. A car pack does this from <car>.part-ids.txt, which says where the carbin's rear-wing Ids sit (zip cars\<car>.zip, entry <offset>, at <offset> <n>); the carbin must then be stored uncompressed in the zip.
  • Plain parts: a part with no upgrades is always drawn: u8 type, u16 2, u32 type, a u32 count and the models, then 8 floats (its box). Where a car has only a stock row in a body upgrade table, its carbin has a plain part of that type, or nothing (33 stock carbins have no upgradable parts at all).
  • An empty upgrade (one that draws nothing) has an inverted box: minima +3.4e38, maxima -3.4e38.
  • No stock car has a second car body as an upgrade, a kit on another body, or a carbin upgrade on one.
  • Hiding a part the new car hasn't got: keep the file (the carbin names it) and set every mesh's LOD flags to 0.
  • <part>__SLOD.modelbin is a part's showroom LOD.
  • Draw groups (a model entry's bits 0-4): 1 exterior, 2 cockpit, 4 shadow, 8 bonnet, 16 windscreen reflection. The bonnet and dashboard cameras draw only the bonnet group (on the stock 2002 Silvia: the bonnet, its liner and the wings). A model in the wrong group goes missing in those views or is drawn over the road. Setting them per model is proven in game.

Wheels and track

  • Wheel models have no tyre; the game draws tyres itself. A wheel model's frame is x 0 to 1, y and z ±0.14.
  • The tyres' outer faces sit at the body's Data_CarBody.ModelFrontTrackOuter and ModelRearTrackOuter (m, track + tyre width); the carbin's wheel placements don't matter. Wider tyres with the same value grow inwards.
  • Rim diameter is the car's (List_UpgradeRimSize*); tyre widths and track are its body's.

14.6 Materials and textures

A mesh's look is three layers (shader, library material, the model's MatI), and a MatI can set any parameter its shader declares, so materials are best matched by parameters rather than by names. FH2's library has 3,493 materials in media\cars\_library\Materials.zip; shaders are in media\_library\Shaders.zip. The general format is in 10.9.

The three layers

All proved in code.

  • Shader (.shaderbin, game+0x1139A10, 0x141139A10): BLEN meta (+0x200 blend = transparent pass, +0x201 alpha-test default), DFPR defaults, and maps from parameter hash to constant-buffer offset (CBMP), texture register (TXMP) and sampler.
  • Library material (.materialbin, game+0x10DB1C0, 0x1410DB1C0): a bundle of MATL (the shader's path) and MTPR (defaults), plus ATST.
  • MatI (inside the model, game+0x10E1D50, 0x1410E1D50): itself a bundle of MATI (the material's path, varint length), MTPR (the parameters this instance overrides; all zeros when it overrides none) and a tail. A car's own materials are .materialbin files in its zip (33 in a 2015 Mustang GT) and edit the same way.
  • Each layer copies the one below and applies its own records (Shader::Build game+0x1150290, 0x141150290; Material::Build game+0x10F1350, 0x1410F1350; MaterialInstance::Build game+0x10F15B0, 0x1410F15B0). An unknown hash is skipped. A record's size comes from its type, not from the shader: a wrong type overwrites the neighbours.

MTPR records

A count, then per record: u8 major (02), u8 minor (00), u32 hash = the CRC-32 of the shader parameter's name, u8 type, the value.

TypeValue
0 Vector, 1 Colorfour floats
2 Floatfloat
3 Bool, 4 Inti32
5 Swizzle, 7 Sampler, 8 ColorGradient, 9 FunctionRange(rare on cars)
6 Texture2Dvarint length, the path text, then the u32 CRC-32 of the lower-case text (the texture's Id)
11 Vector2two floats (a tiling)
  • The tail: u32 CRC-32 of the bytes of all non-string records; u32 CRC-32 of all string records in order (0 without strings); zeros. Both hold in all 27,854 stock MatIs with strings.
  • A number parameter can be changed, or added at the end (count + 1); redo the CRC. The tail words are only a fast equality reject, so stale ones are harmless, but write them right.
  • A texture path can be changed: cars load a texture by its path text (the only Id fix-up handler is the track's). So a MatI can name a new file in the car's zip. A new texture file carries the same GUID in its name and in its header.
  • The parameter names come from the shaders' DXBC reflection; 886 hash-to-name pairs are known.
  • Some library materials are templates whose textures are placeholders (defaultch*) that cars override; used as they are, they show green "CH" letters. Others (metalpainted_001) take their colour from the car's MatI and are mid grey alone.
  • Cabin models use interior materials (interiorengine/X, the interior twin of basematerials/X); an exterior material in the cabin takes sun and sky like a body panel.

Passes

  • Shader BLEN[0] set: transparent pass, dual-source blend (src ONE + dest x SRC1_COLOR). Glass writes premultiplied colour and a transmittance; GlassColorColorParam (0x1925D9BF) tints the transmittance.
  • Else ATST (the MatI's, else the library's, else the shader's, game+0x10DA540, 0x1410DA540): alpha-to-coverage (OpaqueAlphaToCoverage, game+0x13A2E3C, 0x1413A2E3C).
  • Else opaque.
  • There's no alpha blending for non-glass materials and no alpha threshold. Coverage follows alpha, so a fine grille whose small mips average 29 % metal draws 29 % coverage and fades from any distance.
  • There is no two-sided flag, and no per-material sampler or mip bias on the main maps.

Paint zones

The carbin lists each model's MatIs by name, each with its paint zones, and the game paints by the place in that list, not by the MatI's name.

ZonesPainted as (a 2015 Mustang GT)
0not painted: car paint shows its own grey
1the body
4the bonnet
8the mirrors
16the wing
  • The list leaves out MatIs named "ErrorShader" (4,216 of 4,238 stock models then match exactly).
  • Give each model one car paint MatI, at the place the carbin marks painted; a car paint MatI at a place marked 0 stays unpainted, and so does the model's other car paint.

Glass, grilles, gauges

  • Glass shaders (car_windsheild, car_window_interior, car_windsheild_interior) read TEXCOORD1, 2 and 4 and TANGENT1 and 4; a pane without TEXCOORD4/TANGENT4 isn't drawn. TEXCOORD4 is a flat projection of the pane, an exact affine function of position (a windscreen's u = 0.657x + 0.5 across the car, v up it, both 0 to 1). Stock window MatIs set bool 0xF2FDFE8E to 0. Lamp lens tints: basematerials/gls_red, gls_amber.
  • The grille shader ch1diffnormglossalphaemissive writes alpha = AlphaTexture(UV0 x AlphaTiling).x x g_AlphaScalar when CH1OpacityMaskSwitchBool is on, else 1. A "filled" grille is the same material with three parameters set (ATST 1 to 0, the opacity switch 1 to 0, NormalHeightScale 5 to -4).
  • CH1 shaders have per-texture tiling (vec2 AlphaTiling, NormalTiling, ...); CH2 shaders uTile/vTile.
  • Fine see-through mesh fades in FH2 well before the grilles of stock cars tile as finely: keep round-hole grilles under about 22 repeats a metre outside (38 in the cabin) and honeycomb under about 111.
  • Gauges: gauges_diffemissivelerp with DiffuseATexture, EmissiveTexture, CH1EmissiveMapSwitchBool, EmissiveColorColorParam (0x21EC1E4D).
  • A dial picture's alpha is its opacity (int_gauges; 324 of the 372 stock dial maps are opaque all over). A see-through picture shows the road through the dash.
  • Gauge glass on a material whose emissive is on (gls_lightbulb) turns the dials white. The stock RX-7's gauge glass is gls_clear.
  • Library materials have colours of their own. basematerials/metalpainted_metalic_001 is blue as it stands (parameter 0xC017A27E = (0.011, 0.025, 0.328), 0xEF5CCE09 = (0.008, 0.01, 0.095)), and metalpainted_001's 0xEF5CCE09 is red (0.578, 0, 0). Stock MatIs always set both. wheelmaterials/* take their colour from 0xC0CB2820 (aluminum_clearcoat_flake 0.871, metalicpaint_midgrey 0.068, paint_matteblack 0.018). A MatI that sets none shows the library's colour.

Badges

FH2 has no badge logic: a badge is a MatI that names its pictures, and the game draws what it names. Stock badges are either library badge materials (badges/*.materialbin, shaders badge_metal_ch1normalglossopacitylocalao and badge_clc_diffusemetallerpch1masknorm) or emblem MatIs on these generic materials:

MaterialStock MatIsWhat it reads
int_strdsymbols_007931DiffuseATexture, AlphaTexture
int_symbolscustom_001617the same, and NormalTexture
plastic_embossed_alpha483NormalTexture, AlphaTexture, colour DiffuseColorGroupColorParam
chrome_alpha483colour F0aVector4 / F0bVector4
metalpainted_alpha315
symbols_emissive81lit emblems
  • Emblem maps read TEXCOORD0; opacity is alpha-to-coverage.
  • The library defaults are green defaultch1_* placeholders, so a copied emblem MatI must set every map and the colour.
  • New emblem pictures added to the car's zip are read: badges made as copies of stock emblem MatIs naming the car's own pictures show right in game (proven in game).

Lamps

A lamp MatI lights by its int parameter 0x493073A0: the light controller it follows (the same list as Lights.bin's types, see Light types).

CodeLight
0brake (also the high brake light)
1reverse
13headlight
15daytime running
17high beam (and headlight)
18fog
20 / 21right / left turn
32taillight
37separate high beam
46sidelight
47number plate
69tail and brake
70none
  • Lit = base colour x the controller's value; with DualBrightSwitchBool (0x08FD49DB) on, the second code's (0x90C4AA7F) instead, plus a little of the first's; all times EmissiveType_floatVal (0x6F45C5F1) when EmissiveOnOffBool (0x0BF3318B) is on. A CH1 lamp colour is 0xC308C931 (four floats).
  • Lamp-capable materials with no code set light with the brakes (code 0 is the default of gls_lightbulb, lbk_custom_001 and the chrome ridges): clear lenses, vents and trim then glow on braking. Set code 70 on anything that isn't a lamp.
  • A lamp MatI without a brightness is too dim to see; don't use one as a template.

Textures

The general swatchbin layout is in 10.8; the platform's docs/game-notes.md (Thumbnails) has the swizzle as code.

  • A .swatchbin is a Grub 1.0 bundle with one TXCB 2.0 block. Its TXCH metadata holds the GUID (first 16 bytes), width and height (u16 at +16, +18), depth (+20), mip count (+28) and format/tiling bytes (+31 to +34). Data is copied raw (game+0x10DBB90, 0x1410DBB90) with no size check: a header that doesn't match its data draws garbage.
  • Format = (u16 at +31 >> 5) & 31: 0 BC1, 1 BC2, 2 BC3, 3 BC4, 4 BC4 signed, 5 BC5, 6 BC5 signed, 7/8 BC6H, 9 BC7, 10 RGBA32F, 11 RGBA16 UNORM, 12 RGBA16F, 13 RGBA8, 14 B5G6R5, 15 B5G5R5A1, 19 R8, 20 A8. The low two bits of +31 are the tiling (2 = 2D thin, 1 = 1D thin); +33 = 0x12 means sRGB (BC1/2/3/7 and RGBA8 only). Bit 26 3D, bit 25 cube.
  • Textures are Xbox One tiled (FH2 PC is the Xbox One build): an 8 x 8 micro tile with its elements in bit order x0 y0 x1 y1 x2 y2; 2D thin macro tiling with 4 pipes (P4_16x16), 8 banks, 256-byte pipe interleave. For block formats (x, y in elements, e the element size):
t      = e * (x0 | y0<<1 | x1<<2 | y1<<3 | x2<<4 | y2<<5) + 64 * e * (macro tiles before it, in row order)
pipe   = (x3 ^ y3 ^ x4) | (x4 ^ y4) << 1
bank   = (tx0 ^ ty2) | (tx1 ^ ty1 ^ ty2) << 1 | (tx2 ^ ty0) << 2        tx = x / 32, ty = y / 8
offset = (t & 255) | pipe << 8 | bank << 10 | (t >> 8) << 13
KindElementMacro tileMips
BC1/BC4 maps8-byte block64 x 32 blocksall; under a macro tile: 1D thin
BC5/BC7 maps, thumbnails16-byte block64 x 32 blocksall (thumbnails 1)
AO maps (R8)1-byte pixel128 x 64 pixels (banks 1 x 4)all; under 128 x 64: 1D thin, each mip at least 256 bytes
Dash textures (RGBA8)4-byte pixel64 x 32 pixels1
  • 1D thin = 8 x 8 micro tiles in row order, the pitch at least the padded mip 0's >> level. A 2D texture is padded to whole macro tiles; mip 0 is 2D even when smaller than one; later mips are 2D while they hold a whole macro tile.
  • A non-power-of-two texture with mips is stored at the next powers of two, every level, its picture top left.
  • These rules lay out all 36,987 stock textures (all but 6 cubes and arrays) byte for byte (proved).
  • AO maps: R8, 255 = no occlusion, 0x05 the empty background, every mip, read through TEXCOORD2; models share them (a car's wing map also serves its doors and mirror bases). Two header spellings: 6e 02 00 90 (most) and 6d 02 00 40 (every mip 1D).
  • What an AO map holds: how much of the sky each point sees, past an endless ground plane and the whole car. On 40 stock cars an open surface is about 250 facing up, 150 upright and 70 facing down, darker low on the car than high, and never black on paint (62 at the least). Maps of panels that meet agree where they meet.
  • AO made any other way (each panel levelled on its own, or close-range detail only) gives every panel its own grey, with a step at each seam. Rays cast from each vertex against the car's shell and the ground reproduce the stock maps (correlation 0.82 on 20 cars' painted panels) and look right in game.
  • Dash textures: RGBA8 with premultiplied alpha (straight alpha draws text with bright, hollow edges), one mip; 2D when they hold a 64 x 32 macro tile, else 1D (TXCH +31..+34 ae 01 00 98 or ad 01 00 48).
  • Interior LOD (the cabin seen from afar): a MatI like interior_LOD1 with its own DIFF and LITE (BC7) and GLOS (BC4) maps.
  • Thumbnails: see Thumbnails.

14.7 Lights

Lights.bin hangs each lamp's glows and beams on the car's lamp models, in car space; LightPresets.bin says what each one looks like. Both sit at the root of the car zip and must be written as a pair: Lights.bin points into that exact presets file by index. All 354 stock pairs parse and rebuild byte for byte with the layouts below (proved).

Lights.bin

Read by game+0x11ADD20 (0x1411ADD20).

OffsetTypeField
0u32magic 0xDEADBEEF (optional: without it the reader assumes version 0)
4u32version 1 (1 or more means the LOD-override list is present)
8u32lamp model count (at most 23 on a stock car)
per modelu32 length, path (no NUL, lower case game:\media\cars\<car>\scene\...\x.modelbin), s16 bone
u32light count (at most 278)
76 bytes eachu32 preset (index into LightPresets.bin), u16 type, u16 sub, u32 model index, f32[4] pos0 (x, y, z, 0), f32[4] rot0 (quaternion x, y, z, w), f32[4] pos1, f32[4] rot1
u32LOD override count (0 on most stock cars: the trailing 4 zero bytes)
72 bytes eachu32 LOD (1-5: that LOD and every coarser one), u32 light index, pos0, rot0, pos1, rot1
  • Positions are car space, metres: x > 0 is the car's right, y up, z forward.
  • A light's rotation is in its bone's frame; its position is car space with the lamp at rest (unconfirmed: read from the data). A beam stored for a bone that is turned at rest points wrong on a bone that isn't: pop-up lamps taken from a bone turned 46° at rest shone 47° up when raised. Turn each such light by the difference between the two rest orientations (proven in game).
  • sub (game+0x118F230, 0x14118F230): 0 = always used; 1 = only when a per-car flag is 0; 2 = only when it's 1; 3 = always. Headlights have a short sub-1 beam (range 15-18 m, cone 55-60°) and a long sub-2 beam (50-120 m, 88-99°); the red ground spot under the brake lights is sub 2 only. What the flag is isn't proved (likely player-car quality).
  • The bone is an index into the car's skeleton (<car>_skeleton.modelbin); 1 is root (93 % of stock lamp models). Pop-up headlights, boot-lid lamps and mirrors use their animated bone (boneHeadlightL, boneTrunk). If bone >= 0 and inside the bone palette, the light follows that bone's movement from rest (game+0x11C0CB0, 0x1411C0CB0); otherwise it follows nothing. Negative values occur on a few stock cars.
  • pos0 to pos1: per frame (game+0x13B6A90, 0x1413B6A90) the light's transform is lerp(pos0, pos1, w) and slerp(rot0, rot1, w), with w a clamped blend of per-car values (game+0x1387EF0, 0x141387EF0): unconfirmed, but likely damage. On stock headlights pos1 sits 1-5 cm further back, taillights about 10 cm forward.
  • The model path must resolve to a model the car draws: FH2 never draws a light whose model it can't find.

Light types (the light controllers)

The type indexes the car's per-controller amount array (car+0x1B70 + type x 4). The exe names all 71 (Offset_<name>):

0 BrakeLight, 1 ReverseLight, 11 DoorOpen, 12 EngineStart, 13 Headlight, 14 ShiftLight, 15 DayTimeRL, 16 RemoteUnlock, 17 HighBeam, 18 FogLight, 19 SequentialBrakeLight, 20 RightTurnLight, 21 LeftTurnLight, 22 HazardLight, 23 OpenHood, 24 OpenTrunk, 25 RainDriving, 26-28 Position1-3, 29 Differentiator, 30 ElectroLuminescentLivery, 31 ConvenienceLight, 32 Taillight, 33 Brakepulse, 34-36 SequentialBrake1-3, 37 HighBeamSep, 38 DayTimeRLAmountDay, 39 DayTimeRLDim, 40-45 SequentialIndicatorLeft/Right1-3, 46 Sidelight, 47 Numberplatelight, 48 FogLightRear, 49-52 LightsFlashingFrequency1-4, 53/54 BrakeIndicatorL/R, 55 BrakeReverse, 56/57 BrakeSeqIndicatorL/R, 58/59 BrakeTailIndicatorL/R, 60 DRLBrake, 61/62 DRLBrakeIndicatorL/R, 63/64 DRLIndicatorL/R, 65/66 SidelightIndicatorBrakeL/R, 67/68 SidelightIndicatorL/R, 69 TailBrakeLight, 70 Null.

Stock cars use 0, 1, 12, 13, 15, 17, 18, 20, 21, 32, 37, 38, 46, 48, 60, 63, 64, 67, 68 and 69. Indicators are 20 on the right (x > 0) and 21 on the left. Whether the game drives the controllers no stock car uses (12, 25, 47, 49-52) is unknown.

LightPresets.bin (LDFB)

OffsetTypeField
0char[4]LDFB
4u32total size (= the file's)
8u32version 1
12u32entry count (at most 16 on a stock car)
16entriesu32 size (with this 8-byte header and zero padding to 4), u32 field count, then fields {u8 tag, u8 length, data}, zero padding

Tags (named in the exe's table): 00 Light_Enabled (u8), 01 Light_Type (u32: 0 Point, 1 Spot, 2 PointAmbient, 3 SpotSimple; stock always 1), 02 Light_Colour (3 x f32), 03 Light_Range (3-120 m), 04 Light_Intensity (0.2-1.0), 05 Light_PenumbraAngle, 06 Light_ConeAngle, 07 Light_AttenuationProfile (4 or 5), 08/09 Light_ActivationThreshold/Transition, 0a Light_ShadowType (always 0), 0b Light_ProjectedTexture (path with NUL, or a single 0), 0c Glow_Enabled, 0d-3c the Glow_* settings (Glow_Size ... Glow_Occlusion_DistantPushOut; colours at 11, 1d, 28, 31), 3d-3f Glow_DistanceFadeStart/End/Amount (unused by stock cars).

  • Two kinds: a glow has tag 0c (52-53 fields: 2 8 9 c d ... 3c); a light source (spot) has none (0 1 2 3 4 5 6 7 8 9 a b [11 1d 28 31] 3b).
  • Stock presets are per-car copies of 71 templates. Pick from those rather than inventing values: the units are FH2's own (intensity up to about 1, ranges in tens of metres).
  • Stock spot lights are only headlight beams (types 13 and 17, sub 1 and 2) and the brake spot (69, sub 2), plus a few exceptions; everything else is glows.

14.8 Collision hull

physicsdefinition.bin at the zip's root is the car's collision shape: convex hulls as point clouds in car space, version 20, in the same family as the tracks' PhysicsDefinitions.bin (10.12). A car that keeps another car's file collides as that car's shape (a 2.4 m city car with a borrowed hull was hit as 4.2 m long). All 354 stock files parse and rebuild byte for byte with this layout (proved):

OffsetTypeField
0u64definition count, 1
8u32version, 20
12i32type, 1 (vehicle)
16f32mass, 0
20f32[9]inertia, 0
56f32[9]inverse inertia, NaN (0xFFC00000)
92f32[3]half extents: the AABB half size of all points
104f32radius: the largest distance of a point from the car origin
108f32[3]graphics offset, 0
120i32child count, 0
124f32[3]AABB centre
136u32shape count
140shapeseach 56 + 16n bytes (below)
endu640 (MaxGlobalIndex)

Each shape:

OffsetTypeField
+0u325 (a point cloud: one convex hull)
+4u3248 + 16n, the size of the rest
+8u32flags: 0x05 plus collision-layer bits 0x100/0x200/0x400
+12u320
+16u3248 (start of the points, from +8)
+20u320
+24u32n, the point count
+28u320
+32u3248 + 16n (end of the points)
+36u32[5]0
+56f32[4n]points x, y, z, w (w = 0)
  • Stock cars almost always have 2 hulls, typically of 75 points each (1 on a few, such as the bus); sizes run from about 1.5 m to 12 m long.
  • Recompute the half extents, radius and centre from the points whenever the points change.
  • Ride heights come from the database, not this file.

14.9 Factory colours, livery masks and Forzavista pins

Three small files at the zip's root decide a car's paint choices, where vinyls land and its Forzavista walk-around. All 354 stock copies of each rebuild byte for byte with these layouts (proved).

ManufacturerColors.bin

Read by game+0x219270 (0x140219270).

  • A Grub 1.0 bundle (16-byte header with a u16 blob count, one 24-byte blob record; data at 0x28) holding one blob, MNCL (stored reversed as "LCNM"), version 1.0, no metadata, the file padded to 4 bytes.
  • Data: u8 colour count; per colour a u8 entry count; per entry a u16 zone mask, 3 x f32 preview colour (sRGB, 0-1) and the paint material path (7-bit-encoded length + UTF-8). One colour is one factory choice; one entry is one paint on a set of zones.
  • Zone masks stock cars use: 29 (body, bonnet, mirror and wing: 1 + 4 + 8 + 16), 2 (stripes), 3840 (secondary), 61440 (tertiary), and 0 (trim, on one car). The mask is a u16, so no wheel zone fits.
  • At most 28 colours on a stock car.
  • The preview is the sRGB form of the material's linear PaintColorColorParam (true to 1e-3 on 1,867 of 2,926 entries).
  • Paints are _library\materials\carcolors\* (1,041 files, shader carpaint_standard) or the car's own: 421 stock paths point into the car's zip as Game:\Media\cars\<car>\materials\carcolors\<name>.materialbin (zip entry Materials/CarColors/<name>.materialbin).
  • A new paint: copy a stock paint of the same kind (solid matadorred, metallic steelgreymetallic, pearl shadowbluepearl, matte satinsilvermetacura) and set PaintColorColorParam (0xC0CB2820) to the linear form of the preview colour, keeping its alpha (1.0 on most, 0.914 on 20), then redo the MTPR CRC. Other paint parameters: FlakeAmount, FlakeGloss, FlakeNormalIntensity, BaseCoatScalar, PaintType, UniqueBaseColor*.
  • The game has no colour names anywhere: neither the string tables nor the exe (only the menu title IDS_ManufacturerColors).
  • The database's per-car swatches are Combo_Colors (4.5.8).

Livery masks

  • LiveryMasks\Masks.xml: one element per projection, Front, Back, Top, Left, Right, Wing (the exe knows no others), with attributes valid, xorigin, yorigin, top, bottom, left, right, xAxis, yAxis, xScale, yScale (always 1) and rotation (degrees).
  • The numbers are livery-atlas pixels from the atlas centre, y up: column = x + W/2, row = H/2 - y. left/right/top/bottom are the mask content's extent ("top" is the smaller y); xorigin/yorigin the rectangle's centre. xAxis/yAxis name car-space axes (Left runs -z, +y; Right -z, -y turned 180°). There are no metres: car to atlas is baked into the models' UVs.
  • One texture per projection, <name in lower case>.swatchbin beside the XML: BC4, 1024 x 1024, one mip, the same header on all 1,874 stock masks (GUID 0...1). Each is 8-bit coverage of the paintable panels in the livery UV atlas, a picture of the UV layout rather than of the car.
  • The livery UV is TEXCOORD3, read at (u x 1024, v x 1024): 99 % of a body's vertices land on a lit mask pixel. Windows have no TEXCOORD3 and take no livery.

Forzavista pins

The file is <MediaName>.avpins at the zip's root.

  • XML: <PointsOfInterest Template="<name>"> with InitialStates (Set/UnSet State), Views (View Name, Locator: Pos, Size, Limits, Direction) and PointOfInterest elements (Name, IconPath, IconType of CarInteraction / Tour / Customize / Community, Tutorial IDs, PreConditions, Visibility with Locator, Pos, Axis, Apex, Distance, LookAt, Camera, Cursor; Action with Cinematic, SceneName, Requires, SetView; PostConditions).
  • Templates live in media\cars\_library\*.avpins (Default, 2Door_Sedan, Coupe_RevHood, ...). A car's file is a delta on its template: a point with a template point's Name replaces it; Name plus OverrideMode="Remove" deletes it.
  • Positions are metres in the named locator's frame (Locators.xml); root is car space.
  • Cinematic names are entries of media\Cinematics.zip (eight stock references are missing, so a missing one is tolerated).
  • Write it with CRLF line ends, no XML declaration and no byte-order mark; empty tutorial and scene names are a single space.

14.10 Livery designs

A design is a zlib-packed C_livery file in the save, and a car shows vinyls only when its garage row points at a design. This section describes the files so tools can read designs; the guide never tells you to write saves, so steps for putting layers into a save are left out. To change a design, edit the editor's live objects while the player has it open and let the game save (4.12, 9.8).

Where designs live

The save layout and how to read only committed revisions are in 4.11.

  • Under Azimuth a save entry is a folder saves\player-1\<name>\revisions\<16 digits>\ holding commit and data\. commit is text: a header line, blobs N, then one line per blob with its SHA-256, size and name.
  • BaseLivery_<car Id>_<stamp> is a car's plain paint (header type 4). It never draws layers.
  • Livery_<car Id>_<stamp> is a design (header type 3): C_livery, header, bigThumb.png, smallThumb.png.
  • Applying a design to a car makes a Livery_ entry, removes the car's BaseLivery_ entry, and sets Career_Garage.LiveryFileName to the new one. There is no catalogue table: designs are listed from the entries themselves.
  • The profile's PlayerDatabase blob is plain SQLite after an 8-byte ssmc prefix.

The C_livery file

u32 packed size, u32 size, then a zlib stream of chunks: crlv, four lvry, and lvyg inside the first lvry (tags are stored reversed).

PartLayout
crlvtag, u32 version (1), u32, u32, u32 car Id, u32 factory colour index, 1 byte
first lvryu32 version (5), u32 id, u16 0, u16 9, u32 count and count x 7 bytes, u32 byte size of the lvyg block (tag included), the block
lvygtag, then six side groups in a row: Front, Back, Top, Left, Right, Wing (rotations 0, 0, 0, 0, 180, 90)
groupf32 x, y, scale, rotation; u8 flags; u16 child count; u32 mask size (count / 8, rounded up); the mask (bit k set: child k is a group); the children
layer (31 bytes)u8 1, u16 shape, f32 rotation, x, y, scale x, scale y, skew, then blue, green, red, alpha
the other three lvrypaint per part (20 records of 40 bytes, a factory colour index each); not decoded
  • A layer's shape is an Id in the database's Livery_VinylsDecals (1,440 rows; 101 is the first letter shape).
  • header: u32 0, u32 name length, the name in UTF-16, u32 description length, a SYSTEMTIME, u32 type (3 design, 4 base livery), u32 id, u16 0, u16 9, u32 creator length, the creator, u32, 8 zero bytes, u32, u32 layer count, u32 car Id, u32, u32.
  • The format has no mask layers and no mirrored groups. A mirror is pushed down to the layers (position, rotation, skew and one scale negated); a mask can only be stood in for by a layer in the paint colour.
  • Designs of 3,030 layers, 1,263 of them on one side, in groups nested three deep, are known to draw in game.

14.11 Dash displays

A car's digital displays are one XAML page, UI\<MediaName>.xaml, which the game renders at 1280 x 720; every screen mesh (material interiorengine/digitalgauge) shows the part of the page its first UV set covers. Data_Car.GaugeID is -1 on every car: a page is used simply because it's there. 204 of 354 stock cars have one. The game's XAML reader and its quirks are in 4.7.

  • Lay the page out for the screens. A screen mesh shows page pixels (u x 1280, v x 720) from its TEXCOORD0; a typical cluster shows something like x 249-1027, y 18-395, and anything outside the screens' rectangles is never seen.
  • Root: <Page> with the standard WPF namespaces and xmlns:local="clr-namespace:ForzaUI"; x:Class="ForzaUI.<car>" or "DigitalGauge.<car>". The exe holds none of the namespace URIs: it finds types by name.
  • Config: a <local:DigitalGaugeConfig x:Key="Config" .../> resource: HasClock, HasExternalTemp, UseDegreesF, UseMPH, UsePsi, MaxBoost, MinBoost, MaxSpeed, HasAbsLight, HasStmLight, HasTcsLight, HasGAccelX/Y, HasShiftLights, HasTextTach, HasLapPlaceInfo, HasTextBoost, HasTextGAccel, HasTextOdometer, HasTextFuel, MaxFuel, MinGear, MaxGear, MaxRpm.
  • Bindings ({Binding X} on a TextBlock's Text): Speed, Tach, Gear, Odometer, TripMeter, Time, ExternalTemp, Fuel, AnalogGear, AnalogSpeed, TachText, FuelText, BoostText, BoostAnim, GAccelX, GAccelY, GAccelText, CurLapTime, LastLapTime, BestLapTime, LapMin, LapMax, CurPlace, MaxPlaces, TachMem, StartUp.
  • Gauges and bars animate through <local:StoryboardController SeekPct="{Binding Tach}" Target="{StaticResource Tach}"/>: a 1-second storyboard sought to the binding's fraction (for example a bar's ScaleX from 0 at 0 s to 1 at 1 s). A start-up animation hangs on <local:EventFire.FzTriggers><local:EventFireTrigger Event="StartUp" Storyboard="..."/>. Day and night are a VisualStateGroup x:Name="NightDaySplit" with states Day and Night.
  • Elements stock pages use: Canvas, Grid, DockPanel, Rectangle, Ellipse, Path (PathGeometry, PathFigure, LineSegment), Image, ImageBrush, TextBlock and Run, the Transform group (Scale, Skew, Rotate, Translate), Storyboards with Double/Object/Color/Point/Single animations and their key frames, VisualStateManager, BooleanToVisibilityConverter, local:TintEffect, local:CircularProgressEffect. The exe also knows ed:Arc (ArcThickness, StartAngle, EndAngle), Linear and Radial gradients, easing functions, Bezier and Spline segments and key frames, and Boolean and Thickness animations.
  • Fonts: five dash fonts in media\ui\Fonts.zip (DG1_ArialBold, DG2_LCD-BOLD, DG3_Moire-Bold, DG4_PF_Ronda_Seven, DG5_QuartzMS), named in pages as DG1_Arial, Moire, DG2_LCD, DG4_PF_Ronda_Seven, DG5_QuartzMS. They hold digits, punctuation and P R N D only: any other letter shows as a box, so stock pages draw every word as a picture.
  • Pictures: UI\Textures\<name>.swatchbin, named in the page as game:/media/cars/<car>/UI/Textures/<name>.png. RGBA8 with premultiplied alpha, one mip, Xbox One tiled (Textures); any size works with the right header. New files added to the zip are read. Two stock pages name a picture that isn't there, so a missing one doesn't break the page.

14.12 Animation

Everything that moves on a car (doors, bonnet, boot, pop-up lamps, wipers, windows, needles) and the driver is animated by Granny 2 files: a skeleton and short clips that turn one bone each. A part turns about its bone's place, so a part modelled for one pivot and played by a clip made for another swings about the wrong point (a pop-up lamp 15 cm off its hinge rose 4 cm and went 8 cm forward instead of rising 19 cm). The Granny entry in chapter 10 is Granny animation.

Granny files

Granny 2.9.20.1 is linked into the exe. Files are version 7, little-endian, 64-bit.

  • Magic e59b495e6f631f141e13eba990beedc4; header 0x1C8 bytes; at 0x20: version 7, total size, CRC, section-array offset (from 0x20), section count (8), root type ref, root object ref, type tag. The CRC at 0x28 is the CRC-32 of the file from 0x68.
  • Section headers at 0x68, 44 bytes each: compression, data offset, compressed size, decompressed size, alignment, first16bit stop, first8bit stop, pointer-fixup offset, fixup count, mixed-marshalling offset, count. Fixups (12 bytes: offset in section, target section, target offset) and marshalling entries (16 bytes) are never compressed.
  • Structures are packed with 8-byte pointers; a type entry is 44 bytes (u32 member type, name pointer, reference-type pointer, i32 array width, i32 extra[3], u64). Every car file carries the same 147-line type tree.
  • Compression (GrannyDecompressData, game+0x1EDD50, 0x1401EDD50): 0 stored, 1 Oodle0, 2 Oodle1 (game+0x1F6EB0, 0x1401F6EB0). The game reads stored sections, so a new or edited file can be written uncompressed: no Oodle encoder is needed. Reading the Oodle1 files needs a decoder; one has been rebuilt from the exe and decodes all 9,462 compressed sections in the game.
  • Oodle1: three 12-byte parameter blocks (one per stream: 32-bit data up to first16bit, 16-bit up to first8bit, 8-bit to the end), then one range-coded stream shared by all three; each stream restarts its models.
FileCompressionHolds
scene\<car>_skeleton.gr2Oodle1the car's Granny skeleton
Animations\*.gr2storedpart clips
Animations\<car>.gsfthe state machine, read if present ("no gsf" accepted)
scene\Drivers\default\*.gr2Oodle1the 13 driver clips
media\drivers\*.zip, driver.gr2Oodle1the seven driver bodies

The object tree

  • Skeletons: Bones with Name, ParentIndex, Transform (Flags, Position, Orientation as quaternion x y z w, ScaleShear 3 x 3) and InverseWorldTransform: 16 floats, inverse(world) transposed (row vectors), within 1e-6 on every bone of five cars checked. World = parent world x local.
  • Animations: Name, Duration, TimeStep (1/60), Oversampling (2), TrackGroups of TransformTracks (Name, Flags, OrientationCurve, PositionCurve, ScaleShearCurve).
  • Curve formats in car files: DaIdentity; D3/D4/DaConstant32f; DaK32fC32f (float knots and controls); D4nK16uC15u and D4nK8uC7u (quantized quaternions; scale/offset table at game+0x2360140, 0x142360140; 1/32767 at game+0x2363544, 0x142363544); D3K16uC16u, D3K8uC8u, D3I1K16uC16u, D3I1K8uC8u (control = quantized value x scale + offset); D9I* for scale. Animated curves are degree-2 B-splines (SampleBSpline2x*, game+0x1F1590, 0x1401F1590).
  • Adding a constant to a position curve is exact on any of these (the basis sums to 1): change the float controls, or the ControlOffsets of a quantized curve.
  • skeleton.gr2 is the car's whole node tree: bone 0 GrannyRootBone, bone 1 root. Bones only it has: body, driver, root_bone<Part> (the parents that clip position keys are relative to), boneSteeringWheel, locator_Wiper*, pivot_*. Checked on all 354 stock skeletons.
  • LODError, with e(b) = 10 x the largest |Position| among b's children: a leaf's value is its parent's e; a bone with children has the larger of 2 x e(b) and its children's values. Bones are stored in descending LODError. The exe doesn't read ExtendedData.

Part clips

  • Names: doorLF_open/close, doorRF_open/close, hood_open/close, trunk_open/close, headlightL/R_open/close, wiperFront, wiperRear, windowLF/RF, speedometer, tachometer, fuel, boost. A close clip starts at the open pose.
  • One track per bone. Rotation keys are the bone's whole local orientation (rest x the turn); position keys are its place relative to its parent in skeleton.gr2, often a bone only the gr2 has (root_boneHeadlightL, root_boneGauges). Clip key + gr2 parent, the gr2's rest pose and skeleton.modelbin's bone all name the same point.
  • Doors, bonnets, boots, pop-up lamps, wipers and needles turn about one axis (pop-ups: 57.3° in 0.4 s; doors about 64°); some panels slide instead (one car's bonnet clip lifts it 10 m up, out of sight).
  • Needles turn about one axis of their bone's rest frame from the rest pose (the first key is rest). Example sweeps: a speedometer 0 to 252.8° over 6 s in 10 keys, a tachometer 0 to 269.5° over 30 s; the game seeks the clip by the gauge's value.
  • Which way parts open: on every stock car, every door swings away from the car's middle and every bonnet, boot, pop-up lamp and wiper goes up at the clip's widest turn (84 of 84 tracks). Helper bones (struts, aim and constraint bones, small blade trims) don't follow this.
  • The clip file: uncompressed; one Animation named as the file's stem; one track group, GrannyRootBone; tracks sorted by name, case-sensitive. A track names its bone by string and replaces that bone's whole local pose; only bones that move have tracks. Text tracks carry events: root has the open and close begin/end marks, root_bone<Part> the audio events. Stock door and bonnet motion is linear.
  • Long float-key curves play: a DaK32fC32f curve of 851 knots runs in game.

The state machine (.gsf)

Animations\<car>.gsf is a Granny Animation Studio state machine, a Granny file like the others (same header and CRC). It decides which parts can move at all: a clip in the zip with no slot in the .gsf is never played.

  • What it holds: its own clip list (AnimationSlots and an AnimationSet Base naming .\<clip>.gr2); a tree CharacterRoot, then LODSelect with three states (InRace_NonFocus, Autovista, InRace_Focus), each a blend graph with one module per part (door state machines idle / open / close with event sources, a gauges graph, the wiper); and three root parameter groups: gauges (per car), dynamics (speed 0-220 mph, brake 0-1, inRace 0-1, the same in every car) and GameInputs.
  • Gauge ranges: each gauges parameter has a full-scale MaxValue (one car: tach 8, speed 174) and the needle clip is sought by the value against it. A range can be patched in place (three floats per parameter, then the CRC).
  • Names in it: the bone names are text-track names for events (root_bone<Part>, case-insensitive), not bone masks. The only string naming the car is ModelNameHint, a path from the developers' machines.
  • Stock coverage: 354 files, 116 clip names in all; the largest lists 26 clips (the Huayra). Bonnet, boot, active wing, air brake and roof modules exist only in the cars that have those parts.
  • Door state machines clamp their Time on the assumption of 1-second clips.

Proven in game:

  1. A car runs another stock car's whole .gsf. A car given the McLaren 650S's file gets a working wing and air brake, so ModelNameHint isn't checked.
  2. The per-slot AnimCRC isn't enforced. Clips whose tracks differ from the ones the file was made with play.
  3. A rewritten .gsf loads. The file read into a tree and written out again, with another byte layout and changed values, runs.

Active aero is a state machine of that name driven by dynamics. On the 650S the wing rises at speed > 60, drops at speed < 55, goes to its high-speed position at speed > 150 (it plays the close clip) and the air brake opens at brake > 0.5. The tests are scalar_compare nodes (operation 0 is <, 1 >, 2 <=, 3 >=) and their values can be changed: a wing set to rise at 120 mph does so in game. In the garage view an event source active_aero toggles it.

Moving a pivot or reversing a swing

  • To put a bone's pivot where a new part needs it, change it everywhere it is: the clips' position keys (in the parent's frame), skeleton.gr2's rest position and the InverseWorldTransform of the bone and every bone below it, skeleton.modelbin and the Skel copy in each model. Then move the vertices of every mesh on a bone whose place changed back by the same amount, in that bone's frame, so nothing moves at rest.
  • Only the move across the turning axis matters: sliding a hinge's pivot along its own axis changes nothing.
  • To make a part open the other way about its pivot (a door hinged at its other end, wipers laid out as a mirror image), rewrite every orientation control q as q0 · conj(q0⁻¹ · q), with q0 the bone's rest orientation. That is linear in q, so exact on a B-spline's controls. Write it as DaK32fC32f: stock clips use it 1,878 times, and its type definition can be taken from a file that has one.
  • Lights hung on an animated bone follow its movement from rest, so they move with the new pivot without changes.

A skeleton and clips written new

A new car doesn't have to borrow a stock car's skeleton. skeleton.gr2, skeleton.modelbin, the part clips and the gauge ranges can all be written new as uncompressed Granny files, and cars built so load and animate in game (proven in game): doors with their jamb struts, bonnet with its liner pistons, boot, wipers, needles, an active wing.

  • Write skeleton.gr2 and the modelbin skeleton from the same world poses, the gr2 with InverseWorldTransform and LODError as under The object tree.
  • Keep every bone the .gsf names or a kept clip moves, even with nothing drawn on it. A car with a screen for a dash still needs the needle bones a stock state machine names. What the game does when one is missing isn't known.
  • Keep the stock steering-wheel bones (root_boneSteeringWheel, boneSteeringWheel, boneSteeringWheelSpindle) where the driver clips have them: those clips pose the car's wheel bones by name.
  • A clip the car has no motion for can hold its bones still at rest.
  • A degree-2 curve fitted through samples swings around a jump between two samples (a panel hidden by moving it hundreds of metres in one frame). It is harmless to see, but a read-back check must allow for it.

14.13 The driver

The driver's place in the car and the hands on the wheel are baked into each car's 13 driver clips; no locator, database value or IK moves them. So a new car either reuses clips from a stock car whose wheel is close to its own, or gets edited clips. Hiding the seated driver at run time is a hook, in chapter 7.

Bodies and clips

  • Seven driver bodies (media\drivers\*.zip: default, unsuited, suited, defaultRace, AIRace, AIUnsuited, stig) share 80 core bones with the same names, parents and rest pose (a standing T-pose, hips 1.0 m up): GrannyRootBone; the wheel chain root_boneSteeringWheel, boneSteeringWheel, boneSteeringWheelSpindle; Hips, Spine-Spine4, Neck, Neck1, Head, HeadEnd; Shoulder, Arm, ArmRoll, Forearm, ForarmRoll, Hand, FingerBase, four joints per finger; UpLeg, Leg, Foot, ToeBase, ToeEnd. The rest are LOD and wristband helpers at the origin.
  • 13 clips per car in scene\Drivers\default\ (folder from $(DriverAnimFolder), game+0x138FE63): idle, leftRightTurn, fingerIdle1-3, shiftUp, shiftDown, shiftWheelUp, shiftWheelDown, rightHandBrakeON, rightHandBrakeOFF, 321DriverCin, postRaceDriverCin. Each has 130 tracks (the default body's bones), 1/60 s steps and degree-2 curves; idle is entirely constant on 297 of 336 cars.
ClipTypical length
idle1-14 s
leftRightTurn4.167 s
fingerIdle1-32.2-4.4 s
shiftUp, shiftDown1.0-1.27 s
shiftWheelUp, shiftWheelDown, handbrakeabout 1 s
321DriverCin10.733 s
postRaceDriverCin16.0 s

What places the driver

  • The Hips track (relative to GrannyRootBone, which sits at the car origin) carries the car's seat: for example (-0.329, 0.317, -0.234) in a left-hand-drive Audi, (+0.371, 0.274, -0.210) in a right-hand-drive RX-7. Right-hand-drive drivers are placed by this track, not mirrored in code.
  • Over all 336 cars, Hips sits at about (0, -0.53, +0.15) m from the driver-side carLocator_seatCam (spread 2-8 cm); the head is 5-6 cm below it.
  • The clips' wheel hub (root_boneSteeringWheel at (0, 1.868, 0.33) plus boneSteeringWheel) is within 5 cm of carLocator_steeringWheel on 278 of 336 cars and within 10 cm on 320. A few stock cars carry another car's clips and are metres off.
  • Every car skeleton has a bone named driver, identical in all cars: it isn't the per-car placement.
  • Nothing else moves the driver (proved). The locator code only reduces Handbrake, stickShift, columnShift, paddleShiftUp and carLocator_steeringWheel to switches (paddle mode, no-shift mode, left-hand shift, handbrake side). CameraOverrides.CockpitWheelPositionOffsetX/Y/Z and CockpitWheelRotationOffset do nothing on PC: the presentation method that receives them (game+0x13ADE90, 0x1413ADE90) keeps only the steering angle.

Hands and steering

  • Idle hands hold the rim at 9:15: grip points (mid wrist to middle knuckle) about 0.17-0.20 m from the wheel axis, 1-1.5 cm outside the rim's outer radius, wrists 5-7 cm behind the rim plane. Over 336 cars the left grip is (-0.186, 0.003, -0.048) from the wheel locator and the right (+0.178, -0.003, -0.048), spread 2-3 cm.
  • leftRightTurn is a pose table: boneSteeringWheelSpindle turns linearly from 90° left at t = 0 through 0 at 2.083 s to 90° right at 4.167 s (43.2°/s), and the hands follow 1:1. The game presumably samples it by the steering input (unconfirmed: not traced).
  • Driver shifting follows Data_Drivetrain.ShiftSystemID of the car's stock drivetrain: 1 H-pattern stick (241 cars), 2 paddles (62 cars, all with paddle locators), 3-4 automatic with paddles, 5 automatic, 6 sequential stick.
  • Paddle shifting needs paddleShiftUp (right paddle) and paddleShiftDown (left) locators, with the stock GUIDs 9b600968-dcc8-4288-9aa6-7c7c2d5a3b0b and e46baad6-ad1d-441e-9846-cbed53df91ad; they mark where the hand goes.

Moving a driver

  • Add the same offset to the Hips and root_boneSteeringWheel position curves of all 13 clips: exact, and the whole body, hands and rig wheel move together (checked by forward kinematics to 1e-8 m). The edited clips can be written uncompressed.
  • Move them by the difference between the new car's steering hub and the clips' hub: the hands then hold the new car's wheel where it is, and the body sits as the clips' posture puts it from that wheel. A wheel that sits much nearer or further from the seat than in the source car would need the arms re-posed (IK) to keep both the seat and the grip right.
  • Don't use the seat camera locator as the reference across different sources: cars with the same body can have their seat cameras placed differently, with camera offsets making up for it.

14.14 Cameras and locators

The car's cameras are a database row of offsets from locators in the car's Locators.xml, so the row and the locators have to come from the same source.

  • CameraOverrides (by CarId, loaded at game+0x1036110, 0x141036110, and game+0x1036607, 0x141036607): bonnet, bumper, chase and cockpit camera offsets, for example CamHoodHeightOffset, CamHoodZOffset, CamHoodPitchOffset, CamCockpitOffsetX/Y/Z. Without a row a car gets default cameras.
  • The bonnet camera is offset from carLocator_hood; the cockpit camera from the driver-side carLocator_seatCamLF/RF (unconfirmed: read from the data across many cars, where a car's bonnet locator moves, its offsets move the opposite way). game+0xF7A2E0 picks the seat camera nearer carLocator_steeringWheel.
  • Locators.xml is read from the car zip (game+0x119DBA0); no other car file holds a copy of its values. Each <Locator> has a GUID, SrcGUID, Name, a SceneTransform 4 x 4 (position in value._41, _42, _43), AttachToBone and UpgradeInfo. Keep the file's CRLF line ends.
  • Locators stock cars carry include: Audio_Engine, Audio_Exhaust, carLocator_Engine, carLocator_Exhaust_001/_002 (where backfire flames come out), carLocator_bumperF/R, carLocator_dashboard, carLocator_gauges, carLocator_hood, carLocator_trunk, carLocator_doorLF/RF, door handles, carLocator_headlightL/R, carLocator_taillightL/R, carLocator_seatCamLF/RF, carLocator_steeringWheel, carLocator_lookLeft/Right, carLocator_lookClose*, carLocator_wheel*, stickShift, Handbrake, and on paddle-shift cars paddleShiftUp/Down.
  • Forzavista pins and views are placed in these locators' frames (Forzavista pins).

14.15 Engine sound

A car whose engine sound name isn't one of the game's stock names is silent. The name is Data_Engine.MediaName (or Data_Motor.MediaName), and events resolve only through the stock strings bank. Give a new car a stock name, shared with a car of a similar engine: FH2 itself shares 25 engine names between cars. Giving a car another stock car's sound is one UPDATE Data_Engine SET MediaName = ... through add_sql. The hook sites a sound mod uses are in 9.4.

  • The bank: game+0x292840 (0x140292840) runs SELECT MediaName FROM Data_Engine ... UNION ... Data_Motor for the car and loads media\audio\fmodanthem\durango\PG_<name>.bank only if the file exists (351 banks). They are FMOD Studio 1.x banks (FMT 0x2E) with FSB5 MPEG samples.
  • The events: /Master/PG_Cars/PG_<name>/PG_<name>_<group> (path built at game+0x10103A0, 0x1410103A0), looked up by FMOD Studio's System::lookupID (game+0x1A99830, 0x141A99830), which resolves paths only from MasterBank.strings.bank (366 stock PG_ names; the per-car banks carry no path strings). A failed lookup leaves the group without an event; the /Master/Boing fallback is off.
  • What a bank holds: fixed-rpm loops named for their rpm (Engine_05357, Exhaust_..., Intake_...), backfire and pops, burbles, turbo whine, supercharger whistle, blow-off, shifter and clutch, damage and transmission whine.
  • Three groups per car, AudioObjectEngineGroup{Engine,Exhaust,Intake}Fmod (vtables, by their RTTI names: Engine game+0x2E75328 / 0x142E75328, Exhaust game+0x2E753D0 / 0x142E753D0, Intake game+0x2E75280 / 0x142E75280), each playing one event and copying the car's values into its parameters every update (game+0x1016A50, 0x141016A50). Group fields: +0x30 channel (0 Intake, 1 Engine, 2 Exhaust), +0x34 part level (0-3), +0x50 EngineRPM, +0x54 Throttle, +0x58 ThrottleDelta, +0x5C/+0x60 PosTorque/NegTorque, +0x64 Boost (0-1), +0x68 Doppler, +0x6C ClutchPosition, +0x70/+0x74 View/Focus, +0x78 MaxAudibleOverride, +0x84 gear, +0x88 gear ratio, +0xC8 the EventInstance handle.
  • More group fields: Intake +0x3C supercharger level (-1 = none fitted) and +0x40 its kind (values not settled); Intake +0x80 TurboRPM (0-1, seen up to 0.97); Engine +0x8C TransmissionRPM (the gearbox's output shaft, engine rpm / gear ratio; up to 9,940 seen). The gear ratio at +0x88 is negative in reverse. Upgrade levels are the fitted part's database Level, 0-3.
  • Each group's channel group is the event's own master bus with 8 DSPs (Pan, Pan, Fader, Send, Pan, Send, Send, Lowpass Simple, output end first); the sends go to returns 20, 19 (/ANTHEM/19_REVERB_TUNNEL, rising to 1 in tunnels and under bridges) and 18.
  • The car's audio object (game+0x100ADA0, 0x14100ADA0) builds PG_ + the sound name. The path builder gets the same car object (in rdi) for a car's three groups. A group holds no pointer to its car and no media name.
  • The settings file: media\audio\cars\<sound name>.xml (PhysicsModulation: CamshaftRPMScalar, a turbo clamp) is read at game+0x101B1C0 (0x14101B1C0) as Game:\Media\Audio\Cars\<name without PG_>.xml; 147 of 355 stock names have none (208 files exist). No stock sound name is the stock engine of two cars.
  • The exe exports FMOD's low-level API by name (createDSP, addDSP, getNumDSPs, setWetDryMix, ...); FMOD Studio isn't exported. System::getMasterChannelGroup is at game+0x1998C90 (0x141998C90). A sound mod can therefore swap a car's event name at run time to play its own sound. Channel groups are freed on the upgrade screen: never keep polling them.
  • A dormant synth: the exe also contains a "PG Engine Synth" FMOD DSP (FMOD_PGEngineSynth_GetDSPDescription, exported at game+0x102D000, 0x14102D000) that no bank uses. Its loaders crash on a missing file, need CRLF in its .eng file, raw float32 audio at 16-bit scale, and loops holding a whole number of engine cycles.
  • One bank per path. The bank manager (game+0x10121E0, 0x1410121E0) lower-cases the bank's path and keeps one Bank object per path. So a bank is found whatever the letter case of its sound name (two stock names differ from their files only in case: KTM_XBow_13 / PG_KTM_Xbow_13.bank, Lot_EvoraS_11 / PG_LOT_EvoraS_11.bank), and cars with the same sound name share one loaded bank.
  • The same bank under a second file name is a second Bank, and its load fails without a word. Its car's engine events never load. Seen with two mod cars on copies of one stock bank: whichever was driven second in a session had no engine events and no log line. The mechanism is read from the code; the failed load itself wasn't observed.
  • What the values look like in play: the rev limiter's fuel cut is Throttle exactly 0.5 with PosTorque 0 and NegTorque -1, about five times a second. An upshift is Throttle 0 with ClutchPosition 1 for about 0.1 s. Boost follows the throttle (correlation 0.98). The game's EngineRPM itself wanders about 24 cents at about 2.4 Hz under load; stock events hide that with parameter seek speed, and a sound made straight from the value warbles.

14.16 Pitfalls

Every row below was hit in practice. The first group stops the game or the car outright, so a checker should refuse a build that breaks any of them.

SymptomCauseFix
Crash loading a save (a NULL read at game+0x105BEEC, 0x14105BEEC, in the function reading ClutchMaxTorque; then at game+0x1064614, 0x141064614, the transmission reader, once that is fixed)the save has an upgrade fitted whose row is gone (a rebuild dropped drivetrain swap rows)never remove or renumber upgrade rows a save may use; have the player fit stock parts or remove the car first
Crash in the asset threada model without a Modl or Skel blob, or with morph counts and no Mrphalways write all three
CrashModl's buffer count lower than the buffers presentwrite the counts from the blobs
Crash in the Autoshow or garagePowertrainID outside 0-7a valid powertrain (platform 2.9.0 guards it)
Loads for evera modelbin or .materialbin missing or unreadablecheck every path the carbin and MatIs name
Loads for everMatI Ids not exactly 0 to n-1, or Modl's MatI count wrongrenumber MatIs and meshes together
Loads for everno stock aspiration part among enums 21 and 24-28a naturally aspirated engine needs a stock manifold row
Loads for everan engine marked turbo or supercharged without that stock row and a stock intercooler row, or with manifold rows toomatch the forced-induction rows to what the engine says
Loads for ever (seen once)a missing AO map inside the shared libraryname only AO maps that exist
Garbage physicsa missing database row reads as INT_MAX / FLT_MAXcheck every row the build needs (14.3)
The car's whole SQL is missinganother mod wrote the same car, engine or drivetrain Ids, so the later mod rolled backtake Ids from your own range
Bumper, wing or other upgrade part not drawncarbin part or body Ids don't match database rowspart Ids = car Id x 1000 + n, set once the Id is known
Strings and offsets brokena renamed media name of another lengthkeep the length of the car the files came from
Paint stays greythe car paint MatI isn't at the place the carbin marks paintedone car paint MatI per model, at that place
Green "CH" lettersa template material (defaultch* textures) used without overridesnever use template materials as they are
Window panes invisibleglass without TEXCOORD4 and TANGENT4add them: a flat projection of the pane
Vents, clear lenses, trim glow on brakinga lamp-capable material without a light code (default 0 = brake)set code 70 on anything that isn't a lamp
Grilles fade to nothingalpha-to-coverage on a pattern finer than stock cars usecoarser tiling, a filled grille, or an opacity map made more solid in its small mips
Sky through the roofa solid material given a see-through stand-inkeep opaque materials opaque
Underside picture smearedthe shared underbody material (specificuse/undercarriage) reads TEXCOORD0 as a flat projection from abovegive those meshes that projection
Scraps of another part's shadinga model reads one AO map, but parts merged into it were laid out for anotherpoint such parts at a white place in the map
Dark patchesa model reading an AO map's empty 0x05 areasuse a white place, or the part's own map
Part stuck or misplaceda vertex shared by meshes that need it in different placesgive each mesh its own copy
Garbage texturea texture header that doesn't match its data (no size check)write by the header's format, size, mips and tiling
Dash text with bright, hollow edgesdash textures in straight alphapremultiply
Boxes for letters on the dashthe dash fonts have digits and P R N D onlydraw words into a texture
Blank name in the top barDisplayName as plain texta string-table key
Make and model printed over the thumbnailthe Autoshow writes them on the _Big image's top leftkeep that corner empty
Silent enginea sound name that isn't stocka stock sound name
Hands grip the airthe driver clips' wheel isn't where the car's wheel ismove the driver (or the wheel) so the hub matches
Doors, pop-ups, needles swing about the wrong pointparts modelled for other pivots than the skeleton'smove the pivots (14.12)
Glows float off the lampsLights.bin from another carthe car's own lights, on its own lamp models
Collides as another shapephysicsdefinition.bin from another carthe car's own hull
Camera low or inside the dashCameraOverrides row and Locators.xml from different carstake both from the same car
Ground shadow the wrong sizeground_AO.swatchbin from another carthe car's own, border white
Exhaust flames in mid-aircarLocator_Exhaust_001/_002 from another carthe car's own tailpipe positions
Wing, air brake, bonnet or boot never movesthe car's .gsf has no slot for that clipuse the state machine of a stock car that has the slots (14.12)
With a sound mod, the second car driven in a session is silentone bank under two file names: the second load fails without a wordone file name per bank, shared by its cars (fix not yet tested in game)
Blue or red rims and trima library paint material showing its own colour: the MatI sets noneset the colour parameters in the MatI (Glass, grilles, gauges)
Road visible through the dialsthe dial picture's alpha is its opacitymake the day picture opaque
White, glowing dialsgauge glass on a material whose emissive is ona plain clear glass
Every body panel its own grey, steps at the seamsAO maps without the sky-and-ground shading stock maps holdshade the whole car's shape at once (Textures)
Revs hang, or fall too fastengine inertia, flywheel inertia and engine braking from different enginestake all three from the same engine
Pop-up beams point at the skylight rotations are in the bone's frame, and the bone's rest orientation changedturn the lights by the difference
Bonnet missing, or parts drawn over the road, in the bonnet and dash camerasdraw groups from another carset each model's draw group
Blank or green badge platesan emblem MatI that doesn't name its own picturesset every map and the colour

14.17 Open questions

These are unconfirmed; treat them as risks until someone traces them.

  • Where the no-aspiration-part hang waits (engine audio is the suspect: it reads the aspiration part levels).
  • Why a missing AO map in the shared library hung a car, when the code accepts a failed texture.
  • What a .materialbin that is missing does compared with one that fails to parse (both never ready, unconfirmed).
  • The MSAA sample count, that is how coarse alpha-to-coverage is.
  • The 0x51DC gate on the locator switches.
  • Lights: what the per-car flag choosing sub 1 or 2 is; whether pos0 to pos1 is damage; whether the game drives the controllers no stock car uses (12, 25, 47, 49-52).
  • Which skeleton the light bone palette indexes (the gr2 or the modelbin; keep both in the same order).
  • Which pivot the game takes while a part clip plays: the clip key plus the gr2 parent, the gr2 rest or the modelbin bone. Keep all three the same.
  • How leftRightTurn is sampled from the steering input.
  • How the game draws dash elements no stock page uses (ed:Arc, gradients, boolean and thickness animations): named in the exe, never seen in game.
  • Whether more than 28 factory colours, or an MNCL version above 1.0, are accepted.
  • Whether the locator lookup is case-sensitive (carLocator_engine and carLocator_Engine both occur).
  • What the game does with a save whose car has gone.
  • How the game decides a car is DLC or unowned, and how car choice is restricted per mode (events, rivals, online): not traced. ContentId 0 means no content licence check, and such cars show and can be bought in the Autoshow.
  • What the game does when a .gsf names a bone (a text track) the skeleton lacks.
  • How the .gsf's per-slot AnimCRC is computed. It isn't enforced, and it doesn't cover curve data.
  • Whether modules from two cars' state machines can be joined in one .gsf. No single stock car has analogue gauges with an active wing, or every roof.
  • Float-key curves longer than 851 knots.
  • Whether one bank shared under a single file name cures the second car's silence: written, not yet tested in game.
  • What the Intake group's +0x40 means, and which supercharger sound plays when a car has both kinds.
  • The three paint sections of C_livery, and the layer limit per side (1,263 work).
  • How the engine code uses MomentInertia and ZeroThrottleTorqueScale: the fall-rate rule is from the data.

“The FH2 Modding Guide” by Trinculo54 is licensed under CC BY 4.0; its code samples are under the MIT licence. This page is an unchanged copy (links point to this site) of 14-cars.md at commit bb10508; corrections belong in the original repository.