logo80lv
Articlesclick_arrow
Research
Talentsclick_arrow
Events
Workshops
Aboutclick_arrow
profile_loginLogIn

Setting Up Light-Adaptive Foliage in UE4

Rigole Maxime did a breakdown of his UE4 scene Twilight Temple and smart foliage that reacts to lighting.

Introduction

Hi there!

My name is Rigole Maxime, I am a graduate student of Digital Arts and Entertainment (DAE) in Belgium. My main focus is on environment art however I also enjoy doing other things such as creating props and lighting situations. I am currently looking for an internship as a junior environment artist from February to June 2020.

In this article, I would love to talk about my latest scene “Twilight Temple”, how I achieved its visual look and set up the reaction of the foliage to the player's flashlight.

1 of 5

Twilight Temple Scene

“Twilight Temple” is a scene I created in order to show off my graduation work focused on light-adaptive foliage created mainly by using texture bending and animation. Light-adaptive foliage is the foliage that reacts to lighting: the player can move around and shine a light on the plants in order to attract or deter them.

The look of the scene was originally inspired by James Cameron’s “Avatar”, and some games such as “The Elder Scrolls 5” (location Blackreach) and “Subnautica” with its amazing alien-looking plants.

1 of 3

Speaking of the adaptation to light, I wanted to make interactive plants, something used very rarely in games, in my opinion. Their implementation was inspired by the recent A Plague Tale: Innocence: I love how the rats are deterred by the light which helps the player to navigate through the environment.

Scene Construction

I always start out with a very simple blockout. I wanted to create something inside the forest to catch the player's eyes and also be different from the rest of the environment densely packed with plants. To fulfill that role, I thought of a simple entrance into a mysterious temple.

After this, I started asking myself other questions about the scene: What colors can I use to light my scene with? What types of plants should I make for a good variation?

Speaking of the colors, I always like the basic blue-orange contrast which reminds of the colors used in Avatar a lot, but I also experimented with some purple and pink tones in the mid-ground to create a more fluent transition towards the background.

Plants

For the plants, I went ahead and split up my foliage into 2 categories, with each having their own texture group.

  • Opacity foliage: the foliage in this ground will use opacity in order to be used inside the scene in bigger numbers. Everything that doesn't have to react to light could be placed in this group such as the grass, normal fern, bushes, red fern, etc.

 

To make these, I started out in 3ds Max with a plane. The plan was to bake the plants on a texture in Substance Painter and then unwrap some smaller planes on that texture back in 3ds Max in order to create the foliage models.

1 of 3
  • Adaptive foliage: this foliage group uses a material that blends in and out of the flashlight reach and would preferably not use opacity in order to make the shader less complex to compute.

 

These textures are also made inside Substance Painter by baking normal information on them. Unlike the basic shapes for the opacity plants made in 3ds Max, however, these have their high poly leaves sculpted inside ZBrush to create a more detailed look, and they are baked on a plant model instead of a flat plane.

First Decoration Pass

One of the rare things I used from the marketplace is some rocks from an asset pack which I then recolored in order to better fit my scene as well as the ground texture.

Inside the scene, I used the foliage painter to paint in my grass and ferns. Bushes were placed by hand since they were partly light-adaptive plants.

Learn more about UE4's foliage painter tool below:

First Lighting Pass

When the scene had the plants, I made the first lighting pass. Since the scene is so small and has a lot of moving parts, I prefer to keep the lighting dynamic.

For the skylight, I used an HDRI texture from HRDI Haven. The HDRI I picked already gave a nice purple color to the overall scene, and by setting a slightly dense exponential high fog, I managed to get a night time feeling.

The background where the temple was supposed to be was given some point lights with quite a saturated orange color. I also used a point light with a low attenuation radius on my glowing plants (the color is bluer).

Afterward, I just went in and kept on adding more plants while also tweaking the lighting on them and the skylight. The background lights remained the same until I was able to replace the temple blockout with its proper form using new modular pieces.

Temple

For the temple, I decided to make a small modular kit.

To make a trim texture inside Substance Designer I always focus on one piece at a time. Substance Designer is a really cool program and using it is a simple process of trial and error until you get what you like. The most important step for me is to start with the height detail first. After that, you can go ahead and work with the roughness, color, etc.

The modular kit was made pretty quickly in 3ds Max and unwrapped on top of the trim texture.

To learn more about trim texturing you can watch the video by Polygon Academy below. It explains the concept really well:

I experimented with the modular meshes in Unreal until I found a look for the temple I liked.

Scene Fine-Tuning

For the post-process, I firstly increased the saturation of the scene a little as when I looked at a screenshot of my scene on my phone where it was more saturated and realized how much more it popped. Secondly, I changed the shadows to be a bit more blue-tinted. I also played around with the exposure in order to clear out the overall “too dark” look of the scene.

Next came the image effects. I added a subtle vignette and played around with the circle depth of field to get some of that foreground blur (a neat trick to see what your DoF is affecting is by going to show > visualize > depth of field layers). I set the F-stop of my camera lower with the focus on the region around the entrance of my temple. Afterward, I went back to placing more and more plants and doing some final lighting tweaks.

Don’t be afraid to spend a long time on polishing your scene, the final result is always worth it.

Scene Optimization

Another important part of my scene was optimization. There are several things that can be done in order to optimize a scene: by packing textures, using levels of detail, limiting quad overdraw and opacity in general. Lighting can be baked but this will make the game a bit heavier because it has to load lightmaps, but it will run more smoothly.

Light Adaptation

To make the plants react to a player's flashlight a couple of things are needed both asset-wise and in blueprints inside Unreal.

I recycled the first person blueprint inside Unreal to make the player hold a flashlight and made a separate per plant type blueprint that has to respond to the light.

  • Texture change

 

A dynamic material instance is made in the construction script of the plant. Thanks to this, all the material parameters inside the main material can be accessed via the blueprint. One of these parameters is color which determines the location of the texture blend.

Learn more about dynamic material instances here:

The way I handled it in my scene was by shooting a line trace from the tip of my flashlight over a certain length in front of it. Whenever my raycast hits something the location is stored inside X, Y and Z variables. These variables are then converted to R, G, and B values inside my material parameter, that’s why I use color as input.

This color can be fed into a sphere mask node which is really cool because it creates a spherical blend (with fall-off) between all assets that share the same texture (in this case, all the light-adaptive plants). This mask can then be used inside a lerp node that blends the day-time texture with the night-time texture and a black constant (no emissive) with the emissive texture.

Animation

For animations, the plants were rigged inside Maya. I created separate animations for the closing and opening plants and imported them into Unreal.

Inside the plant blueprint, a collision check is done with a cone which is shaped similarly to my flashlight's spotlight reach. When the plant enters the light range the closing animation is played, when it exists - there's the opening animation.

Sound

For me, sound is the cherry on top of a good scene and completes its immersive effect. I mixed together forest sounds, owl noises, ravens, and some weird monster noises. I also added a footstep noise that is played every half a second when the player moves in any direction, some static flashlight noise, and a click sound when turning it on/off.

To finish it off, I also have the plants play a little sound as soon as they are inside the light, something simple like a bush ruffle or a hiss.

Blueprint Optimization

If I hadn’t optimized my blueprints my scene would have run at around 4 frames per second on my laptop (Lenovo Y720), however, I was able to run it at stable 60 FPS. The main thing that was influencing this was my blend sphere - the line trace was shot every tick, the sphere was updated every tick as well, and this was way too fast for the game to handle it smoothly. By limiting those line traces to 30 per second (every 2 frames), the sphere still updates smoothly but does it a lot less frequently.

I also disabled the line traces when the light is turned off and turned the radius of the sphere to 0 so it doesn’t influence the scene.

Conclusion

The end result was a plant that changes its texture when shined upon, followed by animation and a small sound. By creating a few such plants and decorating the entire scene with them, it is possible to make a living thinking environment that makes players look at it twice and remember it instead of simply passing by.

1 of 2

Speaking of my portfolio, this scene is by far my favorite. It pushed every skill I had (from modeling and texturing to rigging and blueprints) and taught me a lot of new things. I learned how to iteratively solve problems and how to manipulate otherwise static assets to achieve a dynamic and intriguing result. And I hope you'll share this excitement with me.

I would like to personally thank Arthur Tasquin for the texture inspiration and Keltic Vermeersch for his invaluable support and feedback throughout the 6-week production of this scene.

Feel free to contact me via Artstation or LinkedIn, I will be happy to chat with you about anything!

Until the next time!

Rigole Maxime, Environment Artist

Interview conducted by Arti Sergeev

Keep reading

You may find this article interesting

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