29-10-2020, 01:04 PM
I'm in the process of upgrading a project to use URP, and ran into an odd issue with the fluid renderer - the shadows received by the fluid seem to render differently depending on whether there is a world-space UI element like image, text, button, etc. visible to the camera.
I noticed this in a project with Obi 5.6, Unity 2019.4.13f1, and URP 7.5.1, but confirmed that it also occurs on the latest versions (Unity 2020.1.11f1, URP 8.2.0).
I was able to recreate this in a new project, see a video showing the issue here:
https://i.imgur.com/UQhTqK3.mp4
To recreate this:
- make a solver and fluid emitter with default values (unchecking "Render" on the ObiParticleRenderer).
- create a Canvas with a render mode of World Space, and give it at least one child UI element like a Text. Make sure this text field is visible somewhere in the scene.
- set the Environment Lighting Source to Gradient or Color, instead of Skybox.
- in the ObiFluidRendererFeature, set Transparency to something less than 1. In the demo video, I set Transparency to 0. I had also set the Ambient Multiplier to 6 to exaggerate the effect, but it seems to occur whenever the Ambient Multiplier is non-zero.
The bug seems to be related to ambient lighting - when any camera (editor or game) has a world-space UI element within its view, any shadows falling on the fluid are tinted with the selected ambient color for the scene, but otherwise are very dark.
I noticed this in a project with Obi 5.6, Unity 2019.4.13f1, and URP 7.5.1, but confirmed that it also occurs on the latest versions (Unity 2020.1.11f1, URP 8.2.0).
I was able to recreate this in a new project, see a video showing the issue here:
https://i.imgur.com/UQhTqK3.mp4
To recreate this:
- make a solver and fluid emitter with default values (unchecking "Render" on the ObiParticleRenderer).
- create a Canvas with a render mode of World Space, and give it at least one child UI element like a Text. Make sure this text field is visible somewhere in the scene.
- set the Environment Lighting Source to Gradient or Color, instead of Skybox.
- in the ObiFluidRendererFeature, set Transparency to something less than 1. In the demo video, I set Transparency to 0. I had also set the Ambient Multiplier to 6 to exaggerate the effect, but it seems to occur whenever the Ambient Multiplier is non-zero.
The bug seems to be related to ambient lighting - when any camera (editor or game) has a world-space UI element within its view, any shadows falling on the fluid are tinted with the selected ambient color for the scene, but otherwise are very dark.