Skip to content

Add transparent MOAP background and click pass-through support - #6015

Open
shadoskill wants to merge 5 commits into
secondlife:developfrom
shadoskill:MOAP
Open

Add transparent MOAP background and click pass-through support#6015
shadoskill wants to merge 5 commits into
secondlife:developfrom
shadoskill:MOAP

Conversation

@shadoskill

@shadoskill shadoskill commented Jul 17, 2026

Copy link
Copy Markdown

Description

This allows for media-on-a-prim to have its background fully transparent if the website sets it via CSS.
This also allow click pass-through to in world objects if clicking a fully transparent area on the moap.


Checklist

Please ensure the following before requesting review:

  • I have provided a clear title and detailed description for this pull request.
  • If useful, I have included media such as screenshots and video to show off my changes.
  • The PR is linked to a relevant issue with sufficient context.
  • I have tested the changes locally and verified they work as intended.
  • All new and existing tests pass.
  • Code follows the project's style guidelines.
  • Documentation has been updated if needed.
  • Any dependent changes have been merged and published in downstream modules
  • I have reviewed the contributing guidelines.

Additional Notes

Video of the feature and link to basic test page used in the video.

https://fullarray-dev.emptylist.co/moap_test.html

PowerToys_QwooSaIhZr.mp4

@github-actions github-actions Bot added the c/cpp label Jul 17, 2026
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@shadoskill

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables alpha-aware rendering for Media-On-A-Prim (MOAP) so web content can display with a truly transparent background, and updates picking/click handling so mouse events can pass through fully transparent media pixels to in-world objects behind.

Changes:

  • Treat RGBA media textures as alpha in the render pipeline so transparency is respected.
  • Add per-pixel transparency sampling for media textures (mask/pick support) via LLViewerMediaImpl::isTransparentAt().
  • Update pie tool click/hover handling to defer to the visible pick when the media pixel is fully transparent; update CEF plugin defaults for RGBA/transparent background.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
indra/newview/pipeline.cpp Routes RGBA textures (including media) into alpha rendering when appropriate.
indra/newview/llviewertexture.h Declares media-texture pick mask override to support transparency-aware picking.
indra/newview/llviewertexture.cpp Implements media-texture getMask() by sampling the live media buffer.
indra/newview/llviewermedia.h Adds isTransparentAt() API for per-pixel alpha testing at UV coords.
indra/newview/llviewermedia.cpp Implements per-pixel alpha sampling and clears media placeholder with transparent alpha.
indra/newview/lltoolpie.cpp Adds click/hover pass-through logic when the hit media pixel is fully transparent.
indra/media_plugins/cef/media_plugin_cef.cpp Switches embedded CEF background/format to preserve alpha (RGBA/transparent).
indra/llrender/llgltexture.h Makes getMask() virtual to allow media textures to override pick masking.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 652 to 656
// SL-15560: Product team overruled my change to set the default
// embedded background color to match the floater background
// and set it to white
settings.background_color = 0xffffffff; // white
settings.background_color = 0x00000000; // transparent

@akleshchev

akleshchev commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

This is likely to affect existing content, may be even render some content unreadable due to matching color of the background. I wonder if we can get some form of 'respect transparent background' checkbox to work on per-face basis. It should be trivial viewer side to store the value in LLMediaEntry, but server might will need to support it.

@callumlinden callumlinden left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As well as my comment on the background color, I would echo @akleshchev's point about existing content. We do not want to make pages unclickable because someone specified a transparent background color in older content.

// embedded background color to match the floater background
// and set it to white
settings.background_color = 0xffffffff; // white
settings.background_color = 0x00000000; // transparent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line means the default background color will be #000000 (black) so pages that do not specify a background color will inherit a black background.

Is that what you intended?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was not the intention no, I must have forgot to change that doing some testing.

As for existing content, I did some testing and yeah any blank page that does not have a CSS set background does show as fully transparent.

I added a toggle in media general settings to toggle it per face, and it should be ready for a future server message if I did everything correctly.
For now the checkbox is session based for testing so it wont get set back to false from the server not knowing about it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful - thank you for your excellent contribution. We'll ask our product folk to look at it since it has some potential content impacts and once we get their blessing, we'll merge it in.

Thank you.

… face.

Changed transparency to support future server message
TODO add in "overwrite" in llmediaentry when server adds support for new message.
@Geenz

Geenz commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Popping in here - what we might want to do instead is have a meta tag in the HTML that "opts in" to this rather than a flag from the simulator. Would require a little more plumbing I think to get that meta tag out, but I think it might be worth it to go this way instead of finding a server release for a change to an already pretty packed wire protocol.

@Geenz
Geenz self-requested a review July 29, 2026 17:09
sd[PERMS_CONTROL_KEY] = mPermsControl;

// "display" fields
sd[TRANSPARENT_BACKGROUND_KEY] = mTransparentBackground;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for if we stick with having an entry flag for this: you will want to extend unit tests to account for this. The existing tests are failing.

…ground.

Add transparent_background field to DEFAULT_MEDIA_ENTRY, EMPTY_MEDIA_ENTRY,
and PARTIAL_MEDIA_ENTRY tests.
Fix copy constructor missing mTransparentBackground.
@Dzonatas

Dzonatas commented Aug 1, 2026

Copy link
Copy Markdown

I tested MOAP, and it is broken. (That is the determination made.) It slows the game down, but it is the ability to click on something to restore all or parts of commits (with payload) that we want to look at. They get deleted when spawned. It is a bug that needs fixing. MOAP is highly insecure, as in $US Dollars. Sometimes everybody waits for a fix.

@DarlCat

DarlCat commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

I've found a way to avoid breaking content while not requiring Second Life-specific opt-in behavior from websites to enable transparency.

https://github.com/DarlCat/secondlife-viewer/tree/MOAP

The downside though is that it currently requires a patch to dullahan to facilitate injecting a very small piece of javascript into the webpage which means javascript must be enabled in CEF.

https://github.com/DarlCat/dullahan/tree/transparent-background

Since there is not much of any use for this transparency feature without dynamic webpages IMO; while not ideal in the slightest the tie-in isn't the worst tradeoff.

A cleaner approach without injection or a platform-specific meta tag detection would be patching CEF directly, something I'm hesitant to do. I see something that makes Second Life web content require nonstandard meta tags as equally undesirable to patching CEF. I did search around for a formal or informal standard to adopt for flagging webpages as supporting non-opaque rendering, but found none.

I know that there is currently an embedded content project underway in the dullahan repo, so it is possible there may duplicated work or different solutions to shared issues on both sides; hopefully we can share ideas with each other along the way if so.

Screenshot 2026-08-03 at 7 52 51 AM

@akleshchev

Copy link
Copy Markdown
Contributor

@Dzonatas that isn't relevant for current PR, if you have performance problems with moap, I suggest reporting them with specific scenarios and examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Click pass-through through transparent media

7 participants