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.
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.OBJECTNotes:
- 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.
dff2gltf [dffPath] [txdPath] [ModelType (-s, -m, -c)] [outputPath]
dff2gltf model.dff model.txd -s output.glbThis tool is still under development, so stay tuned!