• Register
Antegods Art Update #17: Procedural Plants

As we work hard to make our stonepunk arena action game Antegods a reality, you can stay up to date on our development process with regular blog posts from our design, art and code departments. This time, lead artist Tom will guide you through the creation of procedurally generated leaves in Substance Designer!

Posted by on

Substance Designer

In the previous art update I talked about Substance Designer and how amazing it is. Today I’ll give you some more insights into how this software helps us make randomly generated art.

We asked our Twitter followers whether they wanted to see a tutorial on our generated stone or leaf patterns. With a difference of only a couple of votes, a winner emerged: the leaf pattern! Yeahhh…

For our next #Antegods art blog post, what #substancedesigner tutorial would you like to see? #gamedev #indiegame T.co

— Codeglue (@Codeglue) November 11, 2016

So how did we create those leaf patterns? It’s not easy, as you can see in the below graph. I’ll try to keep my explanations as simple as possible, though!

Step 1: Defining an ever-changing leaf shape

As mentioned in the previous Substance Designer blog post, the ‘random seed’ button is super useful. I decided to use it as the basis for our leaves.

1. Start off with a Shape node, with a scaled down Paraboloid pattern.
2. Use a Splatter Circular node to randomize the amount, scaling, positioning and luminance of the shape. Then, every time you change the random seed, all these settings will be randomized, creating a different shape.
3. Use a Gradient node to convert to a Color mode.
4. The Symmetry node mirrors the image on a diagonal axis. I picked diagonal because then the leaf’s root would always be in the bottom left corner.
5. Use a Levels node to bring the values closer to each other, resulting in a clear and crisp shape.
6. The Grey scale Conversion node changes the image back to grey scale.

Step 2: You’ve got some serious nerves

Now that we have a constantly changing shape, we need to create nerves that come from the leaf’s center. This step contains more sub-steps than the previous one, so it’s harder to follow. Stick with me!

1. Start off with a Shape node again. Set it to Disc, full size.
2. Use a Transformation node to scale the disc into a needle.
3. The Splatter node randomizes the needle’s scale, positioning and rotation. These ones are more vertically orientated.
4. Use another Splatter node to do the same, except these are more diagonally orientated.
5. A little sidestep: create a Gradient map.
6. Use a Histogram Scan to up the contrast and positioning of the gradient. It only shows a horizontal line at the bottom, which will become the details of the main nerve.
7. A Blend node blends the first Splatter node (3) with the Horizontal Line (6).
8. Another Blend node blends the result with the Gradient, making it fade to black at the top.
9. Yet another Blend node adds the Splatter node (4) on top of it, using a low opacity so the diagonal lines aren’t as clear as the vertical ones.
10. A Warp node warps the nerve pattern with a mask.
11. For the mask we use a Perlin Noise Zoom node.
12. From the Warp node (10) we use a Transformation node to vertically mirror and scale the pattern 50% in height. Place it on the top half of the texture. Also move it a bit to the left or right.
13. Again, from the Warp node (10) we do the same thing. Use a Transformation node and cut the height in half. Place it on the lower half of the texture and move it a bit to the left or right. Do not vertically mirror the pattern!
14. The Blend node blends them together. We need a mask to block one half of the pattern to make the other one visible.
15. Use a Histogram Scan on the Gradient map (5) and up the contrast to the max. We now have a good mask for our Blend node. The result is pretty OK, except the main nerve is being destroyed by the Warp node we used earlier.
16. Luckily, we have the Histogram Scan node (6). From here we use a Transformation node to cut the height in half again, and place it on the top half of the texture.
17. Do this once more, but then vertically mirror it and place it on the lower half.
18. A Blend node blends these two together into one big line, placed in the exact middle.
19. We blend this with the result of the Blend node (15).
20. Our leaf shape is always diagonally oriented, so I use a Transformation node to rotate the nerve pattern 45 degrees and slightly scale it so it fits the texture.
21. For the upcoming Normal map I use Greyscale Invert Node to flip the pattern’s values.

Step 3: At long last, a Normal map

Now we have a leaf shape and a nerve system, we can create the final texture outputs of the material. Starting off with the Normal map.

1. This is the final output. Our Normal map is done!
3. First, we want the edges of the leaf to feel rounded off. We use a Height to Normal Blend with a low intensity.
4. As an input for the Height to Normal Blend (3) we take the result of the leaf shape (Step1, Node 6) and connect it to a Blur HQ Greyscale to soften the edge.
5. The nerves also need to be shown in the Normal map, so we grab another Height To Normal Blend, and as an input we grab the result of the nerves (Step2, Node 21).
6. The outcome is way too crisp, therefore we use a Blur HQ node to soften the pattern.
7. We use a Normal Combine node to blend the leaf Normal map with the nerve Normal.

Cool, this is going well! For the upcoming 3 textures, (Diffuse, Specular and Glossiness), we need to have a mask that has all the details combined. In the end, we’ll use this to get something more than just a flat-colored leaf.

1. First things first. I wanted the edge of the leaf to have a different color than the inside, so I took the result of the leaf shape (Step1, Node 6) and attached it to an Invert Greyscale node to invert the values.
2. The Glow Greyscale node makes the white bleed into the Black, creating a soft edge.
3. I pushed the values closer together to get a more defined edge.
4. A little sidestep: I wanted the root of the leaf to have the same color as the edge. Starting with a Shape node with a Paraboloid pattern.
5. Use the Transformation node to change the shape into a needle, rotate it 45 degrees and position it so that is always covers the bottom left corner.
6. Blend the result together with the Levels node (3).
7. Another Blend node adds the nerves (Step2, 20) to the mix.
8. Another tiny sidestep: the leaf could use some stains or spots as extra details. Start off with a BnW Spots3 node.
9. Use a Levels node to push the values closer to each other to define the spots.
10. Softly blend the result over the Blend node where we added the nerves (7). Our Detail Mask is now done!

Step 5: Shine like a Glossiness map

Welcome to the hardest step in this tutorial. The Glossiness map!

Just kidding :)

1. Grab the result of the leaf shape (Step1, Node 6) and attach it to a Levels node to push the white value down.
2. Blend this together with the mask we created in the previous step (Step4, Node10). Set the Opacity to very low.
3. Now add another Levels node to the mix to make the whole a lot darker. (By exposing these values in Unity, we can randomize the amount of gloss of a leaf.)
4. The Glossiness map is done!

Step 6: Wrapping up the Diffuse and Specular

Almost done! Now it’s time to add color to the Leaves!

1. First use a Gradient map on the outcome of the leaf shape (Step 1, Node 6). I’ve picked one of the brightest greens possible as a base color.
2. I used a Hue/Saturation/Lightness (HSL) node to alter the color for the edge and the nerves. (I exposed the values so I can change them in Unity.)
3. I used another HSL node to change the color of the leaf’s inside. (I exposed the values so I can change them in Unity)
4. With a Blend I combined the two, using the Mask (Step 4, Node 10).
5. Here I used another HSL node, again with exposed values. This way we can easily change the entire color palette instead of only the inside or outside of the leaf.
6. A little sidestep: I noticed that the thickness of the colored edge was always the same on each leaf, which I didn’t really like. So I decided to make the leaf a little smaller. I used a Levels node to flip the black and white values of the leaf shape (Step 1, Node 6) (Note: This is also possible with an Invert Greyscale node, just showing two ways.)
7. The Glow Greyscale node bleeds the white into the black.
8. The Levels node pushes the values closer together, forming a rounder shape than before. Creating the perfect mask!
9. Using the Blend node, we blend the colored leaf (5) with absolutely nothing. We do use the just-created Mask so that the leaf is now surrounded by transparency.
10. Our base is now complete, but I wanted something extra. I figured it would be cool if the end of the leaf would have a slight color change. So again, I used a HSL node to alter the colors a bit.
11. The mask we use for this is a simple Gradient Map node.
12. With the Transformation node we rotate this gradient 45 degrees and scale it inside the texture.
13. The Histogram Scan pushes the values closer together, creating a clearer ‘edge’.
14. The Blend node uses this mask to blend the original color (9) with the altered version (10). Giving the texture a more otherworldly feel.
15. The diffuse map is now finished!
16. The Specular map needs to be a bit darker, so we use a HSL node and adjust the Lightness setting.
17. The Specular map is now also finished!

Here are some images of what happens when you change the random seed in Unity, which unfortunately doesn’t change the coloring yet!

Social media