Renvix Assets

Performance

Vision Fog is built to run many observers with exact line of sight at the same time. This section explains where the time goes, how to measure it, and what to change when you need more speed.

PageWhat it covers
BenchmarksThe included 2D and 3D stress tests and how to read their results
ProfilingMeasuring Vision Fog in your own game: Profiler markers and statistics
Optimization TipsSettings that make the biggest difference, and a checklist for mobile

Where the time goes

Every frame, right after LateUpdate, Vision Fog updates all sources that are due. One update has three parts:

PartRuns onWhat happens
GatherMain threadPhysics queries find the colliders around each source; their outlines are read or cut at eye height
SolveWorker threads, BurstThe visible area of each source is computed from its obstacles
NotifyMain thread, partly BurstResults are published; cones, the fog and hiders are updated

Gather and Solve overlap: as soon as the obstacles of one source are gathered, its solve starts on a worker thread, while the main thread gathers the next source. On a machine with several cores, most of the solving is finished by the time the gather is done.

Three things keep the cost down without any setup:

  • Unchanged sources are skipped. If a source and the obstacles around it did not move, its previous result is reused.
  • Collider outlines are cached. Each collider is read once and reused until it moves or changes. A static level costs only a quick check per collider and frame.
  • Revealers skip physics. A source with Blocked By set to Nothing makes no physics queries at all.

The fog texture is drawn from the visible areas by a Burst job; fading, blurring and the fog styles run on the GPU.

Editor and builds

Timings in the Editor are noticeably higher than in a build. The Editor adds safety checks to Burst code and jobs, and runs everything with debug overhead. Measure in a development or release build before drawing conclusions. The benchmarks show a warning in the Editor when these checks are on.