#How to place UI behind 3d world
1 messages · Page 1 of 1 (latest)
Are you trying to render a 3d model inside you UI?
No, I want to show the background image like clear color.
I thought about creating a billboard-like mesh, but it seemed like a pain to calculate the transform from the camera and the aspect ratio of the image, so I decided to use the UI.
Did you try to render to a texture and render that on a quad?
then you have control over the clear color as well
I'm inclined to say that UI always renders on top. But not 100% sure
I thought I could render part of the UI first with RenderLayers, but the UI seems to ignore RenderLayers even between UIs.
I would create a quad and write a system to compute the Transform...
You can layer multiple cameras, see the two_passes example for that. It's possible it doesn't play well with ui though, there's still a lot of work being done to make ui easier to use
I tried but it seems that UI and RenderLayers do not interact well. At least in bevy 0.8.1. (it worked fine with normal mesh)
I will try to use bevy main after this.
I updated to bevy/main and tried several things, all of which failed.
I created three cameras for test: background ui (2d, ui = true, priority = -1, layer = 1), 3d scene (3d, ui = false, priority = 0), foreground ui (2d, ui = true, priority = 1, layer = 2). clear color is None.
I want to render in order of background ui, 3d scene, and foreground ui.
- activate all → (A) the FG was rendered in front of the BG.
- activate BG and scene cameras → (B) the scene was rendered, but the BG was not rendered and black.
- activate scene and FG cameras → (B) the FG was rendered in front of the BG.
- swap the priority of the FG and the BG cameras and activated all → (A) the FG was rendered in front of the BG.
- set the priority the scene camera was to 2 and activate all → (B) the scene was rendered, but the BG was not rendered and black.
Note: The order in which entities are spawned into the scene is foreground, scene, background.
I intend to create a small application and try this again.