Segmented Dimming for Magic Leap

Godot Version

4.5.2

Question

I need to implement Magic Leap segmented dimming, which requires writing to the alpha channel of the final composited framebuffer.

Is there a way in Godot to modify the final frame before display, for example through a render hook or post‑processing stage?
How should this be handled for stereo rendering (left and right eye)?
Can this be achieved using a custom XR extension, or would proper post‑processing require modifications to the Godot rendering backend?

Any pointers appreciated.

Look at the Compositor.

1 Like

Not possible with the compatibility renderer, but with the mobile renderer you can use compositor effects to add a post process in.
Do note that this disables a number of optimisations so there may be a performance impact on TBDR GPUs. It depends a bit on how well the GPU drivers are able to recognise passes can be merged.

It may be smarter to work the other way around and render your alpha before rendering geometry but i don’t know if that is possible in your use case.

1 Like

Thanks for the hint about the compositor!

I followed the tutorial and the color-changing post-processing effect works fine in Forward+. But when switching to Mobile, the effect no longer works in the editor (Windows 11, v4.5.stable.mono.official [876b29033]). I get this error:

Image needs the TEXTURE_USAGE_STORAGE_BIT usage flag set to be used as uniform.
servers/rendering/rendering_device.cpp:3738 @ uniform_set_create()

I see the same issue when running on Magic Leap 2.

There’s a GitHub issue about this, but I haven’t found a usable workaround.
Do you have any idea what I could try?