Some best-practices and guidelines when it comes to performance.

Tip! Use the Profiler and Frame Debugger

The Profiler and Frame Debugger are invaluable tools to get an insight in the rendering process of your project. Each step of the outline/fill effect will be shown within the frame debugger so you can see what’s going on.

SRP Batcher

Linework makes uses the Unity 6 RenderGraph API and the SRP Batcher.

The SRP Batcher in Unity optimizes draw calls by batching GameObjects that share the same shader. Each outline effect leverages this by batching outlines of the same type and visual together.

Outlines end up in a different batch if:

  • they are of a different type (different shader)
  • they have a different visual (same shader, different material)

Why does a different outline visual break the batch?

Although the SRP Batcher could technically batch outlines with different visuals, the current URP Renderer Feature API doesn’t support it. This is an area under investigation.

To maximize performance for a specific outline type, minimize the number of different outline visuals.

Fast Outline

Fast Outline is among the cheapest of the outline effects. It renders outlines by rendering an extruded version of an object behind the original object.

Soft Outline

See Soft Outline for more information.

Wide Outline

See Wide Outline for more information.

Flood iterations The wider the outline, the more flood iterations need to happen, the slower this effect is. However, this technique is still very performant for rendering wide outlines.

Edge Detection

Edge Detection

Surface Fill

Surface Fill

Mobile Performance Tests

Performance tests were done on a base model iPhone 15.

Skinned Mesh Renderers

This scene consists of 50 animated skinned mesh renderers, with each time 4 types of outlines/fills applied. Screenshots are shown in the following order: surface fill, fast outline, soft outline, wide outline.

400 Outlines

This scene consists of 400 meshes, with each time 4 types of outlines/fills applied. Screenshots are shown in the following order: surface fill, fast outline, soft outline, wide outline.

900 Outlines

This scene consists of 900 meshes, with each time 4 types of outlines/fills applied. Screenshots are shown in the following order: surface fill, fast outline, soft outline, wide outline.