Growing a Jungle Environment in UE4
Alexander Cowan did a very cool breakdown, talking about some of the amazing vegetation he created for his ‘Jungle’ environment.
Introduction
My name is Alexander Cowan and I’m from a small Caribbean island called St.Lucia and I have a master’s degree in Interactive Entertainment from the Florida Interactive Entertainment Academy at UCF. For the past few years, I have been back in St.Lucia where I have worked odd freelance gigs and kept up with the latest workflows. While on my tropical island home I started experimenting with capturing textures of all the lush tropical flora I had around me, developed a custom lighting rig and even did some work for the guys at game textures.
The Environment
The guys at GameTextures used several material scans I did for them in a little UE4 showcase scene, it wasn’t anything super complicated but looked cool and was the catalyst for me to start working on a foliage-focused environment. While planning my scene I came across Jeremy Huxley’s
Jeremy had us collect lots of reference to the type of environment we wanted to create and bring it into a style guide. At first it felt like a waste of time to sort through all of that reference, eventually I realized that by doing it this way I was frontloading the decision-making process so I wouldn’t be dedicating time to a poor design and also meant I wouldn’t get stuck spinning my wheels mid-way through the project and possibly not finishing. I wanted tall canopy trees with buttressed roots, those are a staple for every tropical jungle. When I thought about smaller trees I was drawn to shapes of fan palms and how they interacted with light and I could also use these textures for smaller palms have those larger shapes to play off of for my ground layer plants. Along with the sea of green that was ferns and other small plants I wanted to make some sort of flowers, so I could add pops of color to the scene. I settled on using anthuriums which I have seen growing in the wild and they have a wider than expected variation of color and can grow in interesting clusters. Ironically for someone who had been scanning foliage, all of these plants were handmade, sculpted and polypainted in ZBrush and baked and tweaked in Substance Designer. There were some plants I would block out the shapes for in Maya, otherwise, I would just start sculpting from a sphere in ZBrush. After most of the sculpting was done I moved onto polypainting. I tended to make a relatively clean and symmetrical version and then I would make a few instances that were warped differently and had a varying amount of damage and decay and then place those on stems/branches and warp further to get a natural result. I baked these down to a plane in Substance Designer where I could tweak colors and create different masks that allowed me to add details construct roughness maps. Bringing the foliage into substance allowed me to export textures quickly and re-use certain nodes over again, instead of manually having to do it in photoshop over and over. This handmade approach may take longer and not be physically accurate as a scanned texture, but you can make anything from things that you don’t have the scanned assets for to plants on an alien planet for which scans obviously don’t exist. ZBrush was a major part of the workflow and having not used it for a while and never having sculpted plants, it was challenging getting up to speed interface-wise. I was lucky that 4R8 recently came out because using the gizmo to arrange sub tools is easier to than using the transpose tool. It isn’t just transforming objects like a normal 3D program, but the ability to quickly duplicate and deform objects using the gizmo. It comes in amazingly handy when you are placing hundreds of leaves on a branch or a stem. I probably learned the most from creating my canopy texture. The branches were made by pulling points out of a sphere in ZBrush and then dynameshing. It was tricky to get accustomed to but was extremely fast and provided nice organic detail. Then for the leaves, I made a few different leaf sculpts starting with a “perfect” version I would duplicate warp differently and add varying levels of discoloration and decay. Then I made clusters of them on a stem-like in my reference photos and then places those on my branches. When I stepped back and looked at what I had done, it was horrible. The clusters of leaves looked like the same little sticker all over the place. I then started making the clusters look more natural by warping them and removing random leaves. I then realized I wasn’t overlapping the leaves on the branches, so I fixed that, and the texture looked much better. I also kept cognizant of the amount of negative space in my texture. Too little and the tree would look too sparse, too much and the cluster would just mix together in a blob and I wouldn’t be able to generate that nice full layered look, it would also block too much light from hitting the jungle floor which was important for my scene. Most scenes have rocks, but since the course was focusing on foliage we needed to make a pretty versatile rock. I sculpted my rock in ZBrush I made sure it had interesting large and medium shapes and looked good from multiple different angles. I avoided putting in any micro-detail since when this rock was brought into the engine it would rely on a tiling detail texture for the close-up fidelity. In the engine, the rock consists of a unique normal map for the large and medium details, and it has a detail albedo/normal/roughness texture which tiles. I also made detail texture tile more as the object was scaled so the detail would be consistent even between differently scaled rocks. Everyone in the class had to make some sort of focal point or story detail for our scene. I had had my ruins blocked in for quite awhile before I even attempted doing anything with it. I made a shader which blended between a plaster material and a damaged/stone and mortar sort of material. During the class, the foliage was the focus so I left the ruins basic with a nice blend material. After the class, I spent way too much time fiddling with different methods for making the ruins. I sculpted and baked a bunch of stones to alter the silhouette and modeled and UVd the broken edges in a way to minimize seams. When it came to placing the model in the scene, most of the meticulous work I had done ended up covered by ferns and served as a lesson to spend time working on the right things. For the jungle floor, I created a ground plane and exported this from Unreal into ZBrush where I sculpted it to flow more naturally among the larger objects that had already been placed. I then remeshed this into a lower polygon count and re-imported this back into Unreal. This is how Jeremy covered it in the course material because building and applying a shader network, was easier to do on a static mesh than terrain but object, but we were free to use whatever method we were most comfortable with. I left applying the textures to my floor rather late in the process. In Substance Designer, I made 4 different types of materials for the ground. There was a muddy ground material, a rocky material, a loam/fallen leaf material and a grass/moss material. My grass material was really a moss material but the way it was made could pass for either. The other materials all built off of each other, first I generated some rocky sort of shapes and then blended them into a mud base. With the mud, I used the same rock shape generator but at a much smaller scale to have pebbles sunk into the mud. For the loam texture, we imported a few of the alphas of leaves we had already created and scattered them along the surface in different layers so we could build up the organic material. I do think that these textures could be pushed further, but this was a case where they were good enough and I didn’t waste time agonizing about small details that probably won’t be noticed in the end like I ended up doing with the ruins. For the initial blockout, I used the larger objects like the trees and rocks to get a feel for the scene. These weren’t even textured or fully fleshed out modeling-wise, but it was important to get the larger forms looking good. As I completed my first plant type I tried to place them and see how they would look, but there is only so much you can do with 1 plant, but this led to a happy accident. I had been messing with the slope settings in the foliage placement tool and decided to try to make these plants grow on walls, it looked strange at first but when I set a low value for aligning max angle, I got these awesome looking plants growing up and around the trunk of a tree which I ended up making a focal point of the scene. Now this isn’t very optimized since my plant was radial in design there were always going to be a bunch of leaves intersecting the trunk of the tree and I needed to delete the stems of the original plant model, but you couldn’t beat the visual payoff for such a quick and dirty method. When my library of plants was built up I started all over with placing foliage. Placing the larger plants like the palms first and progressing smaller attempting to create more visual interest. As I placed more plants, I realized the scene came to life when I placed flowers and plants with dead or dying parts avoiding the monotone sea of green. I had to consider this with reference to my fan palms. Much of the images I did have, showed plants in botanical gardens that are well manicured. My scene was supposed to be quite wild and simply adding dead palm fronds hanging off those trees gave them a more interesting shape, and color variation and added to the believability even though my scene and most of the assets in it are quite stylized. I used this effect making a quick and dirty dead version of my fern which I used to drape over the edge of the ruins and from ferns that were growing on the sides of trees. I used a few different methods to get variation in my plants, mostly I painted dead bits directly into the texture but on something like my Kapok canopy texture that wasn’t practical with so many leaves. I did make different versions of leaves that from a distance ended up looking similar and blending together. I baked that mesh in substance designer with a mesh ID mask using the random option and I converted it to greyscale and used that as a mask to blend between a browner version of my albedo and could simply rebake if I didn’t like how the mask looked. On larger assets, I got a lot of mileage out of blend textures. My ruins shader blended between a 2 material sets as I mentioned before, but I also blended in moss and lichen. I used this moss and lichen shader on all the larger assets like the rocks and tree trunks. This not only allowed me to vary the look but to ground the scene better, having moss painted into places that would be damper than others or as a base that ferns or other plants could sit on. Since most of my foliage was hand-painted and not strictly PBR values, I had to tweak things on the fly but this was easy with substance designer being a hub for all my exporting. An important aspect of my scene was having that translucent leaf effect. I used the built-in 2 sided foliage shader to achieve this and made masks for certain textures so things like tree branches wouldn’t be shaded as translucent. Technically the lighting setup of the scene is very simple, it is baked down using lightmass with a single directional sunlight and the number of light bounces increased a bit. More importantly, I am using volumetric fog which adds a lot to the feel of the scene since most of it isn’t lit directly. The streaks of light through the fog create a cool dappled lighting effect on the jungle floor and looks even better in motion after I added some simple vertex wind to the plants. Towards the end, I added a post process volume that upped the saturation and contrasts a bit for my final images. The whole scene runs in real time in UE4 and while it was intended to be a high fidelity showcase and it runs well on my pretty decent machine, but there were some foliage specific optimizations that I kept in mind when building my assets. A real killer of foliage heavy scenes is overdraw, which is the area where blank space on foliage cards overlap. I tackled this by spending a few more polygons following the silhouette closely to avoid as much empty space within reason. My plants were for the most part quite low poly so I didn’t bother doing any LODs, but in production, I would end up doing them, especially for the short ground plants which would typically be obscured at a decent distance anyway. I appreciate being able to share my scene with you guys and hopefully, I have more scenes to share with you in the future.Planning
Workflow
ZBrush
Creating the Canopy Texture
Rocks
Ruins
Jungle Floor
Composition
Dead Things & Variation
Lighting
Optimization