Obi Official Forum
Help Trying to render bubbly foam - 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: Help Trying to render bubbly foam (/thread-4295.html)



Trying to render bubbly foam - Barliesque - 17-07-2024

I'm working on creating an effect where sudsy white foam pours down from the ceiling to the floor.  Here's a look at what I've got so far:



It's pretty close to what I'm after, but there are a couple of things yet I need to be able to control:  

  1. The total number of particles per emitter seems to be restricted to 1000, making it problematic for the foam to pour down continuously rather than in bursts.  
  2. I'd also like to be able to adjust the shininess of the liquid renderer.  The Obi Fluid Renderer doesn't seem to do anything--I can remove it entirely, and everything stays the same.



RE: Trying to render bubbly foam - josemendez - 17-07-2024

(17-07-2024, 12:11 AM)Barliesque Wrote: [*]The total number of particles per emitter seems to be restricted to 1000, making it problematic for the foam to pour down continuously rather than in bursts. 

Hi!

You can adjust the capacity (among many other fluid properties) in the emitter blueprint. Remember to click "Generate" after changing the blueprint parameters! See:
http://obi.virtualmethodstudio.com/manual/6.3/emittermaterials.html

 
(17-07-2024, 12:11 AM)Barliesque Wrote: [*]I'd also like to be able to adjust the shininess of the liquid renderer.  The Obi Fluid Renderer doesn't seem to do anything--I can remove it entirely, and everything stays the same.

You're rendering both the particles and the surface of the fluid. Also, depending on which render pipeline you're using, ObiFluidRenderer or ObiFluidRendererFeature are used to render the fluid. See:
http://obi.virtualmethodstudio.com/manual/6.3/fluidrendering.html

kind regards,


RE: Trying to render bubbly foam - Barliesque - 17-07-2024

(17-07-2024, 07:40 AM)josemendez Wrote: You can adjust the capacity (among many other fluid properties) in the emitter blueprint. Remember to click "Generate" after changing the blueprint parameters!

Ah, okay. I'd missed the Generate button.  However, after increasing the Capacity and clicking Generate, I get the following error, and the Emitter appears unaffected:

NullReferenceException: Object reference not set to an instance of an object
Obi.ObiActorBlueprintEditor.Refresh () (at Assets/Obi/Editor/Common/Blueprints/ObiActorBlueprintEditor.cs:416)
Obi.ObiActorBlueprintEditor.Generate () (at Assets/Obi/Editor/Common/Blueprints/ObiActorBlueprintEditor.cs:143)
Obi.ObiEmitterBlueprintEditor.OnInspectorGUI () (at Assets/Obi/Editor/Fluid/Blueprints/ObiEmitterBlueprintEditor.cs:32)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass72_0.<CreateInspectorElementUsingIMGUI>b__0 () (at <5d5ebefe97114215928ac1d9cd096522>:0)
UnityEngine.GUIUtilityLenguarocessEvent(Int32, IntPtr, Boolean&)

 
(17-07-2024, 07:40 AM)josemendez Wrote: You're rendering both the particles and the surface of the fluid. Also, depending on which render pipeline you're using, ObiFluidRenderer or ObiFluidRendererFeature are used to render the fluid.

Ahhh, yes.  I'm using URP, so naturally it's the render feature I need to adjust.  Makes sense!

One more issue:  The particles are rendered with hard outlines, like so:

[attachment=2139]

In order to soften those (as seen in the video in my original post) I rendered the particles with a separate camera, to a RenderTexture, and then layered that over the scene with an blur effect in a shader I made.  Unfortunately, using that technique means the foam is rendered without regard for other objects in the scene, as you can see above.  So, is there any way to blur/soften/reduce those hard edges?


RE: Trying to render bubbly foam - josemendez - 18-07-2024

(17-07-2024, 09:40 PM)Barliesque Wrote: Ah, okay. I'd missed the Generate button.  However, after increasing the Capacity and clicking Generate, I get the following error, and the Emitter appears unaffected:

NullReferenceException: Object reference not set to an instance of an object
Obi.ObiActorBlueprintEditor.Refresh () (at Assets/Obi/Editor/Common/Blueprints/ObiActorBlueprintEditor.cs:416)
Obi.ObiActorBlueprintEditor.Generate () (at Assets/Obi/Editor/Common/Blueprints/ObiActorBlueprintEditor.cs:143)
Obi.ObiEmitterBlueprintEditor.OnInspectorGUI () (at Assets/Obi/Editor/Fluid/Blueprints/ObiEmitterBlueprintEditor.cs:32)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass72_0.<CreateInspectorElementUsingIMGUI>b__0 () (at <5d5ebefe97114215928ac1d9cd096522>:0)
UnityEngine.GUIUtilityLenguarocessEvent(Int32, IntPtr, Boolean&)

This is a long standing bug in Unity, when having multiple inspector tabs open the public members of custom editors don't get their initializers called. Resetting the editor's layout (Windows->Layouts->Reset All Layouts)should help.
 

(17-07-2024, 09:40 PM)Barliesque Wrote: In order to soften those (as seen in the video in my original post) I rendered the particles with a separate camera, to a RenderTexture, and then layered that over the scene with an blur effect in a shader I made.  Unfortunately, using that technique means the foam is rendered without regard for other objects in the scene, as you can see above.  So, is there any way to blur/soften/reduce those hard edges?

This is what the fluid renderer does, essentially. However it blurs the particles' depth, then it shades it after the blur: this allows the fluid to correctly intersect with other objects in the scene. You seem to be blurring the final shaded particles, which will cause problems with intersections.

Maybe you could set the fluid renderer transparency setting down, so that it's opaque? See the "Raclette" sample scene settings for reference.

kind regards,