Alireza Khajehali talked about the way WorldMachine and Megascans help him to build huge realistic looking digital worlds.
3d artst Alireza Khajehali is a real master of landscape design. He’s created countless virtual regions, which are fully playable in UE4. In our interview, he described his production process and talked about the way WorldMachine and Megascans help him to build huge realistic looking digital worlds.
Hi everyone! I’m Alireza Khajehali, And I’m a realism addict. I’m currently studying for a bachelors degree in software engineering and I’ll be graduating in about 8 months. As for 3D work, I’m self-taught and the reason for my survival is the passion that’s pushing me in this direction.
It all started when I found out my Crysis 1 had an editor that I could double click and become a game developer. “Never discourage a kid who thinks placing some trees is a lot of hard task accomplished!” Some time after that came CryENGINE 3 Free SDK and creating scenes plus helping with small indie projects were my main focus and I did a lot of free work in my free time for a few years which got me to a point where I could finally introduce myself as an environment artist with a solid art portfolio.
Some of the works I’ve done recently are LawBreakers where I was responsible for creating the natural backgrounds for the levels. Chronicles of Elyria where I was working as a generalist, creating the game level as well as marketing shots. I’ve created a landscape for Squad and currently working on Our Ghosts of War with some other friends, which is a personal project.
I think every environment artist has had a desire for creating environments since their childhood. At least in my case, when I was 4-5 years old I alway used to watch movies and think about how I’d have done the set dressing if it was up to me. I always like to put things together in a way it looked good so that was the kind of thing I was doing with CryENGINE 2 in my modding days.
The shift from small environments to vast outdoors took place when I first saw Battlefield 3. I was so impressed by those massive landscapes and especially Andrew Hamilton‘s work. He nails everything regarding an open world environment so you can’t find anything that doesn’t look amazing and in complete harmony. That’s the secret to good outdoors really. “Do not take anything lightly depending on their size. Even the smallest pebbles on the ground are as important as the largest mountains!” Up to this point I was still a CryENGINE 3 user but due to the lack of tools for creating vast outdoors I dropped the ball and switched to UE 4.0.1.
I can tell you, once you finish a vast outdoor that is done correctly and properly to the last bit of detail, you have a satisfying feeling much better than that of creating an small isolated environment. And that’s the sort of drug that keeps me going. I’m always waiting for me to finish the work and enjoy what I’ve created.
Every environment I create is coming from an idea triggered in my mind or a reference picture. In example the Iceland environment I created recently was the result of me accidentally seeing some really nice pictures of Reykjanes peninsula. The environment I did after that was inspired from a scene in Mad Max: Fury Road.
I’m too lazy to do a block out of what I’ve already finished visualizing in my head so once I have an idea of what I want to achieve I start my work on the landscape heightmap.
I mostly use WM2 [World Machine 2] for generating the heightmap. Once I’m done with that I’ll output the heightmap plus some masks to put together a splat map. Using a splat map for landscape is an old and yet, the best method. I also export the heightmap into a mesh as well. I use the mesh for designing the backgrounds of the level. For that purpose first I decimate the mesh and bake the HP to LP so I’ll have a low poly landscape and a normal map to place outside the landscape bounds in order to increase the view distance. Here is a comparison with and without background meshes.
Then I use 3ds Max and Zbrush to create complementary assets for the environment such as rocks. I use a program called Unfold3D to UV my rocks, it’s really fast and then I do the texturing in UE4 using
Object Radius node with some tileables so I can keep the texel density fixed regardless of wether the rock is scaled up or down.
One of the custom functions I have which I really like allows you to share the same color information between your landscape layer and your meshes based on world position, allowing for a more seamless transition between the ground and rocks.
Additional Work in UE4
The real work and the fun part starts in UE4 after importing the heightmap where I’ll be setting up the materials, functions, lighting, amosphere and do countless tweaks to everything until I’ve captured the feeling of the location.
I tend to use 4-6 materials per landscape and the end result as you see in pictures usually takes around 3GB of RAM (4K textures) and runs between 60 to 100 fps on my 970 which is pretty good for a world size of 64 Square Kilometers and that’s with dynamic G.I (LPVs) and distance based tessellation being active.
Speaking of distance based tessellation, I’ve created a library of modular functions that help me to boost the landscape quality a lot for very cheap performance cost. I can reuse these functions for any other landscapes and turn them into an absolute beauty in a very short amount of time. Here’s some before/after screens.
Here’s another function that takes a grass as input and let’s you create infinite variations from it without generating more textures simply by colorizing it in different ways. Having a good grass setup helps with outdoors a lot and in this case, one grass can be used to cover vast areas without looking repetitive or needing multiple grasses to have variation.
I generate a lot of terrains until one is up to my taste. I try to keep visualizing how players would navigate on the landscape and that really helps me to find the best layout for the landscapes.
Scale is really one of the most important things as most of the immersion is coming from how big this mountain or that sand dune is. You have to keep your mountains, hills and everything to an scale that neither feels too big nor too small and you also have to keep in mind there’s supposed to be gameplay there so you have to design an area that’s not only gorgeous but also suitable for gameplay.
Sadly there’s no sense of scale when creating a heightmap in WM2 and the tool isn’t being updated anymore so what I do is to quickly import the heightmap in UE4 and run around a little to see if the scale feels correct. After a while doing this you’ll get used to the scales and then for the most part you can trust your eyes for the scales to be correct.
Megascans definitely is a wealth source of materials for environment artists. But as the scans aren’t yet fully released the library is currently lacking the material variation one would need for production besides one shouldn’t rely entirely on a service so I tend to use multiple resources such as Megascans, CGTextures, as well as creating my own textures.
Now to the important stuff. You didn’t ask this but here’s something I’d like to share with you. It doesn’t matter if it’s Megascans or what, once imported in game engine you get average looking materials. In Megascans library you’re looking at renders on surfaces with millions of triangles. Every tiny detail is in 3D and it receives shadows plus it casts shadow as well as generating AO. But once you import materials in a game engine it’s a different story. Your surfaces in game engines are low poly, your landscape surface consists of 2 triangles per 1 square meter. There are ways to overcome this. There is a false belief among some artists which is that in a PBR engine a none metal material doesn’t need a Specular map. Another false belief is that Albedo should be free of any shadows. Now I’m gonna open this for you.
Your Albedo should be free of any shadows, well not any shadows. Very small scale shadows or micro shadows are something that game engines can’t take care of and these shadows need to be present on the Albedo map. To get a better knowledge of what I mean by micro shadows take a look at the image below.
Such shadows if removed from the Albedo, would not be reconstructed by the render engine no matter if you use a separate AO map or not. AO maps have no effect when the surface is lit and they only work if thesurface is covered in shadows so you really gotta keep those micro shadows in your albedo maps. Some people tend to remove those shadows then use a separate AO map and multiply that by Albedo in the material editor, I don’t get the point of removing them and then adding them back with the additional cost of an extra AO map.
Now those micro shadows represent cracks or holes on the surface and basically those cracks or holes look dark because there’s not much light being reflected from there to your eyes. But wait a second, having a constant value as specular means the entire surface is reflecting light equally which in case of the example above is incorrect behavior as there’s very little light coming from those cracks and holes to your eyes so the specular value for the cracks and holes should be less than the flat areas.
I don’t go for a separate Specular map though as that’s unnecessary memory cost. But I can easily drive a specular map from the Albedo itself by running it through a clamp node with a min value of 0 and a max value of 0.5. (0.5 is the specular for most non metals). To further introduce some more variation on the produced specular map and make the surface look more interesting we can run it through a Power node to make it more contrasty before running it through the clamp node. This makes the surfaces look more real and even behave more correctly as now the cracks and holes aren’t reflecting light as much as the flat surfaces.
Here are some pictures showing the difference between a vanilla rock material and the material plus the calculations I mentioned above.
And here is a comparison while looking at the Specular buffer.
There’s another card to this which is Fresnel effect. I believe this one would add a lot more text here and I’m already far beyond an essay so I’d skip this one for now. Maybe next time.
Speaking of optimization there are many ways to optimize and environment, some of which I do use for my landscapes. Channel packing textures is probably the best thing to do regarding a landscape as it helps reducing the memory usage as well as shader complexity. You can channel pack 3 greyscale Albedo maps into a single RGB texture and later colorize each channel in the material editor. I don’t do that though as I try to keep the original color information. But what I do is put the displacement map into normal map’s Blue channel and set the compression type to “Masks”. Later I reconstruct Normal map’s Blue channel in the material editor using some simple math and this way I have saved a texture sampler by not having a separate displacement map. Setting the compression type to “Masks” cuts the memory usage by about 50%. I tend to drive the roughness from the Albedo as well but in rare cases where a unique roughness map is needed, that’s put into normal map’s alpha channel.
For the meshes such as rocks I’m not shy at spending tris and I tend to keep it somewhere around up to 30k tris because this really increases the immersion when player is near a rock and I usually use 4 to 5 LoDs so everything runs nice and smooth. I try to reduce as many tris per LoD step as possible while maintaining the forms so I don’t see a rock at LoD0 and a bazooka at LoD5.
Another thing I did was the grass function I mentioned earlier. The point was to use a single grass mesh and texture and make variations from it enough to cover hundreds of meters around the player without noticing it’s the same grass mesh instanced all over the place.
I apologize this one will be rather long. PBR material systems introduce the need for physical lights. By that I mean we should have an idea of how much light we are casting on our materials otherwise we’re breaking the point of PBR which is achieving a more realistic look.
Unfortunately the Sun in UE4 doesn’t have any physical units such as Lux so you wouldn’t really know how much light you’re casting on your world. There are some ways to calculate this but in the end you’re not gonna have a result as pleasant as you’d have with a physical light. Now I’m gonna give you some values that I’ve found most helpful in my cases. For overcast lighting all that’s needed is a good cloudy Skydone and a Skylight intensity of 1. For a Sunny/Cloudy day a value of 3.14 as Sun intensity works well and the Skylight intensity should be reduced a little in order to maintain a good contrast between light and shadow. If we have a little less clouds and more Sun a value of 4-5 for Sun would be ideal. For those burning desets with a violent Sun a value of 7 does wonders.
But I strongly advice everyone not to go beyond 7 as it’s going to start making your materials look worse. People often go over an intensity of 10-12 to get the look they want but that’s a mistake. Either texture’s don’t have the correct luminance (they were darker than they should’ve been) or you’re a victim of UE4’s Tonemapper. UE4’s Tonemapper clamps the whites so much that initially you’re having a washed out image and only by increasing the Sun intensity so much you can compensate that a little which is in the end making your materials lose their original surface detail under such an intense light cast. To counter the Tonemapper’s white clamp (I don’t want to completely disable it as it will disable a number of features with it as well) I’ve created a custom Look Up Table that when loaded in the post processing volume it’ll push the whites back to their original position and you’d take advantage of the full 0-255 luminance range.
Credits to Walid K-Perrussel for sculpting the rocks, composition and lighting
After you’ve taken care of the whites increasing the image contrast makes things look a little more realistic but less realistic. Keep the contrast somewhere very close to the default value if you don’t prefer “more interesting” over “more realistic”.
Whether you’re an environment artist or not, find our what you’re passionate about and go for that. But also note that if you’re in this business it’s not just your desire that matters, you should care for others as well.
Always do some playtest on your heightmap to check the scales before you proceed with texturing and lighting, save your precious time.
Make sure your materials behave the way they should. Do a lot of tweaks to your materials and especially the colors until everything is in complete harmony.
If you’re producing an open world environment be the first one to run across the landscape, be the first one to judge whether it’s suitable for at least 2-3 different type of gameplays or not. Be the first one
to worry about performance and optimization. Make it easy to use for others.
Pay attention to every little detail, don’t make exceptions. Nail the rocks, nail the grass, nail the pebbles, nail the mountains. Don’t move from one to another until you’ve nailed it. One good light saber can earn you respect much more than 10 average looking environments do. So don’t move on from piece to piece before it’s done up to the best of your abilities.
Start creating some modular functions that you can reuse here and there. These greatly help you to save time and effort while increasing the quality.
Don’t be shy to iterate. Iterate iterate iterate until you know in your heart that you’ve put out your best! and then learn from the criticisms.
If you have any questions or concerns please do not hesitate to write to me. But in case you saw a delay in reply I apologize for that beforehand. On some days I need to work 16 hours before I can scratch my head.