psydack / uimgui

UImGui (Unity ImGui) is an UPM package for the immediate mode GUI library using ImGui.NET. This project is based on RG.ImGui project.
MIT License
334 stars 50 forks source link

Rendering Issue - Topmost #23

Closed wh0am15533 closed 2 years ago

wh0am15533 commented 2 years ago

Any suggestions for how to set the rendering/sorting layer? See these one is from the editor and one from injected at runtime.

It seem's UI object's will over-draw the DearImGui window. I've played with the Shader's renderqueue but no change. Any suggestions on how to make it top-most? (It happen's with just Dear ImGui also, same result, but where the hell to set the topmost? I've tried canvas sorting order, Camera depth, renderqueue, layer's, nothing change's it.)

BTW: I also made a fix for URP/HDRP Shader's not included in build's. It allows including into AssetBundles also. Like all those hidden/internal builtin shader's in URP/HDRP.

Capture

Capture1

psydack commented 2 years ago

Hello!

You could use different cameras to reach what you're looking for. image

You'll need to set your canvas to render into a specific camera: image

It's quick test and it works for this set up Main Camera -> Render UImGui Main Camera (1) -> Render Canvas UI Main Camera (2) -> Everything else

Main Camera image

Main Camera (1) image

Main Camera (2) image

It would be awesome if you could make a merge request with your fix or any other way better to share.

Thanks for using ;)

wh0am15533 commented 2 years ago

Thanks for info, that helps alot!

I started with DearImGui but moved to UImGui due to the added features you have, not to mention your more active on your repo. their's appears dead.

I'll get a PR setup with my changes. Good stuff, I really didn't have to modify the core UIMGui code, Just some changes mainly in uimgui.cs, in order to support bundling it into a an AssetBundle for runtime loading. I was getting issue with missing asset dependencies with URP assets and the Unity Editor wouldn't let you add them After adding a ShaderVariantCollection and prewarming the shader's, the asset's get included. I mainly had to figure out this camera thing.

tbarusseau commented 2 years ago

Thanks for sharing, any idea how to replicate this behaviour with URP/HDRP?

For now I'm just toggling off my UI whenever I display my uimgui debug interface. Thanks for the great package by the way.

psydack commented 2 years ago

You can do using the same logic as above (I made a quick sample on URP)

image

Make 2 more camera using overlay and use the stack feature as described here https://www.youtube.com/watch?v=OmCjPctKkjw

Main Camera image

UI Camera image

UImGui Camera image

Canvas (your UI Canvas) image

Hope it helps, otherwise open an issue because other people could get help from there. =)

Thanks for using <3