Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Render ObiSimpleFluidRenderer before everything
#1
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.
Reply
#2
(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/Documentati...Depth.html
https://docs.unity3d.com/Manual/SL-SubShaderTags.html
Reply
#3
(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/Documentati...Depth.html
https://docs.unity3d.com/Manual/SL-SubShaderTags.html

Thank you! I added 
Code:
ZWrite  Off

and it works now.
Reply