# Coral reef - How to blend scattered instances

I'm trying to recreate the surface of a coral reef, and I would like to experiment a little with geometry nodes.

My result so far, I just do a Distribute points on face, and Instance on points.

My main issue is that I want to preserve the green area of an instance, and cut/merge in the red area, so it doesn't obstruct the green area of the instances. But I didn't found a workaround to do it.

Any tips?

Source file

Best regards, Samih.

• Very interesting question! There is definitely no simple solution here. Maybe someone (me?) has a little more time to take a closer look... Would it be possible to share your blend file in the meantime so we don't have to recreate the shape somehow? Commented Jul 8, 2022 at 9:47
• @quellenform I edited my question with the blend file, thanks a lot Commented Jul 8, 2022 at 10:12
• but you know that you can increase the distance min of the poisson disc so that it won't happen? Commented Jul 8, 2022 at 10:23
• @Chris As I understand it, this is about the transitions (cut edges) of the individual corals. Or not? (st4.depositphotos.com/39212402/41061/i/1600/… and thumbs.dreamstime.com/z/harte-koralle-85967451.jpg) Commented Jul 8, 2022 at 10:30
• i have no idea.... :D Commented Jul 8, 2022 at 10:31

Instead of deleting overlapping parts that results in heavily calculated mesh (the boolean version) ... could be more efficient to start from scratch - build base pattern structure and model coral element from cell by extrusion.

I was aiming to quellenform's reference ...

Here a quick test based on Voronoi pattern ...

The core of this pattern is based on Fill Curve node and Dual Mesh. Object border and way of points distribution can be done in many ways. Usually I would use Distribute Points on Face > Poison Disk, but here I used more even pattern from Grid + Random offset.

To keep just cels un-cut by object border disable Keep Boundaries in Dual Mesh node.

Than you can set several nodes Extrude and Scale to shape coral element ...

Subdivide, Distribute Points, Shade Smooth, ...

To animate egg release (mentioned in comment) you can probably easily animate last Scale node value. To randomise it probably ask a new Q (I'm not sure about good solution.

Just don't forget to add Delete node with Top socket of Extrude node as Selection.

• Very cool! I like this approach! I think this is another important step towards the solution.. Since you can select certain areas (rings) by extruding here, it may be possible to transfer the fine structure to the mesh in the process. ...just as an idea. Commented Jul 14, 2022 at 16:58
• @quellenform Yeah :) I like it too ... but it seems to be over my primitive skills ... it is waiting for you ... when you wouldn't be far, far a way :) Thanks Commented Jul 14, 2022 at 19:51
• By the way, thinking about it, I wouldn't really call what you're showing "primitive skills". In my opinion, it's a pretty decent piece of creative mastery. Just saying. Thumbs up! Commented Jul 14, 2022 at 23:09
• Stunning work. Perhaps some variation on this for your q. re. shaping with Float Curve ? i.e Extruding by 0 height, and then making Z some function of [distance from dual mesh before extrusion] Commented Jul 19, 2022 at 18:48
• really great work and answer, well done mate!! +1 Commented Jul 20, 2022 at 9:04

I just want to show you the current progress, so that you don't think I'm just talking nonsense.

Of course, this is not yet a full-fledged answer to the question, but only a small teaser.

...Please have a little patience with me, the task is a little more complex than I thought.

But this much I can promise: It will be 100% procedural and super flexible (I hope):

...yes, and the node tree will grow big

...and yes, even the fine structures can be created here with Geometry Nodes. I'm curious myself how this will look with a good shader.

• Due to the low number of upvotes, I unfortunately see no reason to complete this answer, and as usual publish the blend file.... So this time these screenshots will have to suffice as inspiration. Commented Sep 15, 2022 at 22:16

## version Boolean

You can try create a coral without a hole and Boolean hole after distribution.

Just since Boolean it would be probably calculation heavy :)

Note: Min Distance for Poison Disk distribution helps prevent overlap inner(higher) ring.

## version Material-Transparent

Much lighter would be to hide those obstruct parts of mesh by assigning Transparent shader to those faces.

Before

After

Factor saying what faces will be transparent ...
You can use Circle object (filled with tris), scattered at the same places as Corals. For that purpose I created node Group from your node tree and duplicate it. Like that it is easier to keep scattering corals and circles synced when you change some scatter parameter.

Use Circle object as Target in Geometry Proximity node. This node assigns values (attributes) to each scattered coral's vertex depends on Circle's face distance (at Spread Sheet window you can see those values under Mesh > Face Corner).

These values can be translated into Black&White mask and used as factor for mixing Solid and Transparent Shader.

Plug Distance socket into Group Output node. I call it "Hole", but can be anything. Under Modifier Properties expand Output Attributes and name it this attribute (I used "Mask").

Switch to Shading layout. In Shader Editor add a Material and add Attribute node. Use the same attribute name used in GN (in my case "Mask"). If you plug Fac socket directly into Material Output > Surface socket you can see darker color at centre of each coral., but since this color is generated by Circle object, darker are also obstruct outer parts of coral lying in area of circles. To contrast this factor I used Math node > Greater Than

... but now we have transparent also whole centre of coral element. To avoid it I created a second material and assigned it to this centre part of coral that we don't want to be affected by transparency. For this simplicity and better illustration I used just bright pink color.

Anyway ... even you solve obstructing parts corals elements wouldn't be blended seamlessly as seen on screens). So, you should consider to start from some pattern or low res to be be able blend it in a process.

• Hi, the thing is that I want to animate the center area (like eggs that pop out from holes), and I can't achieve that with mesh booleans. Commented Jul 8, 2022 at 15:59
• I can check that issue, but main Q still remains -Would your computer handle boolean calculation? Isn't the Material version with Alpha better choice? Also Your Q is aiming to parts inside a holes, but quellenform's reference reminds me another issue your approach cant handle -blending parts of cells out of holes. It sounds to me you should start completely from different side ... like some voronoi pattern? Probably would helpful real image of your goal. Thanks Commented Jul 9, 2022 at 21:22
• I'm far, far away from a computer with Blender right now, so I can't work on this wonderful question any further, but I think you're absolutely right: you'd have to approach this from a completely different angle. I was also thinking of a Voronoi pattern, and you would have to work more from the outside in towards these shapes, but the more I think about it I come to the conclusion that Geometry Nodes or Blender are not the right choice for the task at all. This is more a task for Houdini because of the complexity... Commented Jul 9, 2022 at 21:38

So I decided to take part of the idea of Vklidu. But the idea with material looks viable I think.

From the voronoi pattern, I instantiate points on mesh faces, and I scale the size of instances based on face area. Also, I adjust my model a little bit to avoid overlapping.

We can still see some overlapping, but since it's outside the camera, It's okay for me.

It would be great to merge vertices only where instances are intersecting, so it gives a more organic look.