Skip to content

This module will help you convert RW3D model files (.dff and .txd) to the web-compatible and easy readable .gltf/.glb format.

License

Notifications You must be signed in to change notification settings

AlterSDB/dff2gltf-converter

Repository files navigation

DFF2glTF Converter

NPM Version License CodeFactor
This module will help you convert 3D models from RenderWare format (.dff, .txd) to the modern web-compatible glTF/glB format. The tool is useful for developers working with retro GTA games (GTA III, GTA San Andreas, etc.) who want to use models in modern web applications or engines.

Usage example:

Code:

  import fs from 'fs';
  import { DffConverter, ModelType } from 'dff2gltf-converter';

  // Read .dff and .txd files
  const dffBuffer = fs.readFileSync(`model.dff`);
  const txdBuffer = fs.readFileSync(`model.txd`);

  // Initialize the converter with buffers and model type
  const dffConverter = new DffConverter(dffBuffer, txdBuffer, ModelType.OBJECT);

  // Convert DFF to glTF
  const result = await dffConverter.convertDffToGltf();

  // Export the result as .glb (or .gltf) file
  result.exportAs(`./output/result.glb`);

  // Alternatively, get the buffer and write it manually
  const gltfBuffer = await result.getBuffer();
  fs.writeFileSync(`./output/${modelName}.glb`, gltfBuffer);

You can choose one of three model types for model conversion:

  ModelType.SKIN
  ModelType.CAR
  ModelType.OBJECT

Notes:

  • Selecting the wrong type may result in unexpected output after conversion, so be sure to specify the type correctly.
  • Cars and skins (III/VC) conversion are currently unavailable right now.

CLI (Not implemented):

dff2gltf [dffPath] [txdPath] [ModelType (-s, -m, -c)] [outputPath]
dff2gltf model.dff model.txd -s output.glb

This tool is still under development, so stay tuned!

About

This module will help you convert RW3D model files (.dff and .txd) to the web-compatible and easy readable .gltf/.glb format.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published