Obi Official Forum
Obi Fluid with Sprites. - 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: Obi Fluid with Sprites. (/thread-2427.html)



Obi Fluid with Sprites. - FoxButler - 16-08-2020

Hello,

I was doing a few preliminary tests with Obi Fluid and sprites, It would appear that fluid transparency doesn't work on sprites or at least it doesn't with my tests.

I placed a sprite 2d and a plane mesh side by side behind(Z) a simple fuild simulation, The mesh with a default diffuse material applied could be seen through the transparant liquid but the sprite is completely rendered over and can't be seen, I'm guessing this is a limitation of the default sprite shader since a standard material works just fine.

My question is if Obi Fluid can be used on 2d Projects which primarily use sprites how can I achieve rendering fluid on top of sprite with transparancy? Would I need a custom shader or am I missing something real obvious?

Thanks for any help in advance Sonrisa .


RE: Obi Fluid with Sprites. - josemendez - 17-08-2020

(16-08-2020, 08:28 PM)FoxButler Wrote: Hello,

I was doing a few preliminary tests with Obi Fluid and sprites, It would appear that fluid transparency doesn't work on sprites or at least it doesn't with my tests.

I placed a sprite 2d and a plane mesh side by side behind(Z) a simple fuild simulation, The mesh with a default diffuse material applied could be seen through the transparant liquid but the sprite is completely rendered over and can't be seen, I'm guessing this is a limitation of the default sprite shader since a standard material works just fine.

My question is if Obi Fluid can be used on 2d Projects which primarily use sprites how can I achieve rendering fluid on top of sprite with transparancy? Would I need a custom shader or am I missing something real obvious?

Thanks for any help in advance Sonrisa .

Sprites are almost always rendered in the transparent rendering queue, instead of the opaque one like the standard material is by default. Moreover, sprites use their own sorting system (custom axis/sort groups) to be rendered relative to each other.

Fluid is always rendered after all opaque objects (before the transparent queue), making use of depth testing. So if you wish to mix sprites with fluid, you will need to use a custom sprite shader.

For more info, see Unity's docs on sprite sorting: https://docs.unity3d.com/Manual/2DSorting.html