Model Structure
Understanding the 3D model structure of FiveM vehicles.
Model File Types
YFT Files (Model Files)
- Binary 3D model format
- Contains mesh geometry
- Includes bone/skeleton structure
- Cannot be edited directly - requires special tools
YTD Files (Texture Files)
- Contains all vehicle textures
- Includes paint, interior, decals
- Can be edited with texture editors
- Often reused across variants
LOD Models
- Level of Detail versions
- LOD0 - High detail (close distance)
- LOD1 - Medium detail (medium distance)
- LOD2 - Low detail (far distance)
- LOD3 - Very low detail (very far)
Model Hierarchy
A typical vehicle model structure:
Vehicle
├── Chassis (main body mesh)
├── Windows (glass meshes)
├── Doors
│ ├── Door_FL (Front Left)
│ ├── Door_FR (Front Right)
│ ├── Door_RL (Rear Left)
│ └── Door_RR (Rear Right)
├── Hood (Engine cover)
├── Trunk (Boot/rear cover)
├── Wheels
│ ├── Wheel_FL
│ ├── Wheel_FR
│ ├── Wheel_RL
│ └── Wheel_RR
├── Interior
│ ├── Seats
│ ├── Steering wheel
│ └── Dashboard
└── Extras
├── Bumpers
├── Spoilers
├── Wheels variations
└── Lights
Creating Custom Models
3D Modeling Software
- Blender (Free, recommended)
- 3DS Max (Commercial)
- Maya (Commercial)
Model Requirements
-
Polygon Count
- LOD0: 20,000-50,000 polygons
- LOD1: 10,000-20,000 polygons
- LOD2: 5,000-10,000 polygons
- LOD3: 1,000-3,000 polygons
-
Materials & Textures
- Standard vehicle materials
- Paint shader
- Glass shader for windows
- Interior materials
- Decal support
-
Bone Structure
- Must match vehiclelayouts.xml
- Proper bone rigging
- Weight painting for deformation
Texture Mapping
UV Mapping
- Each mesh face mapped to texture coordinates
- Essential for proper paint application
- Custom decal placement on UV coordinates
Texture Channels
Standard vehicle textures include:
| Channel | Purpose |
|---|---|
| Diffuse | Base color/albedo |
| Normal | Surface detail normal map |
| Specular | Shine/reflection map |
| Emissive | Self-illumination |
| Decal | Paint job/livery layer |
Model Optimization
Mesh Optimization
Original Model: 45,000 polygons
├── High LOD (LOD0): 45,000 polygons
├── Medium LOD (LOD1): 15,000 polygons
├── Low LOD (LOD2): 5,000 polygons
└── Distant LOD (LOD3): 2,000 polygons
Texture Optimization
- Use Power-of-2 texture sizes (512, 1024, 2048, 4096)
- Compress textures appropriately
- Combine multiple small textures when possible
- Use mipmaps for better scaling
Model Export Workflow
-
Model in Blender
- Import base vehicle or create new
- Add custom geometry
- Apply materials and textures
- Create LOD versions
-
Prepare Bones
- Rig model with proper skeleton
- Weight paint for deformation
- Test bone rotation/movement
-
Optimize Geometry
- Reduce polygon count for LODs
- Ensure proper normals
- Check for overlapping geometry
-
Export Settings
- Use FiveM-compatible exporter
- Include all LOD levels
- Embed textures or link externally
-
Convert to YFT
- Use CodeWalker or similar tool
- Verify bone structure
- Test in FiveM
Common Model Issues
Rendering Issues
- Black textures - Missing texture references
- Floating geometry - Model not properly attached to bones
- Flickering - Normal map problems
- Invisible parts - Faces reversed (wrong winding order)
Deformation Issues
- Doors don't deform - Improper bone weighting
- Distorted mesh - Weight painting errors
- Stuck geometry - Bone limits exceeded
Performance Issues
- Frame rate drops - Too many polygons
- Texture flickering - Mipmaps not generated
- Memory overflow - Texture resolution too high
Material Setup
Paint Material
Shader: Vehicle Paint
- Diffuse: Paint color
- Normal: Surface detail
- Specular: Shine amount
- Metallic: Metal vs matte
Glass Material
Shader: Vehicle Glass
- Transparency: 0.7-0.9
- Refraction: enabled
- Reflection: enabled
- Tint: slightly tinted
Interior Material
Shader: Vehicle Interior
- Diffuse: Interior color
- Specular: Low shine
- Normal: Fabric detail
Asset Integration
After creating your model:
- Reference in vehicles.meta - Link model name
- Create YTD textures - Package all textures
- Define in carvariations.xml - For customization
- Test thoroughly - In various LODs
- Optimize for distribution - Compress appropriately
Best Practices
- Use existing vehicle models as reference
- Maintain consistent polygon density
- Test all LOD transitions
- Keep texture sizes consistent
- Document bone structure clearly
- Version your models
- Backup original models
- Test performance on various systems