1
$\begingroup$

I'm currently playing with geometry nodes in Blender 3.0.0. I have a plane and in Geometry nodes I first scattered some points and then using a Geometry Proximity node to measure distances to the nearest of these points and finally deforming the surface around those points (sinusoidal function) to create some "Pores". That works fine.

The problem is: I also wanted to colorize the deformed mesh according to the actual depth of those pores. Therefore I connected the distance output from the Proximity node to an output socket (also tried other values, e.g. the actual depth). Now it looks like the values received by my shader nodes are not the ones actually calculated in the Geometry node while deforming the mesh, but they seem to be calculated by a second run(?) where the mesh is already deformed. In my screenshot below, the pores should be bright yellow in the middle and turning to red with higher distances. What I see instead is that the deeper parts of each pore are also red and AFAICS that is because they are moved away from the scattered points. The problem is reduced if the pores are extremely flat (see second screenshot), but that's not a solution.

Why is it like this and how could I achieve what I am looking for (preferably without using a second non deformed copy of the same mesh just to calculate the proximity again) enter image description here enter image description here

What I have tried so far was e.g. to first output to a vertex group and create an attribute actually readable by the shader Attribute node only by a second Geometry modifier. But the effect stays the same.

Edited:

Corrected version using a Capture Attribute node as suggested in the accepted answer: Corrected Geometry nodes workflow (Additional change: I now use the actual displacement for the color, not the distance to the next scatter point)

Edited II:

If someone is interested in the results (still work in progress, but already quite close to what I was hoping for): enter image description here Left without, right with pores (and some pimples) created by Geometry Nodes as described above with a few improvements (render: Eevee). I'm using the depth in my material nodes to make the skin a little bit darker and reduce subsurface scattering in those pores.

$\endgroup$
2
  • $\begingroup$ Would u provide blend file? So we can check it out… $\endgroup$
    – Chris
    Commented Dec 31, 2021 at 17:25
  • $\begingroup$ Added blend file, see above... $\endgroup$
    – Patter
    Commented Dec 31, 2021 at 17:50

1 Answer 1

1
$\begingroup$

As indicated by the dashed noodle, the 'Distance' pipeline is a callback. It's a function, ready to be called with whichever parameters it's given. You have to read the tree backwards to figure out what those parameters are.

enter image description here

The routes marked with blue boxes in the illustration show the 'Distance' function being called on the geometry entering the Output node, which is deformed. That's your current situation, simplified a bit. The 'Distance' is from the points to the deformed geometry.

The routes marked with green boxes in the illustration show the 'Distance' function being called on the geometry entering the Capture Attribute node, which, at that stage, is not deformed. The 'Distance' is from the points to the undeformed geometry. It's captured at that stage, and passed on to the output.

Here's a shader mixing the two different distances:

enter image description here

.. and this is the difference.. (the solid red being the distance from the points to the plane while it was still flat):

enter image description here

$\endgroup$
2
  • $\begingroup$ Thank you very much for the detailed explanation. Using a Capture Attribute node indeed solved my problem. Geometry nodes provide so many possibilities but I realized I have also a lot to learn :-) $\endgroup$
    – Patter
    Commented Jan 1, 2022 at 17:18
  • $\begingroup$ @Patter So do I :\ ... $\endgroup$
    – Robin Betts
    Commented Jan 1, 2022 at 18:50

You must log in to answer this question.

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