Creating a Leaf Generator in Substance 3D Designer

Şeref Atilla Gürbüz shared the workflow behind the Leaf Generator, showed which nodes were used, and demonstrated how colors were blended to make realistic leaves. 

Introduction

Hello everyone, I am Şeref Atilla Gürbüz. I am a 3D Environment and Props Artist based in Istanbul, Turkey. I have a background in Architecture and Computational Design and love tinkering with algorithms and nodes while practicing my art.

I started 3D back in 2018, but it took me a while to land a real job in the gaming industry. Currently, I have been working at Leartes Studios for more than a year. For personal and professional projects, I use different node-based software to speed up and enrich my workflow including Blender's Geometry Nodes, Substance 3D Designer, and Unreal Engine's Blueprints and material shaders.

The Leaf Generator

I always try to work on personal projects with different scales in my free time, and the leaf generator was a small side project I created for an environment. At that time, I was working in a Mediterranean-themed environment and I needed different kinds of foliage elements. I started to gather references for the different kinds of plants I wanted to make and I quickly realized it would take me quite a while to create all of these different leaves by hand. I checked some online resources and saw lots of great procedural leaf generators made with Substance 3D Designer such as Sherif A. Dawoud’s leaf generator. To address my needs and expectations for the leaves, I started to create a leaf generator for my project.

Shape Generation

Firstly, I wanted to have some flexibility in the main shape. The leaves I had in mind had different widths, lengths, jaggedness, and angles. In Substance 3D Designer, I had been using a curve node followed by a cross-section node to get organic shapes quickly and easily. I usually just trace the contour lines on a Curve node’s graph and connect it to a Cross Section Node to create a 2D image. However, this method has two downsides. One of them is that you can’t have complex shapes such as cardioids or elliptic curves. Using a Directional Warp node after this point is the easiest fix for having some turning points on the shape. Another limitation is the points on the Curve node’s properties graphs are not exposable as a parameter. To have parameters that give the form, I had to create the curve using Pixel Processor and connected it to the Cross Section node.

To create the parameters I want, I had to experiment with the curve’s function. For creating and experimenting with numbers, I use and recommend online graphing calculators. They are super straightforward to use and give you the outcomes immediately, so I decided to use Desmos graphing calculator before deep diving into Pixel Processor. I did some experiments with the sinus curves and finally reached a formula that gives me some flexibility by changing the values a, b, and c.

(1 – (cos(πx)ᵃ))ᵇ ∙ c > |y|

I get a Gradient Axial node and connected it to a Skew Grayscale following a Pixel Processor. Then I recreated the same formula inside the Pixel Processor and fed it to a Cross-Section node.

Margin Generation

After the main shape was created, I focused on the margin of the leaves. I applied two Directional Warps to the main shape, but each of them used gradient linear with vertical tiling to have different scales. The first Directional Warp determines the main indentations on a larger scale and the second Directional Warp adds details on top. I also blended warps with a gradient starting from the tip to the petiole of the leave so that I could control the teeth’s position. On one side of the leaf, the Directional Warp created pointy results whereas, on the other side, it created more circular results. Using a simple Mirror node, I could easily switch between pointy and circular teeth shapes.

Venation Generation

At this point, I was looking for different kinds of leaves online and it was critical to have a wide variety of venations. Through tens of different venation types, I decided to choose some that are the most common.

The veins on the leaves create a network with various flows. Among all the different vein formation types, I decided to go with the Palmate, Parallel, Pinnate, and Reticulate types. Palmate types start from a small focal area and diverge from there. Pinnate and reticulate types form a network through horizontal concave or convex lines. Parallel venation type goes vertical not intersecting each other. To create different venation types, I arranged axial and radial gradients and used Quantize Grayscale nodes followed by an Edge Detect. 

To create secondary and smaller veins in between, I used a tile sampler that populates lots of small disc patterns on traced leaf and vein paths. Then I used a Distance node to determine the network between the veins. I also added two extra Distance nodes and a Warp node to create a much smoother and more natural system. Finally, I combined the secondary veins with the main shape using a Blend node.

Folding

Next, I decided to add some folds on the leaves. This part was a bit tricky because I already had a parameter to flip the leaf. The folded part also flips with the leaf and visible parts change depending on which side of the leaf is on top.

To fold the leaf on a line, I used a custom Mirror node I previously created. That node allows you to flip an image on a line that you can specify with two dots. I used a Histogram Scan node to create a black-and-white mask of the leaf and then mirrored that mask to create fold masks. I also mirrored the height map and blended it on top of itself by using a Blend node with the newly created mask.

Color Generation

Until this point, I kept researching the leaves and how they develop in nature, so I didn’t want to change my path when creating the base color. That’s why, instead of a basic color selection, I tried to replicate the pigment colors that leaves have. I created four different gradients for four different pigments: Chlorophyll (Green), Carotenoid (Orange), Flavonoid (Yellow), and Anthocyanin (Blue-Purple). Each pigment's color range was determined by a Uniform Color node, connected to a gradient map node with different color ranges. Then I connected these four gradient maps to a Pixel processor, in which I blended the colors together.

Inside the Pixel Processor’s graph, I simply multiplied each pigment by its intensity and averaged all four of them. Leaves have different amounts of pigments throughout their life span and especially when they get old, they tend to get darker and start to lose their color. I converted this RGB color mode to HSV color mode and separated hue and saturation from the value using a Swizzle Float 2 node. By converting it to HSV color mode, I created a parameter to determine its value and lightness. This way, I could specify the total amount of pigment on the leave and could easily brighten or darken a leaf with the exact amount of each pigment.

After getting the main color, to have more variety on the leaf, I used Ben Wilson’s Color Variation nodes as a starting point. It helped me to have value and hue variations on the leaves based on some noises I provided. Afterward, I kept blending details such as veins, dirt, and damage on top of each other. For the folded part and the different sides of the leaves, I used darker values by using an HSL node.

Conclusion

It’s always hard to start something that has hundreds of different types. Creating a leaf generator was not easy for me. My advice to everyone trying something similar in Substance 3D Designer is not to hesitate in experimenting and to improvise from time to time. Substance 3D Designer is a great tool for creating procedural and parametric things and it can be even more powerful with Pixel Processor. Just keep checking other artists’ way of using math in Pixel Processor, scroll through the lines of codes for shader arts on Shadertoy or try to reach some curves and shapes in Desmos.

There are lots of great online communities on Discord and Facebook as well. For people that are interested in using more Pixel Processors in their workflow, I strongly recommend the "Inside the Node" Facebook group (also available as a channel in the official Adobe Substance Discord). Reach out to people to evaluate your ideas or try to have some new ones.

The leaf generator, including the SBS file, is free for everyone to try and download on my ArtStation store. You can always reach out to me for any feedback or questions. Also, there’re lots of other amazing leaf generators on the ArtStation marketplace made by other talented artists.

Thank you for reading the breakdown article. I hope you enjoyed reading this as much as I did while writing it. Also, thanks to 80 Level for giving me the opportunity to share my workflow. Cheers!

Şeref Atilla Gürbüz, 3D Environment & Props Artist 

Join discussion

Comments 0

    You might also like

    We need your consent

    We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more