Is there any way to procedurally generate a liquid meniscus effect?

Hey, I’m trying to render a realistic diorama in Cycles.
Is there any way to procedurally generate a liquid meniscus effect on geometry based on intersecting geometry?

Here’s the effect I’m talking about:


And the wiki page on this phenomenon:

I want to avoid doing this by hand as there’s a lot of geometry intersecting the water in my scene.
Thank you!

I can think in two methods to achieve something like this. Neither is terribly hard but none is procedural, sorry.


(Method 1 result)

You didn’t say how you’ll be using the water, if it needs to have good topology for animating or if it can have crappy edge flow. I’m running with the principle you want no animation and the polygon density to be as low as possible, but if that’s not an issue creating the effect will take less work.

Ideally your intersecting objects will be part of the same collection, so see to this before starting.

Method 1: Geometric meniscus

  1. Get your intersecting objects and water plane in place. Subdivide the plane until the faces intersecting with the objects have a good padding. If having a dense mesh is of no concern you can skip to step 3, just ensure you have enough intersecting planes as seen on edges of step 2.

  1. Circle-select (Ctrl+C) intersecting planes and subdivide again. The more subdivisions you do now smoother will be the resulting meniscus. Duplicate your intersecting objects/the collection containing them and merge them all.

  1. Add a boolean modifier to the water plane and select the merged object. You’ll want to use either Difference or Intersect as operation. Apply.

DEMO_fluidmeniscus_booleanmod

  1. When your water plane doesn’t have enough geometry the boolean might fail where water intersects with complex silhouettes. No panic! You’ll correct those manually by selecting the loops that did cut well and the inner loops that didn’t. Use Select Loop Inner-Region to get the faces and delete them. Dissolve the boolean cut leftover edges.

  1. Ctrl+A to select everything, then Select Boundary Loop.

    Depending on your scene setup you might want to treat the puddle edges and the object intersections differently, so deselect the object boundaries by now, add the puddle boundary to a vertex group (for convenience), and scale it slightly with Proportional Editing set to Constant. You’re doing this to ensure the water edges still intersects with the edges when moved on the Z axis. Do the same for the objects. I set the Transform Pivot to Individual Origins to do it only once.

    Select Boundaries again, Sharp Proportional Editing, and move them up in the Z axis. If needed you can smooth the results a bit by using a subbsurf modifier on the water plane.

Method 2: Baking + Displacement

Sorry, no detailed steps for this one because I didn’t test it, but I don’t see why it shouldn’t work. It’s simpler in certain ways and doesn’t radically alter the water plane geometry the way method 1 does, but the execution takes potentially more time due baking and setting up displacement.

  1. Duplicate and merge the intersecting objects, replace their materials with a white material and set your water plane to a black one.

  2. Select the merged objects, the plane (it should be the active object), and do a Selected to Active diffuse bake with only Color enabled to project the silhouettes onto the plane. You might have to tweak settings in this step, so bake on a low res texture first.

  3. Save the resulting texture bake and blur it. I’d use an external image editor instead of Blender as it’s faster for me.

  4. If you intend to use real Displacement either subdivide your plane just like in steps 1-2 of first method or add an adaptive subsurf to it.

  5. Add the blurred texture to the water shader and set it up as a Displacement map. Mix it with other displacement maps and tweak the settings to your liking, adjusting scale, midlevel. Use a ColorRamp to fine-tune the transition if necessary. Don’t forget to set the material to Displacement Only if you’re going this route.

Besides not changing geometry and having more flexibility due being able to adjust the meniscus radius and intensity at later stages one additional advantage of this method is that you’ll have a base map to create other shading effects like decreased alpha/color change where objects are submerged, etc.

1 Like

Hey thank you!
This is fantastic for my needs. I was mostly worried of having to sculpt it in but doing it this way is so much better!
Thanks again! Now I can move forward with the project. :smiley:

2 Likes