Christian Sparks has shared a thorough tutorial on working with trees inside Unreal Engine 4.
Christian Sparks (read our exclusive interview with the artist) has shared a thorough tutorial on working with trees inside Unreal Engine 4. The artist has recently conceptualized and tested different ideas to find out what works in UE4. The experiments were successful, so the artist implemented the results in Woodbound and then decided to show how you can add the system to your game. Here are the source files.
Here’s the beginning of the guide to get you excited:
The first thing that you’ll need is your tree mesh. In the image above, I’ve just used the Sapling plugin in Blender to generate a basic fir tree mesh, which I’ve added a crude set of trunk roots to. (This tutorial is more about the scripting and less about the modeling, lol.) Once you have your tree mesh, there are a few steps we’ll need to follow in order to get the pieces we need:
After you’ve exported your tree mesh, duplicate it and set your duplicate aside, just as a quick backup. Locate a section along the base of the tree, just above where the trunk would begin, and add a 3x loop subdivide, squashing the loops down and placing them at around stomach height for your character on the Z axis. Once you’ve scaled and straightened out your loops, select the middle loop, and delete the vertices. From there, grab the remaining loop vertices, one loop set at a time, and fill in the empty space left using the F key. From there, you can select the top of the mesh in edit mode, and press P to separate the top from the bottom into separate objects, which you can then export as your trunk and tree top, which will serve as your visual objects after your tree has been, “cut.”
Okay cool, we have our meshes. Now let’s get to the fun part; the scripting. I created this project in UE4 4.16. The first step is to create a new project using the First Person Character template. In your project folder, create a folder and name it TreeTutorial. In that folder, make three more folders; Blueprints, Materials, and Meshes. Your meshes and their materials should go in the appropriate folders. In your Blueprints folder, create a Blueprint Actor, and name it something like BP_InteractiveTrees. The editor tree generation and the run-time generation are set up a bit different from each other, but since this is intended for runtime use in a packaged project, let’s start with the event graph.
Make sure to read the full guide here.