Files
metaverseDubai/docs/PERFORMANCE_OPTIMIZATION.md

6.4 KiB

Performance Optimization - Dubai Metaverse

Overview

This document describes performance optimization strategies and techniques for the Dubai Metaverse project.

Performance Targets

Frame Rate

  • Target: 60-90 FPS at 1440p/4K
  • Minimum: 60 FPS
  • Measurement: Unreal Insights, Stat FPS

Memory

  • GPU Memory: <12GB VRAM
  • System RAM: <16GB
  • Measurement: Unreal Insights, Stat Memory

Optimization Strategies

Nanite Optimization

Usage

  • Enable Nanite: Enable for all static meshes
  • Target: 100% of static meshes use Nanite
  • Benefit: High-poly geometry without performance penalty

Optimization

  1. Clustering: Optimize Nanite clustering
  2. Streaming: Use texture streaming
  3. Distance Culling: Cull distant Nanite meshes

LOD System

Non-Nanite Assets

  • LOD Generation: Generate LODs for non-Nanite assets
  • LOD Count: LOD0-3 for primary, LOD0-2 for background
  • LOD Distance: Optimize LOD transition distances

LOD Settings

  • LOD0: Full detail (close)
  • LOD1: Reduced detail (medium)
  • LOD2: Simplified (far)
  • LOD3: Minimal (very far)

World Partition Optimization

Streaming

  • Cell Size: Optimize cell size (128m default)
  • Loading Range: Optimize loading range per cell
  • Streaming Budget: Set streaming budget

Data Layers

  • Organization: Organize by system (buildings, props, etc.)
  • Streaming: Optimize data layer streaming
  • Culling: Use distance culling

Material Optimization

Shader Complexity

  • Instructions: Minimize shader instructions
  • Texture Sampling: Optimize texture sampling
  • Parameters: Limit exposed parameters

Shared Materials

  • Use Shared Materials: Use shared materials where possible
  • Material Instances: Use instances for variations
  • Material Count: Minimize unique material count

Lighting Optimization

Lumen Quality

  • Final Gather Quality: Adjust based on performance
  • Reflection Quality: Adjust based on performance
  • View Distance: Optimize view distance

Shadow Optimization

  • Virtual Shadow Maps: Use for performance
  • Shadow Resolution: Adjust based on performance
  • Shadow Distance: Optimize shadow distance

Light Count

  • Minimize Dynamic Lights: Use static lights where possible
  • Light Complexity: Optimize light complexity
  • Culling: Use distance culling

Texture Optimization

Resolution

  • Hero Assets: 8K (necessary for quality)
  • Primary Buildings: 4K
  • Background: 2K
  • Props: 1K-2K based on size

Streaming

  • Texture Streaming: Enable texture streaming
  • Virtual Textures: Use for large textures (optional)
  • Mip Maps: Generate mip maps

Compression

  • Format: Use appropriate compression
  • Base Color: BC7 (DXT5)
  • Normal: BC5
  • Other: BC7

Particle Optimization

Spawn Rate

  • Optimize Spawn Rate: Reduce if needed
  • Lifetime: Optimize particle lifetime
  • LODs: Use LODs for particles

GPU Particles

  • Use GPU Particles: For better performance
  • Limit Count: Limit particle count
  • Optimize Shaders: Optimize particle shaders

NPC Optimization

Count

  • NPC Density: Optimize NPC count
  • Distance Culling: Cull distant NPCs
  • LODs: Use LODs for NPCs

Behavior

  • Update Frequency: Optimize behavior tree updates
  • Perception: Optimize perception checks
  • Pathfinding: Optimize pathfinding

Performance Profiling

Unreal Insights

Setup

  1. Enable Insights: Enable Unreal Insights
  2. Start Session: Start profiling session
  3. Play: Play in editor or packaged build
  4. Stop: Stop profiling
  5. Analyze: Analyze results

Metrics

  • Frame Time: Frame time breakdown
  • Draw Calls: Draw call count
  • GPU Time: GPU time breakdown
  • Memory: Memory usage

Stat Commands

Frame Rate

  • Stat FPS: Display FPS
  • Stat Unit: Display frame time breakdown

Rendering

  • Stat RHI: Display rendering stats
  • Stat SceneRendering: Display scene rendering stats

Memory

  • Stat Memory: Display memory usage
  • Stat Streaming: Display streaming stats

Optimization Checklist

Pre-Optimization

  • Profile baseline performance
  • Identify bottlenecks
  • Set optimization priorities

Optimization

  • Enable Nanite for all static meshes
  • Generate LODs for non-Nanite assets
  • Optimize World Partition streaming
  • Optimize material complexity
  • Optimize texture resolution and streaming
  • Optimize lighting settings
  • Optimize particle systems
  • Optimize NPC count and behavior

Post-Optimization

  • Profile optimized performance
  • Validate performance targets met
  • Test on target hardware
  • Document optimization changes

Performance Testing

Test Scenarios

  1. Empty Level: Baseline performance
  2. Full District: Complete district loaded
  3. Cinematic Camera: Camera movement
  4. Vehicle Driving: Vehicle physics
  5. NPC Crowd: Multiple NPCs

Test Hardware

  • Minimum Spec: RTX 3060 / RX 6600 XT
  • Recommended Spec: RTX 3070 / RX 6800 XT
  • High-End Spec: RTX 4080 / RX 7900 XTX

Troubleshooting

Common Issues

Issue: Low frame rate

  • Solution: Profile to identify bottlenecks
  • Solution: Optimize identified areas
  • Solution: Reduce quality settings if needed

Issue: High memory usage

  • Solution: Optimize texture resolution
  • Solution: Enable texture streaming
  • Solution: Reduce asset count

Issue: Stuttering

  • Solution: Optimize streaming
  • Solution: Reduce asset loading
  • Solution: Optimize World Partition

Performance Budget

Per System

  • Rendering: 60% of frame time
  • Lighting (Lumen): 20% of frame time
  • Physics: 5% of frame time
  • AI/NPCs: 5% of frame time
  • Other: 10% of frame time

Optimization Priority

  1. Rendering: Highest priority
  2. Lighting: High priority
  3. Physics: Medium priority
  4. AI/NPCs: Medium priority
  5. Other: Low priority

Documentation

Optimization Documentation

Document optimization changes:

  • Changes Made: What was optimized
  • Performance Impact: Performance improvement
  • Settings: Optimization settings
  • Notes: Additional notes

Version: 1.0 Last Updated: [Current Date]