Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Fluid rendering - transparency / translucency
#1
Hello,

I need to get fluid to be transparent; I've tried various set ups with the rendering but I've not been able to get this to work.  Is there a simple way to set this up with the assets provided in the package or will I need to mess with altering / writing shader code?  

Thanks!
Reply
#2
(05-12-2018, 05:55 PM)Mitch@PG Wrote: Hello,

I need to get fluid to be transparent; I've tried various set ups with the rendering but I've not been able to get this to work.  Is there a simple way to set this up with the assets provided in the package or will I need to mess with altering / writing shader code?  

Thanks!

Fluid is transparent by default, but it has some color absorption.

Just set particle color to white (in the ParticleRenderer component) and the material thickness scale to zero (for instance, the ThickFluid material, or any other material that uses the Obi/Fluid/DielectricFluid shader. Make sure you actually use this material in the FluidRenderer component!). This will yield completely colorless, transparent fluid.
Reply
#3
(06-12-2018, 12:08 PM)josemendez Wrote: Fluid is transparent by default, but it has some color absorption.

Just set particle color to white (in the ParticleRenderer component) and the material thickness scale to zero (for instance, the ThickFluid material, or any other material that uses the Obi/Fluid/DielectricFluid shader. Make sure you actually use this material in the FluidRenderer component!). This will yield completely colorless, transparent fluid.

Yes ... heh ...  Sonrojado   ... about that ...

So, that odd things happen when you put transparent objects inside other transparent objects .... and I didn't realise that the objects I had inside the fluid had their shader set to transparent.  I swapped the shader back to the standard shader, and suddenly they all appeared.  

Thank you for the above information though - it's helpful to have it laid out clearly.
Reply
#4
(10-12-2018, 12:35 PM)Mitch@PG Wrote: Yes ... heh ...  Sonrojado   ... about that ...

So, that odd things happen when you put transparent objects inside other transparent objects .... and I didn't realise that the objects I had inside the fluid had their shader set to transparent.  I swapped the shader back to the standard shader, and suddenly they all appeared.  

Thank you for the above information though - it's helpful to have it laid out clearly.

If you have multiple transparent objects inside each other, you will have to sort them back to front in order to be drawn correctly. This is just a thing of realtime rendering, cannot be avoided (at least not in a cheap way). Unity does this for you if you put your shaders in the transparent render queue, but for fluid, it has to be rendered last. Even then, multiple intersecting transparent objects will look weird. Only if they do not intersect at all will they look somewhat correct.

You should be able to modify Obi slightly to achieve this. In ObiBaseFluidRenderer, change all instances of CameraEvent.BeforeImageEffectsOpauqe to CameraEvent.BeforeImageEffects. Note however, that this will render fluid on top of all transparent objects regardless of their depth.

cheers,
Reply