UE4 – Procedural 3D noise bump setups

Software:
Unreal Engine 4.25

Yet another case where I develop my own costly solution only to find out afterwards that there’s actually a much more efficient built-in solution.. 😀

In this case the subject is deriving a bump normal from a procedural or non-uv projected height map/texture (like noise, or tri-planar mapping for example).

The built-in way:
Using the pre-made material functions, PreparePerturbNormalHQ and PerturbNormalHQ, the first of which uses the low level Direct3D functions DDX and DDY to derive the two extra surface adjacent values needed to derive a bump normal, and the last uses the 3 values to generate a world-space bump normal:

240 instructions
  1. Noise coordinates are obtained by multiplying the surface shading point local position by a value to set the pattern density.
  2. The Noise output value is multiplied by a factor to set the resulting bump intensity.
  3. The PreparePerturbNormalHQ function is used to derive the 2 extra values needed to derive a bump normal.
  4. The PerturbNormalHQ function is used to derive the World-Space bump normal.
  5. Note:
    Using this method, the material’s normal input must be set to world-space by unchecking Tangent Space Normal in the material properties.

The method I’m using:
This method is significantly more expensive in the number of shader instructions, but in my opinion, generates a better quality bump.
Sampling 3 Noise nodes at 3 adjacent locations in tangent-space to derive the 3 input values necessary for the NormalFromFunction material function:

412 instructions
  1. Noise coordinates are obtained by multiplying the surface shading point local position by a value to set the pattern density.
  2. Crossing the vertex normal with the vertex tangent vectors to derive the bitangent (sometimes called “binormal”).
  3. Multiplying the vertex-tangent and bitangent vectors by a bump-offset* factor to create the increment steps to the additional sampled Noise values.
    * This factor should be parameter for easy tuning, since it determines the distance between the height samples in tangent space.
  4. The increment vectors are added to the local-position to get the final height samples positions.
  5. The NormalFromFunction material function is used to derive a tangent-space normal from the 3 supplied height samples.

Note:
From my experience, even though the UV1, UV2 and UV3 inputs of the NormalFromFunction are annotated as V3, the function will only work is the inputs are a scalar value and not a vector/color.

Related:
UE4 – Material Functions
UE4 – Bump map
UE4 – fix an inverted normal map
UE4 – Triplanar mapping

Denoising animations in V-Ray for Maya

Software:
Maya 2018 | V-Ray 3.6

Animated sequences require ‘Temporal Denoising’ in order to achieve a flicker-less result.
‘Temporal Denoising’ means that in addition to taking into account neighboring pixel data, the denoising process also takes into account pixel data from adjacent frames in the animation.
For that reason, the V-Ray Denoiser render Element can’t simply be used during the render process like we can use it when rendering still images,
And the animation sequence is denoised after it has been rendered, and stored with extra data needed for the V-Ray Denoiser to work.

Update:
In V-Ray Next the vdenoise.exe tool has a GUI that allows loading sequences easily.
NXT_vdenoise.png

In versions of V-Ray prior to V-Ray Next the vdenoise tool has to be operated through command line with the following easy steps:

This is a very useful article on the subject from Dabarti studio:
http://dabarti.com/vfx/using-v-ray-denoiser-tool-vdenoise-exe-with-send-to-scripts/

General sequence denoising setup that has to be done just once:

1) Create a command line denoising script batch file, and store it in the Windows ‘Send to’ folder:
Write the following script to a new text file.
* this script is from an article by Tomasz WyszoÅ‚mirski – Dabarti Studio.

@echo off
set input=%1
set denoiser_input=%input:~0,-8%????.exr
"C:\Program Files\Chaos Group\V-Ray\Maya 2018 for x64\bin\vdenoise.exe" -inputFile="%denoiser_input%" -useGPU=2 -display=0
pause

Save the file named ‘Denoise Sequence.bat’ in the Windows Send to folder.
* to find the Windows Send to folder quickly open the Windows ‘run’ utility and type: shell:sendto.

Render setup for denoising:

2) In your Maya scene, In the Render Settings window, In Render Elements tab, add a Denoiser Render Element.

3) Select the vrayRE_Denoiser Render Element,
And in the Attribute Editor, under Exta V-Ray Attributes set ‘Mode’ to ‘Only Generate Render Elements’.
Capture

4) In Render Settings > Common > Image File Output:
Choose exr (multichannel)
Capture

5) Render the Animation.

Denoising the animation:

Right click the first frame of the rendered sequence,
And choose Send to > Denoise Sequence.bat

Related post:
Rendering an animation with Maya and V-Ray