SDF Presets for Geometry Nodes

After my fairly significant success with my recent metaball test, I decided to take that concept to the next level. So I created a set of nodes to create and manipulate fully fledged signed distance fields.

This system is WAY more powerful than simple metaballs in many ways. For one, more shapes and manipulations are possible, and they are not limited to simple merges. Here’s an example of a simple chess pawn I created:


(In fact, I’m working on a full set! )
Try it out for yourself, and let me know what you think! (and what awesome things you create with it!)

Hopefully there will be more example files and nodes soon!

37 Likes

I think it will be better to add the color inputs to the primitives themselves. You can use color like a 4D vector and combine the color into RGB and the SDF into the alpha. This will save the hassle of connecting extra color inputs and outputs every time you add a new node. Merging color makes sense for union and difference but honestly I am not too sure about intersection.

This is basically MagicaCSG at this point :wink:

7 Likes

Looks awesome. I’ll implement it next time I get the chance!

3 Likes

Zorro, What version is the pawn created with? I am not seeing it in the viewport; it being the pawn. I do see a bounding box of the correct approximate size, though.

Edit: it is 3.3, I see. I, too, am using 3.3 but I see a red line to density from the metaball_cube.

This appears to be the old metaball file. Have you tried redownloading the pawn file from this page?

Also, you may have a version of 3.3 that was built before the volume cube patch. Is the “volume cube” in the add list? If not, you need to download a newer version of 3.3.

By the way, what method of color blending would you recommend? I’ve been fiddling with it a bit and thought I would just ask what you did.

I am using the remapped difference between two SDFs as the mixing factor

2 Likes

Ah, thank you very much. It sure is a lot simpler than my previous solution!

1 Like

Major update!

  • Many changes and improvements to primitive nodes, including color blending.
  • New SDF Recolor node replaces a color without affecting alpha.
  • Align mode on SDF Radial Array node properly aligns copies with the center of the circle.
  • New SDF Instance node uses proximity to place copies at input points.
  • The SDF Boolean node has many improvements, including color blending. New chamfer blending style, and more styles coming soon.
  • New SDF Panel node creates a panel cut on the first SDF, with various options for profiles.
  • New Mesh to SDF node uses proximity and normals to calculate mesh inside.

The file size is just barely over the limit here, so I had to create a new gumroad link. You can now download it for free here:

EDIT: Last minute bug fix. Forgot to implement colors in the SDF Solidify node.

6 Likes

This is really nice to have inside blender. If I had a vote for anything, it would be to have handles on the individual pieces. Controlling location with the sliders is quite tedious for such a quick sketcher of a tool.
Very complete implementation.

The new hair system gives me hope you can find a solution to let us shift-d and otherwise manipulate the metaballs in the viewport.

If I have missed this, please enlighten me.

2 Likes

That would be a difficult thing to implement. To get actual viewport gizmos for nodes, we would have to wait for the developers, or possibly develop a python addon for this. (although I’m not sure it’s possible with the current system)

For now, you can always use an empty to control a mapping node, although I’ve noticed you have to go inside the nodegroup and invert the rotate node.


I’ll find a way to better implement this in the next update.

There’s also the SDF Instance node. It creates copies of the coordinates for each point in the target mesh.

You can use this to make a bunch of verts with shift+d, and move them freely in the viewport. There are a lot of limitations though- you can’t scale and rotate them, and they won’t properly merge with each other.

Sorry I’m unable to give you a satisfying answer for this. It’s not easy, and there aren’t many solutions as of now.

3 Likes

Vex not, my friend. Your work is exemplary.
You’ve said a few things I can try. Recently have been playing with metaball object creation and this is right in line with it. Your coloring scheme is to die for. Wish there were a way to get such beautiful color blending with the built-in system.

1 Like

This reminds me of Organica. I need to look for that disk and see if it will work on a modern pc. Being able to bend the metaballs would be a nice feature.

2 Likes

Thanks for the compliments! Actually, the colors were all @Xeofrios’s idea. I couldn’t have done it without them!

Good idea! I’ll figure out some form of bending and twisting in the next update.

3 Likes

Sorry I didn’t get much time to play around with your file a lot, though I can still suggest you some improvements

  • Clamp the color blending lower bound to >0.
  • In the domain node, instead of controlling the volume to mesh node add the threshold to the SDF.
  • The mesh to SDF node does not work correctly, especially for booleans. This is the setup I came up with-
  • Subtract the cube roundness value from the cube dimensions.
  • Use the second SDF as the factor for color blending when using difference boolean.
3 Likes

Thanks for all of the quality feedback!

Are you referring to the way I use a threshold of 0 and flip the faces afterwards? If so, you are right, it’s a bit messy and should be fixed.

I haven’t had experience with that new field on domain node. Can you please explain what it does?

Ah, yes. That way, you can bevel most primitives properly without affecting the scale.

Oh, that makes a lot of sense. I didn’t notice it before, but the difference blending was weirdly inverted.

Not exactly. But about that I would prefer it if you multiplied the SDF by -1 and set the volume to mesh threshold to something like 0.0001, though it really doesn’t matter. What I was actually talking about was that the current implementation blows up when the threshold is more than 0. I recommended numerically adding the threshold to the SDF and keeping the volume to mesh threshold constant.

It just changes the domain of the attribute plugged into it. Same as capture attribute but not bound to any specific geometry. Very useful for getting spline index, smoothing, edge length etc. In this case for some reason transfer attribute defaulted to using face normal, so I had to convert it to point.

I also noticed that the inside SDF is not defined for the cylinder primitive. In general its good practice have both interior and exterior SDFs to be correct. For example, solidify does not work for the cylinder primitive.

2 Likes

That’s because we are working with negative values. If you want to change the threshold, set it to something less than 0. I could make it more intuitive by inverting the input value though.

Mathematically it should work for both greater and lesser than 0. Using the volume to mesh threshold is not correct in this case.

I guess, I only added the socket so I could expose all the meshing settings to the node. In order to work properly, it has to always be set to 0 anyway. Do you think it’s a necessary setting in the first place?

You can already use subtract nodes to inflate and shrink primitives.