Kimmo Kaunela did a breakdown of his Western Desert environment pack that includes over 200 models, materials, dynamic day/night cycle, rain option and more.
Kimmo Kaunela did a breakdown of his Western Desert environment pack for UE4 that includes over 200 models, dynamic day/night cycle, rain option, 4-layer tessellation landscape material with triplanar mapping and more. The scene is available for purchase.
Western Desert Town Pack
I have always wanted to make a western themed environment. I didn’t have time to take part in the ArtStation Wild West Challenge but I slowly started to block things out during my free time. My previous projects have taught me a lot of new techniques so I wanted to test all of that in this one.
My goal was to get good lighting both for exterior and interior areas. I also wanted to figure out a system that might speed up the building creation process with the help of UE4 blueprint system. Finally, wrap everything with a huge desert biome.
Working on Materials
Materials are always something I really like to focus on. I needed to have very dynamic materials because a lot of things in this environment can change. That is why I wanted to have control for damage, different color variations, age, and wetness/rain.
Textures are very important in order to get materials to look right and I made all of the texturing in Substance Designer. A lot of building materials are using the same tiling textures so I wanted to spend enough time to get those looking right. I also wanted to avoid using too much unique details in tiling textures because buildings have large walls and it could be fairly easy to find those patterns there. I also made few trim sheet textures for terrace materials. Building exteriors are using around three different textures and interior parts around four.
Material setup is actually very simple and it’s still flexible enough for large buildings. I ended up using a lot of vertex colors for blending different textures. This way I could use only one material per modular building model and it made things much easier to control. One thing that I wanted to hide as much as possible was the repetitiveness that happens when you use a lot of modular models and tiling textures.
One easy way to solve that is to use world aligned texture mask to add damage on top. That way you can control how large or small that damage layer is and it will map details in world space ignoring the mesh UVs and break the tiling look. For building walls, I used this technique to drive paint damage and age. I also added multiply and power nodes so I could tune this effect and even control damage levels in building blueprints. This is one way to add more variations between different buildings
I also wanted to have some objects covered with sand because this environment is heavily surrounded with sand desert and wind will move that sand around. WorldAlignedBlend node was perfect for this but I still wanted to add variation to that effect because it looked too uniform. I used the same world aligned mask that I previously mentioned for this by subtracting the values. This ended up looking pretty good and more natural. I also created the same kind of control for this effect like I did with the wall paint damage.
The final layer for objects that are outside was the rain/wetness. Because there is an option to have a rainy weather I made a material function that will change base color, roughness and normal values depending on the wetness level. Non-metallic areas will get darker and roughness will get lower based on the wetness variable. I also made a flipbook normal map animation for water drops that will be applied on top of models.
Buildings
Buildings are using a set of different small modular pieces both for exterior and interior parts. This kit is something I might expand in the future but right now it allows to make a pretty wide range of different buildings that you might expect to find in a western environment.
Every piece is modeled to work well with the UE4 grid so it’s fast to create different types of buildings. All of these models are certain unit wide and all of the vertices align correctly to hide visible seams. That will help to avoid light bleeding or Z fighting that occur when you have overlapping surfaces. I also made some variation like different windows and terrace types. Models are actually pretty simple and most of the heavy lifting is done in materials. For anyone who is doing something similar, I would suggest to always start with blockout models so that you can figure out what kind of models you need, what shapes and where to put the pivot point.
Another reason why I ended up making a lot of small building pieces was the fact that this project is using distance field AO and shadows and smaller models usually help to avoid artifacts with this technique. Smaller models also mean more possibilities for creating buildings but I still tried to keep the model count reasonable to avoid extra draw calls.
Goals & Pack Facilities
My goal was to make this project very dynamic and easy to use while still keeping the performance cheap enough for games. If you want to make a game that takes place at a rainy night then all you have to do is change a few variables. Modular buildings help to create small towns and a large set of props will make things look believable. Large desert environment with procedural foliage spawning also offers an interesting playground for all sort of games.
I wanted to use blueprints as much as possible because that way anyone can make changes fast and expand features or disable ones that are not important for certain projects. I spent a pretty long time with this project so it could work as a good base for western themed projects and I have some ideas about where to expand this in the future. Right now the project has around 215 models and 220 textures.
Day & Night System
This day and night system is something I’ve been iterating a lot with my other projects. I wanted to create something that is both easy to use and something that will not eat too much runtime performance. Main components are a directional light that will act as the sun, a skylight that will give the ambient lighting, volumetric height fog for different moods and a sky that change during the time.
Everything is controlled with one blueprint where a timeline is changing different values based on the time of day. Nice thing with the timeline is that you can create different curves to drive different variables like floats, vectors, and colors. In this case, rotating the directional light makes the most visible impact but I also needed to change skylight, fog and sky values over time to simulate different in between states. It took a lot of time to find the right values for this scene but it’s not that technical once the core system is up and running.
On top of this, I ended up adding a few more features like rain and dusty wind. Rain is something I really think will add a lot of mood. This effect is achieved in two steps. First and the most noticable is the change in materials. I previously mentioned that all of the objects outside has a material function that will control the rain effect. I created a material collection parameter with two variables, one for the wetness and one for the rain drops intensity. These variables are driving different parts of the rain material function. Then I just set these in the blueprint. Last step is the actual rain particle effect that is attached to the camera that the player is using.
Dusty wind works pretty much the same way so a particle effect is attached to the camera and there is a certain check to see if the player is inside the buildings or not. When the player enters in, these features will be turned off to avoid issues and turned back on when exiting.
This is just one way to handle day and night cycle but I think this is a good solution because it’s easy to change values and other aspects like how fast the time will run, how often the system update light rotations to avoid shadow flickering issues. I can also mix different features together like time of day and weather to have a rainy morning or dry evening with the dusty wind.
4-Layer Tessellation Landscape Material
Landscape material is also something that I’ve been iterating within my other projects and I believe this is the 5th iteration so far. The main idea is to have as few layers as possible for creating a believable-looking ground. I wanted to keep this material somehow cheap to render but still have enough details and control. I also organized all the layers into their own material functions so it is easy to read.
I usually want to have a rock layer that will be used for slopes and mountain areas. Then there is the largest layer that will create the overall theme. For the forest environment, this would be grass but in this case it was a desert sand layer. This is the most important layer because it will be covering most of the landscape. That is why I wanted to have slight color variations and more macro details to break the tiling look. I used a simple noise texture to blend different colors and a macro normal map to have kind of wave details.
Then there is the foliage layer that will be used for adding different grass and hay. I ended up creating a texture with some grass on top of the sand, and landscape grass system would spawn foliage assets on these areas. The last layer is the wetness. This one is used for different parts of the landscape. Mostly for town areas where it gives an illusion of wet ground.
All of these layers will have height value that is used for tessellation. This is optional because it is a pretty heavy feature even though it’s adaptive based on how close the camera is. Also instead of using basic landscape UVs I use triplanar to avoid texture stretching in extreme situations where basic UV approach would give bad results. Triplanar mapping basically will ignore landscape UVs and map textures along with X, Y, and Z axes. It costs more but it will also give more freedom for sculpting extreme landscape shapes like hills and slopes without major texture issues.
I also think that it’s equally important to get the landscape look good up close as it is at a distance. Because landscapes are using tiling textures you can end up with very noisy results at a distance and that tiling would be very noticable. Trick is to change that tiling value based on the distance. That way the results are more natural-looking and I can also use that same value to drive other things like distance roughness and so on.
Scale Independent Rock Material
I like to model rocks but a good rock material can help to speed things up a lot. Instead of baking unique normal maps or masks I created a material that will use world aligned textures to blend two different rock textures together. To make this material fully scale independent I also used ObjectScale node in the material to handle rock texture tiling so when you scale those rocks it will try to tile textures based on that to keep the tiling consistent.
Another part of the material is the ground blending. Because the project is already generating distance fields for lighting I decided to reuse that data for this blending. DistanceToNearestSurface node is very powerful and it does just what I needed. The only issue with this technique is that I needed to turn off the Affect Distance Field Lighting setting from model Lighting settings. Otherwise it would use its own distance field and the effect would not work right.
The benefits of these features are that now it’s possible to scale rocks and move them different places and they will always keep the tiling and blend with the ground dynamically. This will help to make working faster and it’s also possible to reuse same models in different ways.
Can It Be Applied To Game Production?
This pack is fully game ready in terms of performance. All of the models have handmade colliders and LODs. I also created an example level with everything up and running. Because this project is heavily relying on dynamic lighting with distance field effects that means its primary use cases will be for hi-end platforms but it can be easily optimized turning landscape tessellation off along with other rendering features.
Afterword
I want to thank 80lv for letting me share some aspects of this project. The pack is available at Unreal Engine market. If you want to find out more then head over here.
Previously, Kimmo has talked with us about his other UE4 environments and material production in Substance Designer. You can find the previous articles below: