Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Emmiter renderer order
#1
Hello!

I use two ObiFluidRenderer on one camera to render to emmiters with different colors.
(I use Simple fluid material with opaque mode, where shader return only color)

I noticed that one emitter everytime is rendered on top another emmiter. But they should every time change their position. Sometimes one emmiter should be in front sometime second.

How to fix it?
Reply
#2
(08-06-2020, 05:22 PM)hromoyDron Wrote: Hello!

I use two ObiFluidRenderer on one camera to render to emmiters with different colors.
(I use Simple fluid material with opaque mode, where shader return only color)

I noticed that one emitter everytime is rendered on top another emmiter. But they should every time change their position. Sometimes one emmiter should be in front sometime second.

How to fix it?

Particle renderers are rendered in the order in which they appear in the Fluid Renderer list. Simply swapping them in the list should do the job.

kind regards,
Reply
#3
(09-06-2020, 07:23 AM)josemendez Wrote: Particle renderers are rendered in the order in which they appear in the Fluid Renderer list. Simply swapping them in the list should do the job.

kind regards,

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?
Reply
#4
(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.
Reply
#5
thank you, I will try and will be back if I have any questions
Reply