Obi Official Forum
Render ObiSimpleFluidRenderer before everything - 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: Render ObiSimpleFluidRenderer before everything (/thread-692.html)



Render ObiSimpleFluidRenderer before everything - rosedev - 19-09-2018

Hello,

I'm working on a 2D game and using ObiSimpleFluidRenderer to render the fluid.

By default the fluid is rendered after all renderers in the scene. Is it possible to make it render BEFORE all renderers?

I tried to change this line in the OnPreRender() method:

Code:
 currentCam.AddCommandBuffer (CameraEvent.BeforeImageEffectsOpaque, renderFluid);

to

Code:
currentCam.AddCommandBuffer (CameraEvent.BeforeForwardOpaque, renderFluid);
but it did not work.

Thanks for your answer.


RE: Render ObiSimpleFluidRenderer before everything - josemendez - 20-09-2018

(19-09-2018, 10:04 PM)rosedev Wrote: Hello,

I'm working on a 2D game and using ObiSimpleFluidRenderer to render the fluid.

By default the fluid is rendered after all renderers in the scene. Is it possible to make it render BEFORE all renderers?

I tried to change this line in the OnPreRender() method:

Code:
 currentCam.AddCommandBuffer (CameraEvent.BeforeImageEffectsOpaque, renderFluid);

to

Code:
currentCam.AddCommandBuffer (CameraEvent.BeforeForwardOpaque, renderFluid);
but it did not work.

Thanks for your answer.

Changing the moment at which the command buffer is added to the pipeline will have no effect if the shader is using the depth buffer to perform ztesting. You should modify SimpleFluid.shader to disable depth testing and/or change its render queue. See:
https://docs.unity3d.com/560/Documentation/Manual/SL-CullAndDepth.html
https://docs.unity3d.com/Manual/SL-SubShaderTags.html


RE: Render ObiSimpleFluidRenderer before everything - rosedev - 20-09-2018

(20-09-2018, 09:21 AM)josemendez Wrote: Changing the moment at which the command buffer is added to the pipeline will have no effect if the shader is using the depth buffer to perform ztesting. You should modify SimpleFluid.shader to disable depth testing and/or change its render queue. See:
https://docs.unity3d.com/560/Documentation/Manual/SL-CullAndDepth.html
https://docs.unity3d.com/Manual/SL-SubShaderTags.html

Thank you! I added 
Code:
ZWrite  Off

and it works now.