Friday, August 1, 2014

[UE3/UE4] Generate Cavity from Normals

When someone over at the unreal forums asked for a way to generate cavity maps in the material editor I thought this might be interesting and quickly put together the following material.
The basic idea is to offset the normal maps green and red channel in two directions and compar both samples.
In order to save some instructions I decided not to use the overlay blend mode to apply the cavity map. Instead I'm biasing the cavity maps color range to make white the mid color and simply multiply this result by the diffuse map.

Material Setup


Base Diffuse

Generated Cavity with 1 Texel Offset

Generated Cavity with 0.5 Texel Offset

xNormal reference, generated offline

No comments:

Post a Comment