Blender geometry nodes. I want to merge geometry by distance, but preserve normals. How…
- User
Blender geometry nodes. I want to merge geometry by distance, but preserve normals. How can I do that using geometry nodes?
- Assistant
Here’s one way to “remove doubles” (Merge by Distance) and then put back your original shading normals in Geometry Nodes — tested in Blender 4.0+.
- Capture your original normals
- Merge points by distance
- Average the captured normals for each merged vertex
- Feed that averaged normal back into a Set Normal node
––––––––––––––––––––––––––––––––––––––––––––––––
Nodes & links (in a nutshell)
––––––––––––––––––––––––––––––––––––––––––––––––(G) = Group Input
(N) = Normal node
Capture Attribute
• Domain: Corner
• Data Type: Vector
• Name: “orig_norm”
• Value: (N) → “Normal”→ Merge by Distance
• Distance: as needed→ Attribute Statistic
• Domain: Corner
• Data Type: Vector
• Input Attribute: “orig_norm”
• Statistic: Mean
• Result: “avg_norm”→ Set Normal
• Normal: attribute “avg_norm”→ (O) Group Output
––––––––––––––––––––––––––––––––––––––––––––––––
Step‐by‐step in the node editor
––––––––––––––––––––––––––––––––––––––––––––––––-
Add a Capture Attribute node right after your Group Input.
- Domain = Corner (so you capture each face-corner’s shading normal)
- Data Type = Vector
- Name = “orig_norm”
- Plug the Normal node into its Value socket.
-
Feed that into Merge by Distance. Set your “Distance” threshold to taste.
-
Direct the output of Merge into an Attribute Statistic node:
- Domain = Corner
- Data Type = Vector
- Input Attribute = “orig_norm”
- Statistic = Mean
- Result = “avg_norm”
What this does is pool all of the pre-merge normals that collapsed to the same new point, and computes their average.
-
Finally, use a Set Normal node:
- Normal = the newly computed attribute “avg_norm”
This writes your averaged normals into the mesh’s custom‐normal layer so your shading stays faithful to the originals.
-
Plug that into your Group Output.
––––––––––––––––––––––––––––––––––––––––––––––––
A couple of gotchas
––––––––––––––––––––––––––––––––––––––––––––––––
• This requires Blender 4.0 or newer (that’s when the Set Normal node and the new attribute‐statistic workflow landed).
• You might still get hard edges where topology changes drastically; in that case consider also capping with an Edge Split or driving your shading smooth/sharp flags.
• If you already have custom normals on the incoming mesh, you can capture the “Custom Normal” attribute instead of the geometric normal.Hope that helps! Let me know if you run into any trouble getting the normals back. 😊
- User
Set attribute does not exist. Set normal does not exist.
- Assistant
Below is a 100% “Geometry Nodes only” way to merge‐by‐distance and then restore your original normals, using the current node‐names in Blender 4.x:
- Capture the incoming normals into a temporary attribute.
- Merge your mesh by distance.
- Average all the pre-merge normals per corner.
- Write those averaged normals back into the mesh’s custom-normal layer.
––––––––––––––––––––––––––––––––––––––––––––––––
Node Layout (Blender 4.0+)
––––––––––––––––––––––––––––––––––––––––––––––––(Group Input)
→ Capture Named Attribute
• Name: “orig_norm”
• Data Type: Vector
• Domain: Corner
• Value: Normal
→ Merge by Distance
• Distance: as needed
→ Attribute Statistic
• Input Attribute: “orig_norm”
• Domain: Corner
• Data Type: Vector
• Statistic: Mean
• Result: “avg_norm”
→ Store Named Attribute
• Name: normal
• Data Type: Vector
• Domain: Corner
• Value: “avg_norm”
→ (Group Output)––––––––––––––––––––––––––––––––––––––––––––––––
Step‐by‐step in the node editor
––––––––––––––––––––––––––––––––––––––––––––––––-
Capture Named Attribute
- Domain = Corner
- Data Type = Vector
- Name = “orig_norm”
- Plug in the built-in Normal socket.
-
Merge by Distance
- Tweak your threshold until unwanted doubles collapse.
-
Attribute Statistic
- Domain = Corner
- Data Type = Vector
- Input Attribute = “orig_norm”
- Statistic = Mean
- Result = “avg_norm”
This gathers every corner’s pre-merge normal that landed on each new vertex and computes their average.
-
Store Named Attribute
- Name = normal
- Domain = Corner
- Data Type = Vector
- Value = avg_norm
Writing into the “normal” attribute is exactly how Geometry Nodes outputs custom‐normal data back onto your mesh.
-
Group Output
Feed the result into your Group Output.
––––––––––––––––––––––––––––––––––––––––––––––––
A few extra tips
––––––––––––––––––––––––––––––––––––––––––––––––
• If you still see weird hard edges, double-check your auto-smooth angle (Object → Normals → Auto Smooth) or split sharp edges beforehand.
• On Blender 3.5–3.6 the node names are slightly different:
• “Capture Named Attribute” was originally just “Capture Attribute”
• “Store Named Attribute” was originally “Set Named Attribute”
• There is no dedicated “Set Normal” node until 4.0+, so writing into the “normal” attribute is your go-to.
• If you want to preserve existing custom normals instead of the geometric normals, capture the “custom_normal” attribute rather than the built-in Normal.Let me know if you’re still on an older Blender release and I’ll show you the exact node names for that version! 😊
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.