NFSAddons Forums

Main Menu

fcecodec (FCE decoder/encoder - Python module)

Started by bfut, Oct 29, 2021, 8:30 AM

pete9516

Quote from: bfut on Sep 27, 2022,  9:17 AM
The latest update on Github fixes a potential crash in the DeletePart() function.

2) Rename and merge parts for easy conversion between NFS3, NFS4 and MCO.
This is very interesting to me!! Merging parts is very useful for specific stuff. So FCEcodec can delete parts of a car.fce? I wouldn't imagine this, gonna try it out at a time

Paul Spain

Is this a way to finally break the 16 lights limit and possibly even have lights in colors not before available..Like say Green?
NFS HighStakes is the best

bfut

#17
Quote from: Paul Spain on Sep 29, 2022,  7:11 AM
Is this a way to finally break the 16 lights limit and possibly even have lights in colors not before available..Like say Green?
New colors would have to be implemented in the games themselves. To the best of my knowledge, green is not available, not even MCO.

The max. 16 dummy and max. 64 parts limits are hard-coded in the FCE file format itself. The dummy limit was circumvented by developers in MCO in that they simply added dozens of dummy parts instead, as placeholders for engine parts, wheels, driver, etc. That does not help for NFS3 and NFS4, however, and changed nothing for light and fx dummies.
We could easily define and implement a new FCE format version, if either of the games were open-sourced with appropriate licenses. Things like this are being done for old Quakes and Dooms, that have been FOSS'ed for decades.

Fcecodec is a modding tool that decodes and encodes the 3 FCE file format versions as they are implemented in NFS3, NFS4 and MCO. In my documentation, I refer to them as FCE3, FCE4 and FCEM, respectively.

Quote from: pete9516 on Sep 28, 2022,  9:07 AM
This is very interesting to me!! Merging parts is very useful for specific stuff. So FCEcodec can delete parts of a car.fce? I wouldn't imagine this, gonna try it out at a time

Yes, basic tasks such as this are all available and allow easy automatization when chained. Documented here: https://github.com/bfut/fcecodec/tree/main/python
My scripts can be used just like command-line tools. Find scripts in this folder: https://github.com/bfut/fcecodec/tree/main/scripts

The decoder and encoder are fully transparent, i.e., vertex positions, normals, etc. do not change unless specifically edited.

bfut

Updated fcecodec v1.3 is now available from https://github.com/bfut/fcecodec

Changes:
+ Scripts: several new scripts, see below
# stability and usability improvements
# License changed to GPLv2

New Scripts:
+ bfut_ConvertDummiesToFce3.py - convert dummy names from NFS:HS and MCO to NFS3
+ bfut_CopyCarColors.py - copy car colors from source to target, overwriting target
+ bfut_MergeParts (Fce4 to Fce3, keep version).py - NFS:HS to NFS3 conversion convenience tool
+ bfut_MergeParts (FceM to Fce4, keep version).py - MCO to NFS:HS conversion convenience tool
+ bfut_SortPartsToFce3Order (keep fce version).py - NFS:HS to NFS3 conversion convenience tool

bfut

#19
Updated fcecodec v1.4 is now available from https://github.com/bfut/fcecodec

Changes:
+ faster execution
+ Scripts: several new scripts, see below
# stability and usability improvements

New Scripts:
+ bfut_SaveFceAsFce3.py - convert FCE version only
+ bfut_SaveFceAsFce4.py - convert FCE version only
+ bfut_SaveFceAsFce4M.py - convert FCE version only
+ bfut_SetHighChromeToTransparent.py - add semi-transparency flag to all high chrome polygons
+ bfut_SetNormals (project verts to unit sphere).py - quick fix for broken normals; this is closest to NFS3 vanilla normals but mostly a code example


bfut

#21
https://github.com/bfut/fcecodec/blob/main/notebooks/bfut_FceConverter.ipynb

Preview version of the FceConverter. Detailed documentation in there.

Conversion from MCO to NFS:HS, MCO to NFS3 and NFS:HS to NFS3 is finished.

It's also a tutorial all the same. Enjoy.


Description
This notebook is a step-by-step converter for FCE files between FCE3, FCE4, and FCE4M formats.
Handles renaming parts, merging parts, reordering parts, renaming dummies, scaling model size, etc., where applicable.
Also converts texture alpha channel. For FCE3 and FCE4, the source is a TGA file. For FCE4M, the source is an FSH file.

Purpose
This notebook can produce a game-ready and finished VIV archive in seconds, avoiding manual chores.
Preview and prepare your work for multiple games at the same time.

pete9516

Quote from: bfut on Apr 15, 2023,  1:14 PM
https://github.com/bfut/notebooks/blob/main/fcecodec/bfut_FceConverter.ipynb

Preview version of the FceConverter. Detailed documentation in there.

Conversion from MCO to NFS:HS, MCO to NFS3 and NFS:HS to NFS3 is finished.

It's also a tutorial all the same. Enjoy.


Description
This notebook is a step-by-step converter for FCE files between FCE3, FCE4, and FCE4M formats.
Handles renaming parts, merging parts, reordering parts, renaming dummies, scaling model size, etc., where applicable.
Also converts texture alpha channel. For FCE3 and FCE4, the source is a TGA file. For FCE4M, the source is an FSH file.

Purpose
This notebook can produce a game-ready and finished VIV archive in seconds, avoiding manual chores.
Preview and prepare your work for multiple games at the same time.

This is awesome!!

bfut

#23
Updated fcecodec v1.4 is now available from https://github.com/bfut/fcecodec

Changes:
+ Scripts: several new scripts, see below

New Scripts:
+ bfut_ConvertDummies (Fce3 to Fce4)
+ bfut_ConvertPartnames (Fce3 to Fce4)
+ bfut_ConvertPartnames (Fce4 to Fce4M)
+ bfut_MimicPartnamesAndPartsorder - sort parts in target.fce according to parts in input.fce, adding and deleting where necessary (use with HS and MCO files with canonical partnames)

---

NFS FCE Converter: https://github.com/bfut/fcecodec/blob/main/notebooks/bfut_FceConverter.ipynb

New preview version:
+ all conversion modes are finished: takes 3, HS and MCO files as input and converts to any desired output 3, HS or MCO
# more detailed installation instructions


bfut

Updated fcecodec v1.4 is now available from https://github.com/bfut/fcecodec

Changes:
+ Scripts: new script, see below

New Scripts:
+ bfut_RescaleModel.py - quickly make your model bigger or smaller by a given factor

---

bfut_FceConverter: https://github.com/bfut/fcecodec/blob/main/notebooks/bfut_FceConverter.ipynb

New preview version:
+ heavily updated documentation (especially installation)
+ minor performance improvement

This notebook is not too far off the final version. If there are wishes, now would be a good time to bring 'em up.  :)

noise

Don't know if you have any influence on the behavior of fcecenter/converter but after you used these tools for your car.fce and then go to fcefinish, you often see the normals are messed up.

bfut

#27
Quote from: noise on Apr 29, 2023,  1:21 AM
Don't know if you have any influence on the behavior of fcecenter/converter but after you used these tools for your car.fce and then go to fcefinish, you often see the normals are messed up.
That's an FCEFinish issue.

fcecodec is fully transparent and does not change the normals, unless desired by the user.

A quick way to edit FCEs:
1) for FCE export to OBJ use bfut_Fce2Obj.py, then open as OBJ in Blender, 3dsmax, etc.
2) to reimport OBJ to FCE, use one of the bfut_Obj2Fce*.py scripts

Thank you for the feedback!  :)

noise


bfut

Please don't ask about other people's software in this dedicated thread, as I cannot give you support on that. Thanks anyway. ;)