0
$\begingroup$

I'm trying to reconstruct a mesh as an SDS, and, frankly, it's a pain.

Is there any way to visualize the distance between two meshes? What I'd really like is something that would compute the shortest path from every vertex of one mesh to the closest point on the other mesh and display that as a "heat map" so I can tell how closely I'm approximating the original.

I know there's probably a way to sort-of do this with displacement baking, but that's way too slow to be useful. I need something more like a real-time version of this, but one that can have much lower resolution.

Is it possible to calculate the distance between the vertices of two objects in Geometry Nodes? seems relevant, but it's not solving quite the same problem. That question asks about the distance between corresponding points. I just want the closest distance between two surfaces (which have very different meshes).

Note: I also asked about automatic ways to Fit subdivision surface to existing mesh?, but it seems there aren't any.

$\endgroup$
6
  • 1
    $\begingroup$ Does this answer your question? Is it possible to calculate the distance between the vertices of two objects in Geometry Nodes? $\endgroup$
    – Chris
    Commented Sep 4, 2022 at 3:43
  • $\begingroup$ @Chris, no, or at least it isn't working. For one, there is no "Distance" geometry node. $\endgroup$
    – Matthew
    Commented Sep 4, 2022 at 14:34
  • $\begingroup$ the distance node is a vector math node...then choose distance $\endgroup$
    – Chris
    Commented Sep 4, 2022 at 15:43
  • $\begingroup$ @Chris, ah. On closer inspection, however, while the information there is relevant, I don't think it's trying to solve the same problem. That question wants the distance between corresponding points, not the closest distance (which would give a very different result!). $\endgroup$
    – Matthew
    Commented Sep 4, 2022 at 15:51
  • $\begingroup$ ok, i didn't try that out, but if you choose "nearest" in the transfer node, wouldn't that be the result you want? $\endgroup$
    – Chris
    Commented Sep 4, 2022 at 15:56

1 Answer 1

0
$\begingroup$

The answer in Is it possible to calculate the distance between the vertices of two objects in Geometry Nodes? is useful, but not trying to solve exactly the same problem. It's also missing a critical step that threw me off until I stumbled on a video that bothered to mention it.

Here's the almost-final node setup I ended up using (note that this is a geometry node graph on the left, shader node graph on the right):

pipeline

There's one critical step, which is that the geometry node's notion of attribute names is not the same as the shader node's. To address this, in the Modifier Properties, look in Output Attributes. When you first create these node graphs, the output node will show in this list with its geometry node name in uneditable text on the left, and an empty text field on the right. This allows the output attribute to be assigned to an existing attribute (e.g. vertex weights, or if it was a vector, UV coordinates), or to a new attribute. To do the latter, type a name in the text field, which should cause the pop-up to show the name with a '+' icon in front of it. Click this to create a new attribute.

One note: I took this screenshot before realizing that Blender unfortunately does not produce signed distances (at least, by default). Thus, the shader Map Range should be from 0 to whatever value makes sense depending on your needs. (For me, since I'm trying to match an existing surface, I want a fairly small value, although the 0.01 shown might be a bit much; 0.05 would probably be more reasonable. But it will depend on how picky you are and the scale of your models.)

$\endgroup$

You must log in to answer this question.

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