09-06-2020, 08:30 AM
(This post was last modified: 09-06-2020, 08:39 AM by josemendez.)
(09-06-2020, 08:00 AM)hromoyDron Wrote: But my emitters are always on the move.
that is, it often happens when one emitter is between parts of another emitter
is there any solution for this?
You need to use a depth buffer for this. The SimpleFluidRendered does not by default, as stated in the documentation. See:
http://obi.virtualmethodstudio.com/tutor...ering.html
Quote:ObiSimpleFluidRenderer
Will render 2D fluid without depth testing, refraction...[]
In game engines, objects are always drawn on-screen in the order in which their draw calls are issued. So if you draw object A after object B, A will appear on top of B. That is, unless you use a depth buffer (aka zbuffer) to determine the relative depth of object fragments. In this case, A's fragments might be discarded if they lay behind B in the depth buffer. This is known as depth testing.
Transparent objects add another layer of complexity to this, as they can only be blended to what is already drawn on screen. So it is mandatory to sort them back to front (so that the ones further away from the camera are drawn first), and draw them in that order.
Note this is not a 'thing' with Obi, it's how literally all modern, rasterization-based 3D engines work. Unity is no exception.
So in your case, you will have to add depth buffer support to the SimpleFluidRenderer. For the most part you can copy-paste it from the regular FluidRenderer.
If your emitters are always completely in front or behind each other (all particles of emitter A in front of all particles of emitter B or viceversa) you might just sort them along the camera's z axis, and skip depth testing altogether.