LOD Models & Optimization
Understanding and implementing Level of Detail (LOD) models for optimal performance.
What are LOD Models?
LOD (Level of Detail) is a technique using different model versions based on distance:
Close (0-50m): Full detail → 50,000 polygons
Near (50-150m): Good detail → 15,000 polygons
Far (150-300m): Low detail → 5,000 polygons
Distant (300m+): Minimal → 1,000 polygons
Performance Impact: Without LOD: Vehicle always 50k polygons = 30% FPS loss With LOD: Average 10k polygons = 5% FPS loss (83% improvement)
LOD Levels
LOD0 - High Detail (0-50m)
- Full resolution textures
- All geometry visible
- Up to 50,000 polygons
- Use: When player is close
<Model>
<Name>myvehicle_LOD0</Name>
<Polygons>45000</Polygons>
<TextureSize>2048x2048</TextureSize>
</Model>
LOD1 - Medium Detail (50-150m)
- Reduced polygon count
- Combined geometry where possible
- 15,000-25,000 polygons
- Simplified interior
<Model>
<Name>myvehicle_LOD1</Name>
<Polygons>20000</Polygons>
<TextureSize>1024x1024</TextureSize>
</Model>
LOD2 - Low Detail (150-300m)
- Simplified shape only
- Major features only
- 5,000-10,000 polygons
- Very basic interior
<Model>
<Name>myvehicle_LOD2</Name>
<Polygons>7500</Polygons>
<TextureSize>512x512</TextureSize>
</Model>
LOD3 - Minimal Detail (300m+)
- Silhouette only
- 1,000-3,000 polygons
- Merged geometry
- Single color texture
<Model>
<Name>myvehicle_LOD3</Name>
<Polygons>2000</Polygons>
<TextureSize>256x256</TextureSize>
</Model>
Creating LOD Models
In Blender
Step 1: Export High-Detail Model
File → Export → GTA V Model
- Ensure all LODs in file
- Export as .yft format
Step 2: Create LOD1 (50% detail)
1. Select high-detail mesh
2. Add Decimate Modifier
3. Set Ratio: 0.5 (50% polygons)
4. Apply modifier
5. Export as separate LOD1
Step 3: Create LOD2 (20% detail)
1. Select LOD1 mesh
2. Decimate Ratio: 0.3 (30% of previous)
3. Simplify geometry manually
4. Remove small details
5. Export as LOD2
Step 4: Create LOD3 (5% detail)
1. Create basic silhouette
2. Merge all geometry
3. Keep only major shapes
4. Export as LOD3
Polygon Count Example
Original Vehicle:
- Body: 25,000 poly
- Interior: 15,000 poly
- Wheels (4x): 5,000 poly
Total LOD0: 45,000 poly
LOD1 (50% reduction):
- Body: 12,500 poly
- Interior: 7,500 poly
- Wheels (simplified): 2,500 poly
Total: 22,500 poly
LOD2 (75% reduction):
- Body: 6,000 poly
- Interior: 2,000 poly
- Wheels (basic): 500 poly
Total: 8,500 poly
LOD3 (95% reduction):
- Silhouette: 2,000 poly
Total: 2,000 poly
LOD Configuration
FiveM LOD Settings
Define LOD distances in config:
<LODGroup>
<LOD0>
<Model>myvehicle_LOD0</Model>
<Distance>50.0</Distance>
</LOD0>
<LOD1>
<Model>myvehicle_LOD1</Model>
<Distance>150.0</Distance>
</LOD1>
<LOD2>
<Model>myvehicle_LOD2</Model>
<Distance>300.0</Distance>
</LOD2>
<LOD3>
<Model>myvehicle_LOD3</Model>
<Distance>1000.0</Distance>
</LOD3>
</LODGroup>
Dynamic Distance Adjustment
Adjust distances based on hardware:
-- High-end systems
LOD0: 100m, LOD1: 300m, LOD2: 500m, LOD3: 1000m
-- Mid-range systems
LOD0: 50m, LOD1: 150m, LOD2: 300m, LOD3: 600m
-- Low-end systems
LOD0: 25m, LOD1: 80m, LOD2: 150m, LOD3: 300m
Optimization Strategies
Strategy 1: Mesh Decimation
Progressive polygon reduction:
LOD0: 45,000 (100%)
↓ (50% reduction)
LOD1: 22,500 (50%)
↓ (60% reduction)
LOD2: 9,000 (20%)
↓ (75% reduction)
LOD3: 2,250 (5%)
Strategy 2: Geometry Simplification
Remove details at distance:
LOD0: Full interior, details, decals
LOD1: Interior simplified, some details
LOD2: Basic interior, no decals
LOD3: Silhouette only, no interior visible
Strategy 3: Texture Reduction
Lower resolution at distance:
LOD0: 2048x2048 - Full resolution
LOD1: 1024x1024 - Half resolution
LOD2: 512x512 - Quarter resolution
LOD3: 256x256 - Minimal resolution
Memory Calculation
Without LOD System
Vehicle resident in memory:
- Highest LOD: 50,000 poly @ 2048x2048 texture
- Always loaded: 100MB
- FPS impact: 20-30%
With Proper LOD System
Vehicle loaded intelligently:
- Player close (0-50m): LOD0 (50MB)
- Player far (50-150m): LOD1 (20MB)
- Player very far (150m+): LOD2 (5MB)
- Average memory: 20MB
- Average FPS impact: 3-5%
Best Practices
- Always create LOD3 - Absolutely required
- Progressive reduction - Each LOD ~50% previous
- Test transitions - Ensure smooth swapping
- Match silhouettes - LODs should look same
- Keep proportions - Don't distort shape
- Test at distance - Verify appearance from far
- Monitor memory - Ensure all LODs fit
- Document distances - Note LOD transition points
Testing LOD Quality
Visual Testing
-- Get player distance from vehicle
local playerPed = PlayerPedId()
local vehicle = GetVehiclePedIsIn(playerPed)
local vehCoords = GetEntityCoords(vehicle)
local playerCoords = GetEntityCoords(playerPed)
local distance = #(playerCoords - vehCoords)
print("Distance: " .. distance .. "m")
LOD Transition Testing
Walk backwards from vehicle:
- 0-50m: Observe full detail
- 50m: Check for LOD1 pop-in
- 100m: Observe LOD1 quality
- 150m: Check LOD2 transition
- 200-300m: Observe LOD2 quality
- 300m+: Check LOD3 appearance
Expected: Smooth transitions, no obvious "popping"
Performance Monitoring
local function monitorLOD(vehicle)
print("=== LOD Test ===")
print("Polygons LOD0: 45000")
print("Polygons LOD1: 22500")
print("Polygons LOD2: 7500")
print("Polygons LOD3: 2000")
end
Common LOD Issues
Issue 1: Pop-In Visible
Cause: Transition distance too close Solution: Increase LOD distance or blend geometry
Issue 2: LOD Quality Drop
Cause: Too aggressive simplification Solution: Use 50-60% reduction ratios
Issue 3: Memory Usage High
Cause: LODs don't reduce enough Solution: Stricter decimation, smaller textures
Issue 4: Flickering
Cause: Intersecting geometry in LODs Solution: Carefully align LOD meshes
Advanced LOD Techniques
LOD Blending
Smooth transition between LODs:
Distance 40-60m:
Blend LOD0 (80%) + LOD1 (20%)
Distance 140-160m:
Blend LOD1 (80%) + LOD2 (20%)
Conditional Streaming
Load LODs based on activity:
if IsPlayerDriving(vehicle) then
LoadLOD(0) -- Full detail
elseif GetEntityHealth(vehicle) < 100 then
LoadLOD(1) -- Damaged, maybe full detail
else
UseStandardLOD() -- Normal distance-based
end
Performance Gains
Properly implemented LOD system results in:
| Metric | Without LOD | With LOD | Gain |
|---|---|---|---|
| Avg Polygons | 45,000 | 12,000 | 73% less |
| Memory/Vehicle | 100MB | 20MB | 80% less |
| FPS Impact | -25% | -5% | 80% improvement |
| Draw Calls | 10 | 3 | 70% less |
LOD models are essential for production-quality vehicles!