Featured post

Hello and Welcome to my Blog!

A-k-a, my public learning diary for my 3D animation degree and since graduating, my free-time independent 3D studies and personal projects

Wednesday 3 March 2021

A Start to Unreal Engine

Recently I've been teaching myself Unreal Engine 4 using the following tutorial: https://youtu.be/_a6kcSP8R1Y to create the below environment.

*It was created using assets provided by the tutorial, quixel megascans and unreal engine marketplace. No assets are of my own making.*


The tutorial covered so much and is perfect for complete novices. Out of everything it covered, in this blog post I'll be writing about Unreal's landscape and foliage tools and its lighting and material systems. In a later blog post I will go over blueprints and rendering/exporting from Unreal.

On a random note, something I really love about unreal engine - and is a big motivator for me - is the ability to load a default character to run about the scene you are actively making.
 

Materials:


Unreal engine has a wide library of nodes that you search and plug in to one another to create and tweak existing material maps, (colour, normal, roughness, metalness etc). Like in substance, you can create material instances from master materials for a simplified, non-destructive workflow. Applying the same material instance to a group of 3D assets, when tweaked will change and update them all simultaneously. 
  • Master materials are where you connect all the nodes, it's where the complex bulk is - where the behind the scenes stuff is constructed. 
  • Material instances are where the simplified settings are with the most commonly adjusted parameters. It's where selected attributes from the master material have been converted to parameters. 
  • Parameters are the tweak options that appear in a materials.
Material Instance

Master Material

To properly assign a material to an asset, you drag it from the materials folder into the asset's details window under the Materials tab (under the static mesh tab) like in the image below.



Landscape Mode:


Unreal has some good landscape tools for sculpting terrain, however, many artists prefer using a more dedicated programme such as Gaea to create their landscapes as it offers a better workflow and more specialised tools - especially when it comes to realism. At present I have not used Gaea, but I fully intend too and will write about what I learn in a later blog post. I want to see and experiment with what it can offer stylised artists - the niche I'm aiming to specialise in. 

Landscape mode tools are quite self explanatory for sculpting terrain.

Landscape mode tools
Landscape mode settings

However, something that was completely new and impressive to me was being able to paint landscapes in real time using and blending multiple materials! In this example, I was painting with grass, dirt, rock and gravel materials, switching the target layer I was painting with. I was able to preview my strokes as I was making them - no need to go into another software to edit, export, replace and update!

How to set landscape blending:


To do this, you need to make a blank material and load in the colour, normal and roughness maps and plug them into the "MakeMaterialsAttributes" node (should have a separate node for each material). Deselect everything and on the left should have the option to "Use Material Attributes" this enables the make material attributes node you just created. 

Next you add in the "LandscapeLayerBlend" node and create layers - one for every material you wish to paint with and then connect them, hit apply and save. In the viewport, on the left target layers now appear (the materials you want to paint with), just click the + on all of them and choose "Weight-blended layer (normal)" and you're good to paint! Extra steps will be necessary if the texture size isn't correct by adding a multiply and "LandscapeLayerCoords" node. (See master material screenshots below).



Material instance for the master material and its target layers below:


Foliage Tools:


I love what the foliage tools can offer an artist to speed up their workflow. It doesn't only just apply to foliage it can be used for anything you want large amounts of scattered on the ground (rocks, tress, flowers, twigs, grass for example), with parameters to change the amount and size of the selected assets painted in a single stroke.


Lighting:

In unreal engine you get two main lighting types, static lighting and movable lighting. 
  • Stationary lighting keeps lights still but let’s object move and keep a shadow e.g. a character running around in a scene.
  • Static lights are good for global illumination and calculating bouncing light. Unreal engine takes that information and instead of having it lit in real time, it is baked into a light map (aka shadow texture) which is overlaid on the entire level. It fakes the light because it is not there in real time.
Also to recap some Maya lights that Unreal uses too:

  • Point light: These are like light bulbs in your house, all lightbulbs have either a warm or cool looking temperature. 
  • Directional light: Mimics the sun.
  • Spotlight: Same as in real life and Maya. Falloff is edge feathering.
  • Rectangular light: Unreal equivalent of Maya’s area light. Barn door angle is this light’s falloff.
  • Skylight: No immediate change in viewport. Simulates light being produced from the sky, gives everything a slight bluish tint. 

Skylight can be shown with sky atmosphere and a sun (directional light). Bring all 3 into a scene, under directional light’s 'atmosphere and cloud settings' find Atmosphere sun light and turn it on. 


Exponential height fog allows you to change the bottom of the sky in a scene, (where it’s black) and change the start distance to 500.


Another great feature Unreal offers is the post process volume box, it acts a bit like a scene post editor and can contribute a lot to lighting. This is great because you can choose where in a level these effects apply. To extend this to the entire level, Details > Post processing volume settings > tick Infinite Extent (Unbound) box.



Below are some common lighting errors I made note of and posted here just in case:


If you get any lighting errors, this is where you need to start optimising. Drag Light Mass Importance Volume into the scene, scale it to encompass where you want the engine to focus lighting and rendering.


If reflections don’t look right, it’s because you need either a sphere or box reflection capture (or reflection plane).


To view the light map, go to Lit > Optimised Viewmodes > Lightmap Desnsity. Each square represents a pixel of our baked lighting texture. Blue represents low resolution, green is high resolution, yellow is higher resolution and pink is the selected object. Ideally for a architecture scene they should be yellow/red range. 


Image from: https://magazine.substance3d.com/building-an-interior-for-unreal-engine-cg-breakdown/

If you’re getting poor shadows it’s because the light map needs a higher resolution so select the object with poor shadows > lighting > overridden light map res > 512 > build.


To find the settings that unreal uses when baking the light go to World Settings > Lightmass > Lightmass Settings. (Below is a starting point).


Static lighting level scale: 0.1.

Num indirect lighting bounces: 10.

Num sky lighting bounces: 10.

Indirect lighting quality: 10.

Indirect lighting smoothness: 1.3.


More light bounces = more overall light.


Decreased static lighting level scale which decreases the range at which the lights are looking for objects, the lower it is the more shadow detail you get. This might cause light map issues so that’s when the indirect lighting quality goes up.


General equation: Static lighting level x Indirect lighting quality = 1.

(0.1 x 10 = 1).


Sometimes you may get reflection errors, this is because there are 2 reflection methods are at work and are conflicting with each other. Sphere reflection capture and screen space reflection. 


To deactivate screen space reflection, you need to use a post process volume. Place Actors > Post Process Volume (drag into viewport). Scale it so that it encompasses the entire scene and in the details tab go to Rendering Features > Screen space reflect > Intensity change to 0.


If there are still errors it’s because unreal engine needs to refresh a photo of the scene. To retake, got to Build (arrow) > Build reflections captures. 


The reflections still may not be accurate so, Place Actors > Sphere Reflection Capture. Place it inside an object and change the influence radius to 100. Recapture reflections.

No comments:

Post a Comment