Need for Speed: Hot Pursuit 2/Car Modding

From NFS Modding Wiki
Jump to navigation Jump to search

Tools

Car model files
Name Description Download link Required? Recommended?
ZModeler v1.07b 3D modeling software that can import/export HP2 models with plugins Yes Yes
- OIF Plugin for Zmodeler Import/export models between ZModeler 1 (.z3d) and OIFTool (.oif) Yes Yes
- O Skeleton plugin for Zmodeler Import/export skeleton.o files for positions of wheels, lights, etc. Yes Yes
ZModeler 2 3D modeling software, can import/export models between ZModeler 1 (.z3d) and .obj format No Yes
OEdit Old tool for directly editing .o model files. Doesn't work well (if at all) on modern systems. Not recommended. No No
NFS Model Viewer Can view (but not edit) HP2 models. Useful for verifying models are exported correctly, etc. No Yes
Textures
Name Description Download link Required? Recommended?
fshEd Graphical tool for packing and un-packing .fsh texture files Either FSHTool, fshEd, or EAGE Yes
FSHTool Command-line tool for packing and un-packing .fsh texture files Yes
EA Graphics Editor Old graphical tool for editing .fsh texture files No
File packing/unpacking
Name Description Download link Required? Recommended?
VIVEdit Either VIVEdit, VIVMagic, or BigGUI
VIVMagic
BigGUI
Misc tools
Name Description Download link Required? Recommended?
INICarEditor
CarConfigurator
A Sac v2091 Hot Pursuit 2 Stats recorder

Car conversion tutorial

Adapted from the NFS HP2 Car Editing guide by UCN Conversions and Kolya Sych.

1) Files

The files for each car are found in the "Cars" directory in your HP2 installation directory. All the car directories that start with the letter "t" are traffic cars (except ts50), and the rest are normal drivable cars.

The model data for each car is stored in car.viv, which can be extracted by VIVEdit, VIVMagic, or BigGUI.

The skin.viv file contains all the skins for the car as fsh images. 16 main skins can be stored (skin00 to skin15), plus skincop (police version skin) and skinhp (NFS edition skin). An issue occurs with more than 16 main skins, where skin16 and skin17 become selectable as skincop and skinhp. This video example shows the issue happening on a car with 21 skins.

There are also several configuration ini files for various parameters.

Diagram of files and structure

  • car.viv
    • car.fsh - contains textures for the wheels/brakes
    • car.o - main .o model file, used in main menu showcase and in-game on regular tracks
    • carM.o - used when driving on a mirrored track, model itself must be mirrored to look normal
    • carRigid.o - appears to be the same as car.o (?)
    • carRigidM.o - appears to be the same as carM.o (?)
    • damage.fsh - contains textures for damage
    • shadow.o - the shadow model (a lowpoly model)
    • skeleton.o - contains position data for lights, wheels/rotors, brake calipers, and driver
  • skin.viv
    • skin__.fsh - skin00.fsh through skin15.fsh
    • skincop.fsh
    • skinhp.fsh
  • animbank.o - contains data on how the damage model is calculated (use an animbank.o file from a traffic car to prevent damage)
  • bounds.ini - car position data for collision detection (apparently)
  • car.ini - performance data/stats
  • car_cop.ini - performance data/stats (for the cop version of the car)
  • car_hp.in - performance data/stats (for the nfs version of the car)
  • carracer.ini - performance data/stats (for the AI version of the car)
  • damage.ini - apparently unused
  • geomdata.ini - geometry data including damage and LOD data, corresponds to part names
  • lod.ini - apparently unused
  • vehicle.ini - configuration for skins and lights, also some damage and other misc effects

2) Things to know

  • By default, the files in the Cars folder are read-only. Make sure to make them not read-only before editing the files, otherwise the changes wont be saved.
  • Before starting a project, it is required to pick a base .o file to work with from the vanilla game. Choose one that suits the car you are converting. If the car will include add-on parts, make sure to use a base .o file from a car with a police variant (for more info on add-on parts, see step 11: Add-on parts, below). It is best to convert it to a .oif file (see step 3: Converting, below) and import it into your modeling program. Then after modeling the car, detach the faces and replace each one of the parts imported from the .oif file. This will make converting to a .o file much easier. Keep the names the same as the original imported parts from the .oif file. It is not required to replace all of the original parts; some can be left empty.
  • CarM.o must be mirrored horizontally (on the X-axis), except for the wheels and brakes. Then, make copies of Car.o and CarM.o and save them as CarRigid.o and CarRigidM.o respectively.
  • The front of the car should face the +Y direction, and the car should be positioned about in the middle of the XY-plane. Import a vanilla model to aid positioning.

3) Converting

Files need to be converted from .o to .oif before they can be opened by ZModeler. Use OIFTool to do this conversion. ZModeler will not directly open .o files with the currently available plugin.

After editing, export the file as a .oif file, and then import the data into a .o file by using OIFTool. When importing back into a .o file, choose which parts should be replaced and by which part from the .oif file. For any parts in the .o file to delete, make it an "Empty" part.

It is recommended not to use models exported from OIFTool for importing or as a base. It might be a bug in OIFTool's code or just the way OIFTool imports data into .o files.

4) Transparency (Windows/lights glass)

To make the part transparent ingame, replace an original part which is transparent. Otherwise, the part will appear opaque in the game.

The vertex color of the transparent parts also needs to be updated (ZModeler: Plugins->OIF Custom Settings). Select the vertices of the transparent part, and edit the Color property.

(AARRGGBB). AA = Alpha, RR = Red, GG = Green, BB = Blue, all values are in hexadecimal. For example, try using 7F000000 for the windows.

5) Positions (Wheels/brakes center, lights, driver position)

This is done by editing the skeleton.o file. This can be done with OEdit, or in Zmodeler 1.07 using the skeleton importer (recommended).

  • In OEdit: open the model file and then open the skeleton.o file by going to File -> Load Skeleton Data. Select the wheels, lights, and driver bones, and move them as required.
  • In Zmodeler: go to tools/NFSHP2 skeleton/load skeleton. Find and select the skeleton.o to edit. Move as needed. Once finished, hide all parts except for all skeleton parts. Select all using mouse, and go to tools/NFSHP2 Skeleton/save skeleton and select the same skeleton.o file that was being edited.

6) Damage

Damage appears to be calculated using data embedded with the animbank.o file, but not much is known about it.

It is probably best not to use damage for now. To prevent damage, edit the geomdata.ini file and set damageversion=0 and damagezoneid=-1 for all the parts. Then, copy animbank.o from any of the traffic cars into the mod car's directory.

If you really want to play with it, you can by modifying the bone property of the vertices (OIF Custom Settings) to match the bone ID (a number) — which currently is not findable — but can be detected by examining original models.

7) Polycount & LOD models

It is best to minimize poly count for HP2 models, limiting to under ~10,000 polys. Cars with a higher polycount risk crashing the game upon race loading. However, Xan's widescreen patch can increase memory allocation for cars, potentially fixing this issue.

All of EA's models have low poly LOD (Level of Detail) parts. These are used if the model is far from the user's point of view and high detail is not required.

If no LOD models are included, the cars will start disappearing when they get a certain distance from the user. To fix this, the distances can be tweaked by changing the values of lodon and lodoff in geomdata.ini. The part will 'appear' when it is in between the values of lodon and lodoff.

8) Shadows

There is a file called shadow.o within car.viv which contains the shadow model. The model is essentially a very low polygon version of the original model. OIFTool cant import/export these files. If it looks fine with the original shadow model, just leave it as it is, or edit it with OEdit to get the desired effect.

9) Textures

For non-traffic cars, two textures are used: car.fsh and skin__.fsh (skin00.fsh, skin01.fsh, etc). For traffic cars, only one texture is used.

The file car.fsh is located inside car.viv and stores the textures for the wheel and brakes. Usually there are three textures inside car.fsh: wl00 (for the main skins), wlhp (for the NFS edition skins), and wlod (for LOD models).

Each of the skin__.fsh files contain one texture for the car body, including the paint color. Edit vehicle.ini to add/remove skin textures for the model.

Use FshEd or FSHTool to extract the original skins as .bmp files and then re-import new ones. Note each skin has a 24-bit .bmp file for diffuse textures and an 8-bit .bmp for the alpha layer. FshEd has the capability to import/export them separately or as a 32-bit bmp with the alpha layer included. FshEd also allows importing files of different sizes, which is useful for higher-resolution textures.

10) Performance

Edit the car.ini, car_cop.ini, car_hp.ini and carracer.ini to specify performance and statistics for the car. Everything in the file should be pretty straightforward, but INICarEditor and CarConfigurator can aid in editing performance.

11) Add-on parts for specific skins

The game has the capability of including extra parts on specific skins. This feature is used in the vanilla game to enable cop cars to have lightbars and bash bars. But for cars without police variants, this can instead be used to enable configured skins to have add-on parts such as roofs or spoilers.

To do this, you must use a base .o file from a vehicle with a police variant. In that vehicle's geomdata.ini, the part will have "ADDON" somewhere in the name; and when loaded using NFS model viewer with the geomdata.ini, the part will show up as "police add-on".

When converting the model in OIFTool, make sure to replace the base model's "police addon" part with the intended addon model.

Then, in vehicle.ini, for any skin intended to use the addon part, add the line addons_enable=1 under that specific skin configuration.

Here is an example of the entry into the vehicle.ini file for the vanilla Murcielago's cop skin to use addons:

[skincop]
specular_red=75
specular_green=75
specular_blue=75
specular_paint_exponent=30.0
specular_glass_exponent=40.0
specular_rubber_exponent=60.0
specular_sun_intensity=0
addons_enable=1

Adding new cars without replacing (somewhat possible)

It is possible to add new cars into the game without replacing others, but there are significant limitations to this, including the fact that the car is not selectable in the main menu. It can, however, be randomly selected in quick race mode, and also be used in a multiplayer server match using the /request car command. (This has not been tested in a multiplayer game with multiple clients, but will probably cause significant issues if not all players have this car). Also, the addon car will not have its own speedometer/tachometer HUD for the bumper cam (but it might be possible to add one).