21-12-2020, 09:35 AM
(This post was last modified: 21-12-2020, 09:36 AM by josemendez.)
Hi there!
You need to enable the depth/opaque texture generation in your pipeline for fluids to be rendered correctly. Right now, they're not transparent because the rendered does not have access to the scene's opaque texture, and won't perform correct depth-testing because they don't have access to the scene's depth texture. See:
https://www.youtube.com/watch?v=k5Uv5ecjVM0
http://obi.virtualmethodstudio.com/tutor...ering.html
Even with these enabled sorting with UI won't work as expected. The reason for this is that in URP the opaque texture is generated during RenderPassEvent.BeforeRenderingTransparents, just as the default UI material (which is transparent) is being rendered. For fluid to have access to the opaque texture at all and blend correctly with the scene, it must be rendered after this event, that is, once world-space UI has been drawn. This is a URP limitation.
Things do not work the same way in the built-in pipeline (UI is rendered after all transparent objects), so there UI will be rendered correctly by default.
If you only need opaque fluids, you can work around this by opening ObiFluidRendererFeature.cs and setting the renderPassEvent in all fluid rendering passes to RenderPassEvent.BeforeRenderingTransparents, instead of RenderPassEvent.BeforeRenderingTransparents+1. This will prevent the fluid renderer from accessing the opaque texture, but will be rendered before the default UI material.
Another workaround would be using a custom shader for the UI, which renders together with opaque objects and uses alpha testing for transparency.
kind regards,
You need to enable the depth/opaque texture generation in your pipeline for fluids to be rendered correctly. Right now, they're not transparent because the rendered does not have access to the scene's opaque texture, and won't perform correct depth-testing because they don't have access to the scene's depth texture. See:
https://www.youtube.com/watch?v=k5Uv5ecjVM0
http://obi.virtualmethodstudio.com/tutor...ering.html
Even with these enabled sorting with UI won't work as expected. The reason for this is that in URP the opaque texture is generated during RenderPassEvent.BeforeRenderingTransparents, just as the default UI material (which is transparent) is being rendered. For fluid to have access to the opaque texture at all and blend correctly with the scene, it must be rendered after this event, that is, once world-space UI has been drawn. This is a URP limitation.
Things do not work the same way in the built-in pipeline (UI is rendered after all transparent objects), so there UI will be rendered correctly by default.
If you only need opaque fluids, you can work around this by opening ObiFluidRendererFeature.cs and setting the renderPassEvent in all fluid rendering passes to RenderPassEvent.BeforeRenderingTransparents, instead of RenderPassEvent.BeforeRenderingTransparents+1. This will prevent the fluid renderer from accessing the opaque texture, but will be rendered before the default UI material.
Another workaround would be using a custom shader for the UI, which renders together with opaque objects and uses alpha testing for transparency.
kind regards,