Obi Official Forum
Obi Fluid renderer and World Space canvas - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Fluid (https://obi.virtualmethodstudio.com/forum/forum-3.html)
+--- Thread: Obi Fluid renderer and World Space canvas (/thread-4041.html)



Obi Fluid renderer and World Space canvas - Apoll0 - 30-10-2023

Hello!

I am using Obi fluid and today noticed that it is rendered over my world space canvas object.
I've checked with renderer enabled and particles don't touch the object. Only obi fluid renderer draws over it.
Build-in pipline, Unity 2022.3.12

White disk in the attachment pic -- on world space canvas

[attachment=1924]


RE: Obi Fluid renderer and World Space canvas - josemendez - 31-10-2023

(30-10-2023, 04:58 PM)Apoll0 Wrote: Hello!

I am using Obi fluid and today noticed that it is rendered over my world space canvas object.
I've checked with renderer enabled and particles don't touch the object. Only obi fluid renderer draws over it.
Build-in pipline, Unity 2022.3.12

White disk in the attachment pic -- on world space canvas

Hi,

Transparent objects need to be sorted back-to-front when rendering, since they don't use the depth buffer to discard fragments. Unfortunately, sorting fluid by distance to camera is not possible so it will either render always on top or behind. You might want to use a custom shader on your UI that does alpha clipping instead of blending, or change the fluid's render event. See:
http://obi.virtualmethodstudio.com/forum/thread-3431.html?highlight=transparency

kind regards,


RE: Obi Fluid renderer and World Space canvas - Apoll0 - 31-10-2023

(31-10-2023, 09:46 AM)josemendez Wrote: Hi,

Transparent objects need to be sorted back-to-front when rendering, since they don't use the depth buffer to discard fragments. Unfortunately, sorting fluid by distance to camera is not possible so it will either render always on top or behind. You might want to use a custom shader on your UI that does alpha clipping instead of blending, or change the fluid's render event. See:
http://obi.virtualmethodstudio.com/forum/thread-3431.html?highlight=transparency

kind regards,

It seems that ObiFluidRendererFeature.cs is for URP. I use buildin pipeline. Any workarounds?
I tried custom UI shader with cliping and nothing changed (


RE: Obi Fluid renderer and World Space canvas - josemendez - 31-10-2023

(31-10-2023, 10:55 AM)Apoll0 Wrote: It seems that ObiFluidRendererFeature.cs is for URP. I use buildin pipeline. Any workarounds?
I tried custom UI shader with cliping and nothing changed (

Hi,

The principle is the same regardless of the render pipeline used, since transparent objects are drawn the exact same way in all of them: typically transparent objects need to be sorted back to front for correct rendering, and they won't intersect properly with each other since they don't write to the depth buffer.

I tried an alpha clipping UI shader and it works correctly for me. Since alpha-clipped objects write to the depth buffer you'll also get correct intersections between UI and fluid (this is in the built-in render pipeline):

[Image: 7FsB8sT.png]

Could you elaborate about your setup? Are you using sorting layers for the canvas? Could you share the shader you're using for the UI?

kind regards,