Skip to content

Interleave rigged and world alpha draw calls back-to-front (port of secondlife/viewer#5927) - #284

Closed
anne-skydancer wants to merge 1 commit into
FirestormViewer:masterfrom
anne-skydancer:interleaved-alpha-upstream
Closed

anne-skydancer wants to merge 1 commit into
FirestormViewer:masterfrom
anne-skydancer:interleaved-alpha-upstream

Conversation

@anne-skydancer

Copy link
Copy Markdown

Summary

Port of secondlife/viewer#5927 (by Viscerous). Replaces the two-phase alpha render (rigged attachments drawn in an earlier separate batch) with a single back-to-front interleaved pass that merges rigged-attachment and world alpha streams. This fixes incorrect draw ordering where rigged alpha objects render behind world-alpha geometry they should be in front of (and vice versa) — e.g. alpha hair/clothing on avatars sorting wrongly against world alpha surfaces.

Early adopters (Alchemy Viewer) report positive results.

Changes (9 files, +346/−36)

  • llspatialpartition.hLLSpatialGroup::worldAlphaDepth()/mAvatarDepth for cross-stream depth ordering; CompareWorldAlphaDepth + CompareDepthRenderOrder comparators (std::less for pointer tie-breaks)
  • pipeline.{cpp,h}EAlphaStream {WORLD, RIGGED, INTERLEAVED}; LLPipeline::canUseInterleavedAlpha() + sortAlphaGroupsForInterleaving(); bridge stamp fan-out in postSort
  • llvoavatar.{cpp,h} + llcontrolavatar.cppLLVOAvatar::calcRiggedAlphaDepth() stamps rigged alpha groups with the avatar's depth
  • lldrawpoolalpha.{cpp,h}renderAlpha walks both streams in one interleaved pass via dual iterators; per-group LLGLDepthTest (stamped rigged groups depth-write, unstamped blend-only)
  • app_settings/settings.xmlRenderInterleavedAlpha setting, default on, as an escape hatch

Ported following FS preserve-original conventions (// <FS> ... // </FS> comment blocks).

Test plan

  • Cherry-picks cleanly onto current master (no conflicts)
  • Builds clean on Windows (MSVC 2022, ReleaseFS_open): 0 errors, 0 warnings
  • Static analysis: no diagnostics on any touched file; settings.xml parses
  • In-world visual verification of alpha ordering (avatar alpha attachments vs world alpha surfaces)

Notes

  • Default on; RenderInterleavedAlpha remains as a runtime toggle if issues surface.
  • Original work by Viscerous — secondlife/viewer PR #5927.

By submitting this pull request, I confirm that my contribution is made under the terms of the LGPL-2.1 license and that I have the right to submit it under that license.

…econdlife/viewer#5927)

Port of SLL PR #5927 (Viscerous): single back-to-front alpha pass that merges
rigged-attachment and world alpha streams instead of rendering rigged alpha
in a separate earlier batch. Fixes incorrect draw ordering where rigged alpha
objects render behind world alpha they should be in front of (and vice versa).

- LLSpatialGroup: worldAlphaDepth()/mAvatarDepth for cross-stream ordering
- CompareWorldAlphaDepth + CompareDepthRenderOrder comparators
- EAlphaStream {WORLD, RIGGED, INTERLEAVED}
- LLPipeline::canUseInterleavedAlpha()/sortAlphaGroupsForInterleaving()
- LLVOAvatar::calcRiggedAlphaDepth() stamps rigged alpha groups with avatar depth
- LLDrawPoolAlpha::renderAlpha walks both streams in one interleaved pass;
  per-group LLGLDepthTest (stamped rigged groups depth-write, unstamped blend-only)
- RenderInterleavedAlpha setting (default on) as escape hatch

Original work by Viscerous (secondlife/viewer PR #5927). Ported with
// <FS> ... // </FS> preserve-original conventions.
@anne-skydancer

Copy link
Copy Markdown
Author

Tested in-world on Windows (MSVC 2022 build, AMD RX 9070 XT): no issues observed. Visuals as expected, no alpha artifacts — rigged avatar attachments and world alpha surfaces sort correctly.

@anne-skydancer
anne-skydancer deleted the interleaved-alpha-upstream branch September 4, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant