SDF Functions

I’ve uploaded a patch that adds SDF functions to the Shader nodes in Blender. The patch is mostly working ok but it could really do with some artist feedback to polish how these functions should be implemented. If you are able to build Blender, please try out the patch. If you have some ideas on how you would use SDF functions that would be great too.

Patch: https://developer.blender.org/D6464

Based on the work of Inigo Quilez. Please see Inigo’s website for further information.

https://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm

2 Likes

I think it should be at least explained in some more clear way, other than reference to unexplained code.

1 Like

I’ve added a link to the first post that will help explain how SDF functions work.

1 Like

Can you explain in more practical terms what such a node will be useful for? With an example node setup?

SDF functions like this are quite useful in the demo scene, but it’s not as obvious they are useful in Blender shader nodes. If we supported rendering signed distance fields as surfaces directly, by using the signed distance for ray marching, then it would make a bit more sense. Right now it feels like a math function made for a use case we don’t have yet?

3 Likes

is this like vdb but in shader ?

1 Like

The current nodes are somewhat difficult to control, and lack some basic functionality like csg and shape blending (you can still do it, but you have to know the math behind it: not very artist friendly) so best i could do on short notice is this shoddy rivet looking shader

I’d love to upload a .blend but the forum software won’t let me.

I admit, its somewhat of a lack luster example, so let me drag in an alternative

Not based on this patch (earlier attempt for an substance like offline texture synthesizer) but based on the same math

for 3D the case is hard to make currently , but given the right amount of spit’n’shine so artists can easily use it, 2D be wonderful to have!

1 Like

Using SDF for ray marching is outside the scope of this patch but having SDF functions available in shader nodes provide a wide range of use cases. It also expands the artists toolset.

  • 2D for texture generation
  • 3D functions for manipulating volume and displacement

Here are some more examples from other software.
https://sparkar.facebook.com/ar-studio/learn/documentation/docs/visual-programming/signed-distance-fields/
https://sparkar.facebook.com/ar-studio/learn/documentation/docs/visual-programming/signed-distance-fields-examples/

2 Likes