Skip to content

URP: investigate eye-RT anti-aliasing (MSAA vs camera FXAA/SMAA vs RendererFeature) #127

@dfattal

Description

@dfattal

Motivation

The rig-level FXAA shipped in #125 (v1.9.0) fixes eye-RT silhouette aliasing on Built-in RP only — it uses OnRenderImage, which Unity does not call under URP/HDRP, so on URP the pass is a silent no-op. URP partners therefore get no anti-aliasing today. This issue scopes how to fix it for URP.

Background (why URP is likely different/easier than BiRP)

The #121 root cause is specific to Built-in RP + MultiPass + OpenXR: Unity submits the eye swapchain at sampleCount=1 and its eye-RT MSAA resolve drops fractional alpha (confirmed on D3D12 and Vulkan; verified a known Unity "Won't Fix" bug). URP has a different renderer and MSAA resolve path, plus first-class built-in camera anti-aliasing (FXAA/SMAA/TAA). So a URP partner may need only a project/camera setting — possibly no plugin code at all.

Plan — cheapest first, and TEST AGAINST TRANSPARENT CONTENT

The whole point is the alpha edge of an alpha-native transparent overlay, not opaque geometry edges. Opaque edges are easy; the question is whether each technique produces fractional alpha at the silhouette. Test order:

  1. URP MSAA (URP Asset → MSAA = 4x/8x). Probe whether it actually reaches the XR eye RT — authoritative check is the plugin's xrCreateSwapchain hook log (sampleCount) + XRSettings.eyeTextureDesc.msaaSamples + visual. If it works, this is the best outcome: MSAA coverage resolve gives true fractional alpha → fixes opaque AND transparent, zero plugin code.
  2. URP camera built-in FXAA/SMAA (Camera component → Anti-aliasing). No code, but — like our earlier SMAA concern on BiRP — these are colour/luma-edge techniques and may not soften the alpha channel. Must be verified on the transparent silhouette specifically, not opaque.
  3. Custom URP ScriptableRendererFeature FXAA — only if 1 and 2 both fail on the transparent case. This is the URP equivalent of DisplayXRPostAA (Rig-level post-process FXAA for the XR eye RT (#121) #125): a Blit render pass that lerps full RGBA. Most work; last resort.

Test vehicle / caveat

displayxr-unity-test-2d-ui is the URP repo, but it's built around the 2D window-space UI (#67) and may not contain alpha-native transparent content with a flat-shaded silhouette (the case where the aliasing is visible). The investigation likely needs transparent + flat-shaded content added to a URP scene (port a slice of test-transparent, or add a transparent overlay rig + flat asset to test-2d-ui).

Expected outcome

Most likely #1 or #2 → URP partners get a documented project/camera setting and we write no URP plugin code. #3 only if the alpha edge survives neither.

Priority

Medium. v1.9.0 unblocked BiRP partners; this unblocks URP partners. Do the #1/#2 probe before committing to any RendererFeature work.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions