UE4 – Quick fix for normal map encoding

Software:
Unreal Engine 4.25 | Photoshop 2020

Quick UE normal map tip:
If you load a normal map into a UE material and the result appears inverted, i.e. holes instead of bumps or the other way:

The quick fix:

  1. In the texture settings, check the Flip Green Channel option and save it:

Annotation 2020-09-06 160838

The deep fix:
* This can be performed an automated action on multiple files

  1. Open the normal map in Photoshop
  2. In the Channels panel, select the Green channel
  3. Press Ctrl + I,
    Or Select Image > Adjustments > Invert
    To invert the green channel.
  4. Save the texture and reload into Unreal Engine.
    Annotation 2020-07-06 233156

Inverted normal map:Annotation 2020-07-06 232554

Fixed normal map:Annotation 2020-07-06 233036

Related:
UE4 Bump map
UE4 – Procedural Bump Normals

UE4 – Creating two sided material effects using the TwoSidedSign node

Software:
Unreal Engine 4.24

The TeoSidedSign node let’s the shader “know” if a rendered polygon is facing the camera or not by outputting a value of 1 for facing polys and -1 for back-facing polys.
This is useful for creating materials that have different properties when seen front-facing or back-facing.

Example 1:
Blending two different colors based on face direction:

  1. Check the Two Sided material attribute.
    * Needed so that the engine will render the polygons beck sides.
  2. In the material blueprint, create a blend of to colors using a Lerp (LinearInterpolate) node and connect it to the material’s Base Color input.
  3. Add a TwoSidedSign node to get polygon facing input (1,-1).
  4. Connect the TwoSidedSign node’s output to a Clamp node to clamp the values to (1,0).
  5. Connect the  Clamp node’s output to the Lerp node’s Alpha input so that the polygon’s facing direction will control the Lerp blend.

Note:
You can use this method to blend any other material attribute based on polygon facing direction.

Annotation 2020-05-11 133226

 

Example 2:
Create an “inwards facing” flipped normal material:

  1. Set the material’s Blend Mode to Masked.
    * Needed for being able to make areas parts of the mesh invisible.
  2. Check the Two Sided material attribute.
    * Needed so that the engine will render the polygons beck sides.
  3. Add a TwoSidedSign node to get polygon facing input (1,-1).
  4. Connect the TwoSidedSign node’s output to a Clamp node to clamp the values to (1,0).
  5. Connect the Clamp node’s output to a 1-X node to invert the facing input.
  6. Connect the 1-X node’s output to the material’s Opacity Mask input so that polygons facing the camera will be invisible.

Annotation 2020-05-11 130703

 

Related:

  1. Blending material using Paint
  2. Material Functions
  3. UE4 Bump Map

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

Related:
UE4 – Procedural Bump Normals
UE4 – fix an inverted normal map
UE4 – Triplanar mapping