Tuesday, April 1, 2014

[UE4 Quick Tip] Environment Maps as a Post Process

In unreal engine 4 you can use ambient cubemaps which are applied as a post process. This is nice, espacially for dynamically lit scenes, but by using your own post process material you can create a huge variety of effects with full manual control.

Using an ambient cubemap in a post process effect is pretty similar to sampling a cubemap in a regular material, except that you'll need to use the G-Buffer world normals for calculating the reflection vector. To avoid issues with the sky(dome) you can simply fade out the effect based on scene depth.

The most important part is probably blending the ambient map with the already rendered scene. There are many ways of doing this, things you could take into account: scene brightness, metalness, roughness (sampling different MipMaps) etc. I won't go into detail here, just keep in mind that simply adding the ambient map to the scene color won't do the job.