Posts: 2
Threads: 1
Joined: Mar 2021
Reputation:
0
03-03-2021, 06:24 AM
(This post was last modified: 03-03-2021, 09:30 AM by EmreO.)
Hi.
I need some help with rendering OBI Fluid and other objects with transparent shaders in URP. I tried different blending options in OBI Fluid renderer, also tried custom transparent shaders with high render queue values for my transparent objects, but it keeps rendering OBI Fluid always after (and over) other transparent objects.
Posts: 6,346
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
04-03-2021, 08:31 AM
(This post was last modified: 04-03-2021, 08:32 AM by josemendez.)
(03-03-2021, 06:24 AM)EmreO Wrote: Hi.
I need some help with rendering OBI Fluid and other objects with transparent shaders in URP. I tried different blending options in OBI Fluid renderer, also tried custom transparent shaders with high render queue values for my transparent objects, but it keeps rendering OBI Fluid always after (and over) other transparent objects.
Hi there,
Blending won't affect rendering order, it simply controls how fragment color is blended with the render target. In URP, the fluid renderer will render by default in RenderPassEvent.BeforeRenderingTransparents + 1.
Open ObiFluidRendererFeature.cs and change the render pass event of all passes in the Create() method to whatever event you need. For instance, RenderPassEvent.AfterRenderingOpaques.
kind regards,
Posts: 2
Threads: 1
Joined: Mar 2021
Reputation:
0
11-03-2021, 09:32 AM
(This post was last modified: 11-03-2021, 09:35 AM by EmreO.)
(04-03-2021, 08:31 AM)josemendez Wrote: Hi there,
Blending won't affect rendering order, it simply controls how fragment color is blended with the render target. In URP, the fluid renderer will render by default in RenderPassEvent.BeforeRenderingTransparents + 1.
Open ObiFluidRendererFeature.cs and change the render pass event of all passes in the Create() method to whatever event you need. For instance, RenderPassEvent.AfterRenderingOpaques.
kind regards,
Hi Jose,
Thank you for your reply. Actually it worked, but this time the refractions gone weird.
It's like the refractions being calculated and cached once at the begining, and never updating after then, like they're static. I tried "BeforeRenderingTransparents" and "BeforeRenderingTransperents -1" and other values as well as "AfterRenderingOpaques". It seems like if the value is 451 or higher, It has correct reflections but rendered on top of all other transparent objects. If the value is 450 or lower, rendering order is correct, but the refractions become weird.
Any help would be appreciated.
Posts: 6,346
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
11-03-2021, 12:20 PM
(This post was last modified: 11-03-2021, 12:27 PM by josemendez.)
(11-03-2021, 09:32 AM)EmreO Wrote: Hi Jose,
Thank you for your reply. Actually it worked, but this time the refractions gone weird.
It's like the refractions being calculated and cached once at the begining, and never updating after then, like they're static. I tried "BeforeRenderingTransparents" and "BeforeRenderingTransperents -1" and other values as well as "AfterRenderingOpaques". It seems like if the value is 451 or higher, It has correct reflections but rendered on top of all other transparent objects. If the value is 450 or lower, rendering order is correct, but the refractions become weird.
Any help would be appreciated.
Investigated this deeper.
Seems that URP updates the opaque buffer right after rendering all opaques, and then immediately starts rendering transparent objects. There's no place "in between", so you either render something together with transparent objects (and get a correct opaque buffer, this is what Obi does by default in URP), or you render together with opaque objects, before all transparent objects but have no opaque buffer available (which is your case).
The only option I see is to render other transparent objects after the fluid, but I haven't tried yet so I don't know how well this will work, or if it will cause some other issues.
Another solution could be to resort to GrabPass or custom blitting (like Obi does in the built-in pipeline) but afaik neither of these can be done in URP. The "opaque buffer" is its alternative to GrabPass, and it does not work in all cases. See:
https://forum.unity.com/threads/the-scri...ss.521473/
Posts: 3
Threads: 1
Joined: Apr 2021
Reputation:
0
20-04-2021, 08:40 PM
(This post was last modified: 20-04-2021, 08:52 PM by korzen303.)
It seems that I am experiencing the same problem with transpaernt objects in front of fluids http://obi.virtualmethodstudio.com/forum...-2877.html
Any other ideas? If this is using a Scriptable Render Pipeline maybe it is possible to add this place "in between" opaques and transparent (isn't it actually BeforeTransparents?)
[MovedFrom("UnityEngine.Rendering.LWRP")] public enum RenderPassEvent
{
BeforeRendering = 0,
BeforeRenderingShadows = 50,
AfterRenderingShadows = 100,
BeforeRenderingPrepasses = 150,
AfterRenderingPrePasses = 200,
AfterRenderingOpaques = 300,
BeforeRenderingSkybox = 350,
AfterRenderingSkybox = 400,
BeforeRenderingTransparents = 450,
AfterRenderingTransparents = 500,
BeforeRenderingPostProcessing = 550,
AfterRenderingPostProcessing = 600,
AfterRendering = 1000,
}
Posts: 6,346
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
21-04-2021, 08:26 AM
(This post was last modified: 21-04-2021, 08:27 AM by josemendez.)
(20-04-2021, 08:40 PM)korzen303 Wrote: It seems that I am experiencing the same problem with transpaernt objects in front of fluids http://obi.virtualmethodstudio.com/forum...-2877.html
Any other ideas? If this is using a Scriptable Render Pipeline maybe it is possible to add this place "in between" opaques and transparent (isn't it actually BeforeTransparents?)
[MovedFrom("UnityEngine.Rendering.LWRP")] public enum RenderPassEvent
{
BeforeRendering = 0,
BeforeRenderingShadows = 50,
AfterRenderingShadows = 100,
BeforeRenderingPrepasses = 150,
AfterRenderingPrePasses = 200,
AfterRenderingOpaques = 300,
BeforeRenderingSkybox = 350,
AfterRenderingSkybox = 400,
BeforeRenderingTransparents = 450,
AfterRenderingTransparents = 500,
BeforeRenderingPostProcessing = 550,
AfterRenderingPostProcessing = 600,
AfterRendering = 1000,
}
Hi Korzen,
Unfortunately, URP does not allow for this afaik. The fluid can either be rendered correctly after all transparents, or before them, but in that case the opaque buffer hasn't been generated yet. Intuition tells that the opaque buffer should be generated between AfterRenderingSkybox and BeforeRenderingTransparents, but that's not the case.
Quote:Any other ideas? If this is using a Scriptable Render Pipeline maybe it is possible to add this place "in between" opaques and transparent (isn't it actually BeforeTransparents?)
We could "fork" our own render pipeline from URP to fix this, but it would no longer be URP. Seems a little excessive to have an entire custom render pipeline, it's not a practical solution.
|