HappyTrees Tree Generation
Category: Projects |
Date: November 2024 |
Platform: PC
Overview
A tree procedural generation tool - easily create simple, fun, stylized trees.
Created in a team of 2 for Mythica's Canopy Crafters competition using Houdini and Unreal Engine.
api.mythica.ai
Awards
Mythica Canopy Crafters: Best Stylized
Art Direction
The goal of Mythica's competition was to make a large open-source resource for game developers to access different types of tree generator HDAs. We noticed a lot of the other participants were focusing making more realistic style trees, and so we decided to make what wasn't there yet: to make something fun and cute that could fit in smaller, more stylized games. We had three goals: cute, easy to use, and well optimized.
For reference, we opted for very simplified trees with the silhouette as the main focus. We decided to keep things very simple because of the limited timeframe, which could also fit perfectly with our vision.
Procedural Generation
We created the initial tree shape and leaf mesh within Houdini, which was then exported to Unreal as an HDA. The materials were created in Unreal by me to bring the vision to life.
The main tree structure uses an L-System. The parameter swaps out which rules the L-System uses to provide variations in the tree structure. Most of the randomization comes from the random seed parameter so that it's quick to iterate through a bunch of different trees in a short time period, and the user can select a dropdown parameter to switch between two different tree types (a taller, straighter tree and a shorter, rounder tree). The tree randomizes its branches rotation and curving to iterate through a bunch of variations quickly. I worked on this and the shader, while my teammate worked on the generation of the leaf mesh.
Shaders
I really wanted to give our trees a lot of fun colors to stay true to its name. Happy trees blowing in the wind...
For the leaf shader, I started out with the texture itself. It's just a couple of leaves painted onto a texture, and each texture is projected onto every face of the leaf mesh, then scaled to give the tree a bushy feeling. The parameters are adjustable for if you'd prefer to have a thinner, sparser tree or a thick leafy tree. I started out using the emissive color to give the leaves a light and airy feel, but really disliked the lack of shadows and their inability to be used at night. So, instead I switched to a subsurface shading model and adjusted the colors using color ramps and hue adjustments in order to retain the airy, glowy feel while staying consistent with the time of day. The hue shifts a bit in the shadows to make the color feel more three-dimensional.
Then, the wind: using a SimpleGrassWind plugged into the vertex offset, the leaves softly sway in the wind (which can be adjusted with parameters). This touch is what brings the trees to life.
The bark texture is just a simple painted effect in Photoshop to give the simplified trunk a bit of texture and color. There's parameters to change the lightness of the material, allowing for different variations for different types of tree species.
These are presets I created for using the trees, so that others using the materials would have some presets to work off of and then could adjust further to their own liking. There's 5 different color choices and 3 different bark choices to choose between!
HDA to Unreal Implementation
After we created the HDA, I found myself frustrated with how slow it was to create trees using Houdini's base HDA to Unreal implementation. You could only make one tree at a time and had to wait for it to load every time you changed a setting, then move the HDA and do it again.... I decided I was tired of it, and so on a whim I decided I would script a tool to make it easier to use (to fit our 2nd goal, "easy to use.") I created this tool at the last second that allowed for a couple things to make tree generation easier: you can click to place a tree anywhere you want, you can quickly iterate between dragging parameters and recooking (it's well optimized so the cook loading time is fast), and you can switch to a new tree quickly and easily. It also gives the ability to bake all of these different trees at once after placing them all to your liking. It also makes it much easier to select materials for the trees to use.
Overall, I think we achieved all three of our goals in creating this project and I'm really happy with how it ended up. I also ended up using these trees in one of my other projects (GoCones) and it ended up fitting perfectly with the vibe of the game, which was not intended but I'm really glad it worked out that way!
Project Credits
Created by Endlessette Osborn and Mikyle Mosquera
api.mythica.ai