Easier foliage in Substance Designer

Following up on my recent post about Boolean operations in Substance Designer and modeling functions in general, I noticed that an equivalent to the Lathe operation known from 3D modeling applications would be really useful for procedural shape generation. Also known as the Revolve operation, it rotates a curve laid out in two dimensions around an axis, thus producing a rotationally symmetrical 3D object. Really handy for wine glasses, for example. In the 2D realm, on the other hand, a so to say curve to depth map node could become really useful for foliage. The standard approach is currently to warp a waveform or a shape node output (with the ridged bell pattern applied) into a leaf shape [1] [2] [3]. Wouldn't it be much simpler if we could use the curve node to directly define the coarse outlines of our desired shape? After that we could still use warping or slope blurs to add finer details. 

I implemented a Pixel Processor in Substance Designer that does this curve to depth map transformation, but sadly it is not as user-friendly as I would like it to be. The problem is that I can't expose a curve parameter in my node. The only way for the user to have a curve interface is to create an own Curve node and plug its output into the Lathe node. But the Curve note itself also requires an input texture, and that one has to be a particular one as well. A vanilla Linear Gradient 1 node (no tiling or rotation applied). If you nail this input, my node basically turns your curve into a texture, which you can then mirror to create a leaf shape or whatever you need.

The Lathe node transforms a curve into a depth-texture
 
The Lathe node is used to create a leaf shape that can be tweaked directly by adjusting the curve
 
So let's quickly go over how it works internally. It's surprisingly simple! For every pixel, it just subtracts its x position from its value (both in the range [0,1]). Because the linear gradient in front of the Curve node is expected to increase in value in the y-direction (as it does by default) and values are automatically clamped to [0,1] at the Pixel Processor's output, this operation basically shades every pixel brighter than black whose x-value is lower than the curve's corresponding y-value.
 
 
The Pixel Processor code at the core of the Lathe node. Pretty simple, huh?

That's it! Don't forget to grab the node for free in my store and let me know in case you did something interesting with it!

~David

Comments

Popular Posts