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
- Clear to transparent black and verify that format and rendering passes preserve alpha, including post-processing.
Inspect background, foreground and transparency separately - Use Blend One OneMinusSrcAlpha for premultiplied input, or SrcAlpha OneMinusSrcAlpha for straight input.
Inspect background, foreground and transparency separately - If unpremultiplying, protect division near zero; check filtering and color-space conversion too.
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
- Verify alpha-capable format, camera clear and post-processing alpha preservation.
Inspect background, foreground and transparency separately - Determine whether stored RGB is already alpha-weighted and match display factors and shader multiplication.
Inspect background, foreground and transparency separately - Composite over black, white and blue, inspecting near-zero, intermediate and opaque alpha.
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
- Alpha Blend (Alpha Blend / Translucent Blend / Blend SrcAlpha OneMinusSrcAlpha)
- Diagnose dark or overbright RenderTexture previews
- Render Texture