4
$\begingroup$

I want to blend a mesh with the floor by playing with the normals of the object on the contact area. As seen on those two picture a data transfer modifier works well

enter image description here enter image description here

However as soon as we move the object, the effect get stretched. An other important point is that the floor will have a displacement modifier or a displacement node. So Geometry Nodes seems a powerful solution to adapt to each situation.

My first guess was to modify a vertex group using Geometry Nodes and use this modified vertex group in a data transfert modifier but I realize it is not possible. (https://blender.community/c/rightclickselect/79gG/?sorting=hot )

So how can we get a Geometry Nodes setup with a similar effect to the data transfer modifier?

(this question is a follow up to my previous one: shader: separate XYZ relative to object geometry) The goal is to have a Geometry Nodes setup that blend the material + the normal of the object intersecting the ground what ever its position is.

Here is the file containing the blend between material thanks to @Rhaenys

Quellenform provide a good Geometry Nodes only solution. Unfortunately a rim around the object will still be visible.

$\endgroup$
1

2 Answers 2

6
$\begingroup$

If I didn't completely misunderstand the question, it might be possible that you'll be happy with this thing here (Blender 3.1.2+, but it should be adaptable):

enter image description here

Here, everything depends on how finely the mesh is subdivided, since otherwise, of course, only coarse normals can be transferred.

Therefore the following approach:

  1. Since it would be too computationally expensive to finely subdivide the entire mesh, I first apply the Geometry Proximity node to cut out only the portion that is in close proximity to the objects.

  2. Once I have separated this part, I apply the node Subdivision Surface to specifically subdivide this area.

  3. Then, also using Geometry Proximity, but evaluated from the side of the object, I am able to get the distance to the mesh, which I then translate into a range from $0$ to $1$ using the node Map Range (From Min and From Max defines the range here).

  4. This value can then be used as a factor for blending the normals of the terrain and the object with the node MixRGB.

  5. I then simply pass the vector achieved in this way to a Group Output on the Point Domain and give it the name "blend_normals".

    In the shader I can then use this attribute with the node Attribute and the name I gave it before.


UPDATE

OK, this is getting totally crazy here ;-)

I've tried changing the objects now along the overlap, so that not only the normals line up with the ground, but also the mesh itself.

This is a little tricky, and it also depends a lot on the resolution of the terrain, as well as the type of mesh.

In any case, from my tests, it doesn't work equally well with all shapes, and I consider this more of a hack.

Still, the result is quite respectable, and I don't think you can currently do any better with Geometry Nodes (at least not with a reasonable amount of effort):

enter image description here

(Adapted for Blender 3.2 !!!)

Roughly summarized, here's what I do:

  • I first cut the relevant part out of the terrain, so that the computational effort is not unnecessarily large.
  • Then I enlarge the object a bit, so that I can create a slightly larger cut edge on the terrain.
  • I cut the enlarged object with the terrain and separate the upper half from the lower half.
  • I do the same with the original object, but I keep only the upper half.
  • From these three objects I use Geometry Proximity and Map Range to build the positions for the lower edge of the original object as well as the normals.

...I will explain this in more detail in due time, but for today it is enough.

Here is an overview of the nodes:

enter image description here

Have fun with it!

$\endgroup$
7
  • $\begingroup$ I didn't get it to work on the 3.2, the materials blending area follow the ground geometry even if a displacement modifier is used, but the normal blending is off once not in normal debugging $\endgroup$ Jun 18, 2022 at 14:07
  • $\begingroup$ @ponsdeleon Could you please share your Blend file? $\endgroup$
    – quellenform
    Jun 18, 2022 at 14:20
  • 1
    $\begingroup$ @ponsdeleon Ah, OK, that has primarily to do with the fact that the resolution of the terrain is not high enough, and therefore only very coarse normals are transferred. I have updated the answer in which I subdivide only the relevant parts of the terrain in Geometry Nodes (apart from the fact that the point domain should actually be used here).. $\endgroup$
    – quellenform
    Jun 18, 2022 at 17:36
  • 1
    $\begingroup$ @ponsdeleon Please add comments below the answer. No, completely seamless is not possible as long as you do not merge the two meshes or change the object itself. A sphere remains a sphere, no matter how you bend the normals, and the objects have a different topology at the intersection. $\endgroup$
    – quellenform
    Jun 18, 2022 at 19:46
  • 1
    $\begingroup$ @ponsdeleon As I said: you would have to change the geometry of the object, and make the points congruent with the terrain...is that what you want? $\endgroup$
    – quellenform
    Jun 18, 2022 at 19:50
1
$\begingroup$

I was looking for a solution for the same problem and I partially found it through trial and error.

That thread you quoted stating it's not possible to transfer geometry nodes data to vertex groups is inaccurate, It's working very well in Blender 3.1.2 if you use the right settings (somebody even mentioned it in the end of that thread)

You can output any mask by plugging it in the group output node and setting it to "Float" and attribute domain to "Points". In the geometry node modifier tab, you then have to rename the output you just made to the same name of your Vertex Group. You can then use that Vertex group in a Transfer Attribute modifier.

Here's the node setup with the normal debugging.

Here you can pretty much see the whole nodes and modifier setup for the normals

And here's the same view in weight painting (which I haven't painted, it's coming from the geo nodes)

enter image description here

And this is how it looked before the normal blending

enter image description here

This is a rendered comparison.

enter image description here enter image description here

Working pretty well with snowy environments and procedural shading based on normals.

enter image description here

I still haven't figured out how to make something like this work for instanced geometry though, since the modifier is only using the data from the original non instanced rock, and all instances would get the same "blended strip" regardless of their position and orientation.

You can see it here

enter image description here

$\endgroup$
2
  • $\begingroup$ Well done! But you already read that the question was how to solve this in Geometry Nodes, right? ;-) $\endgroup$
    – quellenform
    Jun 17, 2022 at 18:40
  • $\begingroup$ Of course, but since this method was his first guess and he couldn't make it work, I figured it could've helped knowing it's indeed possible. $\endgroup$
    – SirDiff
    Jun 19, 2022 at 14:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .