Figure: Diagnostic workflow: Alpha-capable format → Match clear and blending → Compare UI compositing
Figure: Diagnostic workflow: Alpha-capable format → Match clear and blending → Compare UI compositing

Cause and mechanism

For dark edges around a transparent RenderTexture, compare how its producer and UI display handle color and alpha. Premultiplied alpha already has alpha multiplied into the color; multiplying it again when displaying the image darkens translucent edges. Changing the camera background to transparent white alone is not a guaranteed fix.

Check and correct the setup

  1. Clear to transparent black and verify that format and rendering passes preserve alpha, including post-processing.
    Inspect background, foreground and transparency separately
    Inspect background, foreground and transparency separately
  2. Use Blend One OneMinusSrcAlpha for premultiplied input, or SrcAlpha OneMinusSrcAlpha for straight input.
    Inspect background, foreground and transparency separately
    Inspect background, foreground and transparency separately
  3. If unpremultiplying, protect division near zero; check filtering and color-space conversion too.
    Inspect background, foreground and transparency separately
    Inspect background, foreground and transparency separately

Limits and verification

Composite over black, white, and colored backgrounds. A premultiplied display shader must not multiply input RGB by alpha again.

A focused diagnostic setup

Focus on edge-only darkening rather than overall brightness. Render a soft red circle onto transparent background and inspect stored RGB and alpha separately.

Test in this order

  1. Verify alpha-capable format, camera clear and post-processing alpha preservation.
    Inspect background, foreground and transparency separately
    Inspect background, foreground and transparency separately
  2. Determine whether stored RGB is already alpha-weighted and match display factors and shader multiplication.
    Inspect background, foreground and transparency separately
    Inspect background, foreground and transparency separately
  3. Composite over black, white and blue, inspecting near-zero, intermediate and opaque alpha.
    Inspect background, foreground and transparency separately
    Inspect background, foreground and transparency separately

Interpret the result

Transparent-white clearing alone does not repair double alpha weighting. Trace the producer, stored values and final UI material as three separate stages.

Related explanations

References