Need for Speed: Hot Pursuit 2/Car Modding: Difference between revisions

From NFS Modding Wiki
Jump to navigation Jump to search
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 3: Line 3:


== Car conversion tutorial ==
== Car conversion tutorial ==
Adapted from the NFS HP2 Car Editing guide by UCN Conversions and Kolya Sych.
Adapted and improved from the NFS HP2 Car Editing guide by UCN Conversions and Kolya Sych.


=== 1) Files ===
=== 1) Files ===
Line 10: Line 10:
The model data for each car is stored in <code>car.viv</code>, which can be extracted by VIVEdit, VIVMagic, or BigGUI.
The model data for each car is stored in <code>car.viv</code>, which can be extracted by VIVEdit, VIVMagic, or BigGUI.


The <code>skin.viv</code> 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 [https://youtu.be/1RyztoXp3SY?si=ioMyaiHr0wRn_I79 video example] shows the issue happening on a car with 21 skins.
The <code>skin.viv</code> file contains all the skins for the car as fsh images.  15 main skins can be stored (skin00 to skin14), plus skincop (police version skin) and skinhp (NFS edition skin).
 
* An issue occurs with more than 15 main skins, where skin15 and skin16 become selectable but use skincop and skinhp (or skin00 and skin01 if skincop or skinhp does not exist).
** This [https://youtu.be/1RyztoXp3SY?si=ioMyaiHr0wRn_I79 video example] shows the issue happening on a car with 21 skins.
** To prevent this issue, don't name any skin skin15 or skin16.
* Anything beyond this is not loaded.


There are also several configuration ini files for various parameters.
There are also several configuration ini files for various parameters.
Line 26: Line 31:
** <code>skeleton.o</code> - contains position data for lights, wheels/rotors, brake calipers, and driver
** <code>skeleton.o</code> - contains position data for lights, wheels/rotors, brake calipers, and driver
* <code>skin.viv</code>
* <code>skin.viv</code>
** <code>skin__.fsh</code> - skin00.fsh through skin15.fsh
** <code>skin__.fsh</code> (skin00.fsh through skin14.fsh) skin textures for main version of the car
** <code>skincop.fsh</code>
** <code>skincop.fsh</code> - skin textures for cop version of car
** <code>skinhp.fsh</code>
** <code>skinhp.fsh</code> - skin textures for "NFS Edition" version of car
* <code>animbank.o</code> - contains data on how the damage model is calculated (use an animbank.o file from a traffic car to prevent damage)
* <code>animbank.o</code> - contains data on how the damage model is calculated (use an animbank.o file from a traffic car to prevent damage)
* <code>bounds.ini</code> - car position data for collision detection (apparently)
* <code>bounds.ini</code> - car position data for collision detection (apparently)
Line 42: Line 47:
=== 2) Things to know ===
=== 2) Things to know ===


* By default, the files in the <code>Cars</code> folder are read-only.  Make sure to make them not read-only before editing the files, otherwise the changes wont be saved.
* By default, the files in the <code>Cars</code> folder are read-only.  Make sure to make them not read-only before editing the files, otherwise the changes won't 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.
* 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, see [[#11) Add-on parts for specific skins|Step 11: Add-on parts]], below).
** It is best to convert it to a .oif file (see [[#3) Converting|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.
* 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.
* 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.
Line 55: Line 63:


=== 4) Transparency (Windows/lights glass) ===
=== 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.
To make the part transparent in-game, two things are required:


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.
# Replace an original part which is transparent.  Otherwise, the part will appear opaque in the game.
 
# Update the vertex color of the transparent parts (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.
(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) ===
=== 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).
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 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.
* 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 ===
=== 6) Damage ===
Line 83: Line 90:


=== 8) Shadows ===
=== 8) Shadows ===
There is a file called <code>shadow.o</code> within <code>car.viv</code> 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.
There is a file called <code>shadow.o</code> within <code>car.viv</code> which contains the shadow model. The model is essentially a very low polygon version of the original model. OIFTool can't 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 ===
=== 9) Textures ===
Line 100: Line 107:
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.
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 <u>use a base .o file from a vehicle with a police variant</u>.  In that vehicle's <code>geomdata.ini</code>, the part will have "ADDON" somewhere in the name; and when loaded using NFS model viewer with the <code>geomdata.ini</code>, the part will show up as "police add-on".
To do this, you must <u>use a base .o file from a vehicle with a police variant</u>.  In that vehicle's <code>geomdata.ini</code>, the part will have "ADDON" somewhere in the name; and when loaded using NFS Model Viewer with the <code>geomdata.ini</code>, 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.
When converting the model in OIFTool, make sure to replace the base model's "police addon" part with the intended addon model.
Line 118: Line 125:


== Adding new cars without replacing (somewhat possible) ==
== 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 <code>/request car</code> 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).
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 loaded in quick race mode, and also be used in a multiplayer server match using the <code>/request car</code> 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).
 
To add new cars:
 
# Create a new folder in the <code>Cars</code> directory with a specific name that relates to the car (example: <code>venomgt</code> for the Hennessey Venom GT)
# Copy the files for the mod car into that directory (so it should look like any other car directory)
# Edit <code>Cars/cars.ini</code>and add a new entry for the addon car below the other race cars but above the traffic cars. The last vanilla race car is [car23], so for the addon car make it [car24].  Be sure to change the following car numbers for traffic cars to avoid duplicates.
#* set 'name' to the name of the car file you created (in this case, venomgt).
#* set 'class' to whichever class suits the car (1 is the fastest class, 5 is the slowest)
#* set 'display name' to the car's name without spaces (don't include 'kTxt') - example: <code>displayname=VenomGT</code>
# **(Unclear if this step is necessary) Edit <code>FrontEnd/gui/lists.ini</code>.  Under [<CAR>], add an entry with the name of the car file you created.
#* The left side is the same value as <code>displayname</code> in cars.ini
#* The right side is the text value for the car's full name, just set it to the same value as the left
#* example: <code>VenomGT=VenomGT</code>
 
{{DEFAULTSORT:2002}}
[[Category:Mod creation guides]]

Latest revision as of 11:02, 31 October 2024

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 and improved 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. 15 main skins can be stored (skin00 to skin14), plus skincop (police version skin) and skinhp (NFS edition skin).

  • An issue occurs with more than 15 main skins, where skin15 and skin16 become selectable but use skincop and skinhp (or skin00 and skin01 if skincop or skinhp does not exist).
    • This video example shows the issue happening on a car with 21 skins.
    • To prevent this issue, don't name any skin skin15 or skin16.
  • Anything beyond this is not loaded.

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 skin14.fsh) skin textures for main version of the car
    • skincop.fsh - skin textures for cop version of car
    • skinhp.fsh - skin textures for "NFS Edition" version of car
  • 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 won't 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, 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 in-game, two things are required:

  1. Replace an original part which is transparent. Otherwise, the part will appear opaque in the game.
  2. Update the vertex color of the transparent parts (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 can't 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 loaded 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).

To add new cars:

  1. Create a new folder in the Cars directory with a specific name that relates to the car (example: venomgt for the Hennessey Venom GT)
  2. Copy the files for the mod car into that directory (so it should look like any other car directory)
  3. Edit Cars/cars.iniand add a new entry for the addon car below the other race cars but above the traffic cars. The last vanilla race car is [car23], so for the addon car make it [car24]. Be sure to change the following car numbers for traffic cars to avoid duplicates.
    • set 'name' to the name of the car file you created (in this case, venomgt).
    • set 'class' to whichever class suits the car (1 is the fastest class, 5 is the slowest)
    • set 'display name' to the car's name without spaces (don't include 'kTxt') - example: displayname=VenomGT
  4. **(Unclear if this step is necessary) Edit FrontEnd/gui/lists.ini. Under [<CAR>], add an entry with the name of the car file you created.
    • The left side is the same value as displayname in cars.ini
    • The right side is the text value for the car's full name, just set it to the same value as the left
    • example: VenomGT=VenomGT