Emmiter renderer order - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Fluid (https://obi.virtualmethodstudio.com/forum/forum-3.html) +--- Thread: Emmiter renderer order (/thread-2299.html) |
Emmiter renderer order - hromoyDron - 08-06-2020 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? RE: Emmiter renderer order - josemendez - 09-06-2020 (08-06-2020, 05:22 PM)hromoyDron Wrote: Hello! 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, RE: Emmiter renderer order - hromoyDron - 09-06-2020 (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. 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? RE: Emmiter renderer order - josemendez - 09-06-2020 (09-06-2020, 08:00 AM)hromoyDron Wrote: But my emitters are always on the move. 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/tutorials/customparticlerendering.html Quote:ObiSimpleFluidRenderer 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. RE: Emmiter renderer order - hromoyDron - 09-06-2020 thank you, I will try and will be back if I have any questions |