UE4 – Connect a Directional Light to an Atmospheric Fog effect

Software:
Unreal Engine 4.21

UE4‘s Directional Light mimics sun lighting and shadow fairly realistically,
And the Atmospheric Fog visual effect produces a realistic clear sky background that includes the sun’s disk image in the sky.
> The Atmospheric Fog produces a result similar to an implementation of a Preetham physical sky model in common rendering software.

Combined together, these two elements can produce an effective day-light system,
But inorder for this to work the sun’s direction should be controlling the time of day simulated by the Atmospheric Fog.

For the Directional light to control the Atmospheric fog:
In the Directional Light’s details, under light, expend the settings and enable:
Atmosphere / Fog Sun Light

Note:
There is a limitation to this setup’s realism because the sunlight’s color shouldn’t be pure white, but rather yellowish, to orange, depending on the time of day (you can find tables of the sunlight’s color temperature for various time of day on the web)
There is no problem setting the sun’s color, but the problem is that it causes additional coloring of the Atmospheric Fog which isn’t needed since it already is simulating the sky’s color correctly.
The result of this limitation is that we can see a sunset sky with a white sunlight which is wrong.
I didn’t find a workaround for this yet, can’t find a way to set the Atmospheric Fog‘s sun vector without connecting it to a Directional light and can’t find a way to make the Directional Light‘s color not affect the Atmospheric Fog‘s color.

Update:
It seems this limitation can be overcome by disconnecting the Atmospheric Fog from the Directional Light and using the Atmospheric Fog Object’s rotation to control it.

Directional_light_Affect_Atmo_Fog
atmo_fog.gif

Advertisements

V-Ray Next’s PBR’ness

Software:
3ds max 2019 | V-Ray Next

A quick test of V-Ray Next‘s PBR workflow,
Namely designing materials while previewing them using V-Ray,
Defining the material properties using the new (to V-Ray) Metalness attribute, and using Roughness rather than Glossiness, shows good results IMO.

Results are generally consistent through Blender & Cycles, Maya & Arnold, and UE4.

Untitled-1.jpgUntitled-3

Untitled-4

Untitled-2

 

Related Posts:

  1. V-Ray Next – Metalness
  2. Metal In UE4
  3. Fresnel Reflections

UE4 – Bump Map

Software:
Unreal Engine 4.21

To use a ‘Bump Texture’ in UE4, or in more geeky terms, derive Normal data from a supplied height map, use the NormalFromHeightMap Node.

Notes:

  1. The height map textured is supplied via Texture Object node and not Texture Sample, and is connected to the NormalFromHeightMap‘s Height Map input.
  2. A numeric vale is connected to the NormalFromHeightMap‘s Normal Map Intensity input to control the intensity of the resulting Normals/Bump.
  3. UV coordinates for the bump map should be connected to the Coordinates input of the NormalFromHeightMap node.

bump

 

UE4 – Animated texture using a Flip-Book node

Software:
Unreal Engine 4.18

AAA.gif

A ‘Flip Book’ node in UE4 is the way to create an animated texture using a Sprite-Sheet.
Its very simple to use:

  1. Import a Sprite Sheet texture containing the animation frames.
  2. In the UE4 Material, Create a Texture Object node, and set it’s Texture property to be the Sprite Sheet texture you imported.
  3. Create a Flip Book node and connect the Texture Object Node to its  Texture input.
  4. Connect numeric value constants to the Flip Book node’s Number of Rows and Number of Columns inputs to set the layout of the Sprite Sheet.
  5. Connect the outputs of the Flip Book node to the wanted material inputs.

Runner_Atlas

Untitled-1

The following example shows a way to create a custom Flip Book material to animate textures.
Q: Why would you do that???
A:
Well the truth is I created it without knowing there is a built-in option, and found out about the Flip Book node right after I finished my own.. 😀
But it’s also a useful example of locating tile coordinates within a plane..

Untitled-2.jpg

 

 

Create a richly colored metallic surface in UE4

Software:
Unreal Engine 4.18

One of the optical properties of many metallic surfaces is changing it’s color slightly as the surface viewing angle changes.
This effect can be simply created using a Fresnel node and a color-ramp texture.

Untitled-4

  1. Create a metallic material (metallic value of 1.0).
  2. Use an image editing software to create a linear color ramp texture (gradient) of the color change per viewing angle from left to right. like this example for a golden metal, and import it to your project.
    Ramp_Gold
  3. Add the ramp texture to the material Blueprint, and connect it to the material Base Color Input.
  4. Create a Fresnel node and set its Exponent value to 1.0 and its Base Reflect Fraction to a value of 0.0 so it will provide a linear angle blend value.
  5. Connect the Fresnel node’s output to the UVs input of the ramp texture node.
    * the reason the Fresnel node can be providing both the X and Y texture coordinates is that the texture’s Y dimension provides the same color for all values anyway.

Note:
When the Metallic property of an Unreal Engine material is set to 1.0, the material automatically simulates the metal’s color fading to white at parallel surface viewing angle (the sides) like it should.
So using a Color Ramp Texture like in this example creates an amplified effect.
* Simply put: You don’t have to have the Color Ramp fade to white on the right side of the texture..

Untitled-4

Untitled-3

UE4 – Material Fresnel Node

Software:
Unreal Engine 4.18

The UE4 Fresnel node is actually a “Facing Ratio” node (aka Perpendicular / Parallel) with some extra control.
It basically allows controlling material effects according to the incident angle the surface is viewed at, which is a hugely important feature for designing advanced material effects.

Untitled-3

Exponent:
The steepness of the value / angle curve.

Base Reflect Fraction:
The value at perpendicular angle.

Normal:
An option to connect World Space surface normals input to affect the output of the Fresnel node.
* Tangent Space normals must be converted to World Space by using a Transform Vector node.

Note:
A value of 1.0 for the Exponent parameter, and a value of 0.0 for the Base Reflect Fraction will produce a linear “Facing Ratio” (“Perpendicular / Parallel”) falloff blend.

Examples of different values:
Untitled-3
Untitled-4

More info:
https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/HowTo/Fresnel/