Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  fluid shader doesn't show transparent materials behind it properly
#2
(02-05-2022, 10:40 AM)locque Wrote: Take a look at this: https://imgur.com/a/72rK6d5

This is a bottle with the builtin rp standard shader set to transparent mode with some fluid inside of it and another drop of fluid in front of it. While the fluid inside the bottle looks alright, the drop in front of it pretty much removes any opacity from the transparent material behind it, which is especially noticeably in the outer region of the drop that is not colorized.

Is there some way to fix this or is this a hard limitation of the shader?

There's no *cheap* way to fix this. It's due to the good old limitation with transparent object rendering: you need them to be sorted back to front for alpha blending to work correctly.

All fluid in the scene is rendered before other transparent objects. This means the fluid is rendered first, then other transparents on top. This more or less covers the typical use case of fluid inside a transparent bottle (for 100% correct results, triangles at the back of the bottle should be rendered first, then the fluid, then triangles at the front of the bottle).

In your case, for correct rendering you'd need to render back of the bottle, fluid inside the bottle, front of the bottle, fluid on front of the bottle, in that specific order. The only way to do that is to sort all triangles in the bottle and all particles in the fluid back to front (according to their distance to the camera), which is very expensive.

Note this is not a limitation of Obi, but of all realtime rendering engines that use rasterization + alpha blending to render transparent objects: you can't render intersecting transparent objects correctly. The only way to do that is use raytracing or OIT (order-independent transparency, which oftentimes is implemented using screen door transparency and very common to dither out objects like walls or columns that get in between the player and the camera in 3rd person games without the need to sort literally everything in the scene)
Reply


Messages In This Thread
RE: fluid shader doesn't show transparent materials behind it properly - by josemendez - 02-05-2022, 10:51 AM