Download

Test the Forward Renderer in your PC VR projects with the 4.14 Preview

I strongly recommend everyone with PC VR projects to try out the forward renderer immediately with the 4.14 preview and post feedback! There’s a small window where bug fixes (but not new features) may still make it into the final 4.14 release.

Edit: the 4.14 branch is locked down, so all future improvements will end up in 4.15. Thanks to everyone who responded with feedback.

Forward Shading Renderer for VR (experimental)

We now have a Forward Renderer that supports the high quality lighting features of UE4, enables Multisample Anti-Aliasing and is 22% faster than the default Deferred Renderer in Robo Recall.

Enable ‘Forward Shading’ in the Rendering Project settings and restart the editor to use the Forward Renderer.

To use MSAA, set the default Anti-Aliasing Method in the Rendering Project settings.

Anti-Aliasing

Temporal Anti-Aliasing works well at reducing flickering and jaggy edges on 2d monitors, but introduces unwanted blurriness with VR headsets due to the low effective resolution, and the constant sub-pixel movement introduced by head tracking. MSAA gives much sharper results, but requires all shading to be done in one forward pass to be performant.

The console variable ‘r.MSAACount’ controls how many MSAA samples are computed for every pixel. ‘r.MSAACount 1’ has special meaning and falls back to Temporal AA, which allows for convenient toggling between Anti-Aliasing methods.

Performance and Features

Profiling Robo Recall on an Nvidia 970 GTX, the Forward Renderer is 22% faster than the default Deferred Renderer (12.3ms -> 9.6ms).

Most of the performance improvement comes from features that are disabled by default in the Forward Renderer. Only the nearest Reflection Capture will be applied without parallax correction, unless the material opts-in to High Quality Reflections. Similarly Planar Reflection receiving must be enabled on materials and Height Fog is computed per-vertex.

The Forward Renderer works by culling lights and Reflection Captures to a frustum-space grid. Each pixel in the forward pass then iterates over the lights and Reflection Captures affecting it, shading the material with them. Dynamic shadows for Stationary Lights are computed beforehand and packed into channels of a screen-space shadow mask, leveraging the existing limit of 4 overlapping Stationary Lights.

Supported Features, which are all used in Robo Recall:
Full support for stationary lights, including dynamic shadows from Movable objects which blend together with precomputed environment shadows
Multiple Reflection Captures blended together with parallax correction
Planar Reflections of a partial scene, composited into Reflection Captures
DBuffer Decals
Precomputed lighting and skylights
Unshadowed Movable Lights
Capsule Shadows
Instanced Stereo compatible

This is a new rendering path so there may be some issues.

Not yet supported:
Screen space techniques (SSR, SSAO, Contact Shadows)
Shadow casting Movable Lights
Dynamically shadowed translucency
Translucency receiving environment shadows from a Stationary light
Light functions and IES profiles

Additionally, certain features do not handle MSAA properly yet and may exhibit artifacts along object edges. These are DBuffer Decals, Dynamic shadows and Capsule Shadows.

Thanks again for committing to the forward renderer and MSAA, I know it was the official stance to not support a secondary renderer a while back but this sets UE4 on a far better footing for VR, it is greatly appreciated.

I’m curious to see how the forward renderer does on my VR audio book player StorytellerVR - it’s a super simple scene and takes essentially zero CPU, simple materials and a limited amount of geometry, only a couple of lights, but it just barely hits the 90fps target on my machine (i7 2600k, 780 Ti SC) on version 4.10 and 4.11.

Very nice! My VR project relies on SSAO, so I’ll have to wait until that is supported, but 22% performance improvement definitely sounds very nice :smiley:

At the moment I can let SSAO run on lowest quality setting, without AA there are many ugly patterns visible, but Temporal AA is blurring the AO so that it looks very nice. Once SSAO will be supported in the forward renderer, could you maybe directly implement the blur shown here: https://forums.unrealengine.com/showthread.php?96870-Screenspace-blur-for-SSAO-C&p=575961&viewfull=1#post575961 to the forward renderer, since the usual TAA blur will not be available? With that blur it should look great on lowest quality with MSAA. :slight_smile:

My water material is broken when switching to the forward renderer, something about gbuffer scene textures. is there a workaround for this?

This was in 4.13, but when I enabled Forward Shading it seemed to break my landscape texture - does the forward shader allow fewer texture samples and/or landscape paint layers than deferred or is it likely another issue?

Does the forward rendering MSAA support alpha to coverage for alpha masked materials? The reason I ask is that masked materials tend to look horribly aliased without it (compared to TAA)

Are there plans for any enhancements to deal with specular aliasing in the future?

I’ve tested the forward renderer with the VR template in 4.14, and there it works fine with no issues.

Here is a small comparison:

Temporal AA:

MSAA

MSAA looks way better :cool:

Have an interesting issue where MSAA cant find samples against Atmospheric fog (remains entirely aliased) the rest of the scene looks brilliant though! Also be wary of blendables in your post process when changing to the forward renderer in VR (eg cell shaders and outline shaders), as these can break stereo instancing leaving you in pirate mode (one eye corrupted) thanks again, Epic, best update ever.

Can we expect screen space techniques to work eventually?

No, the GBuffer is not available for texture sampling in the forward renderer. Look in your material and you’ll find a SceneTexture node. Only SceneColor is still supported.

The forward renderer jams all features into one shader (by definition of forward) so there are fewer texture samplers available for your material. You can usually solve it by using shared samplers.

Yes, any masked materials automatically use OpacityMaskToCoverage. Basically the opacity mask input gets turned into MSAA coverage. You can use it to do dithered transparency with 4 levels for 4x MSAA. It’s very useful for foliage. It was cheap enough that we just enabled it by default instead of making it a material option.

Specular aliasing is an extremely difficult problem, and without Temporal AA it’s definitely way worse. There are some areas for research but they’re all unknowns.

Atmospheric fog isn’t handling MSAA correctly yet (much like dynamic shadows). For height fog we got around this by defaulting to vertex fogging (project setting), which means it is computed in the forward BasePass and therefore anti-aliased correctly. Atmosphere is still computed in a deferred pass off of resolved scene depths so it doesn’t anti-alias correctly. Hopefully something we can fix in the future.

SSAO without normal can be made to work. SSR at lower quality can be made to work in the same way that SSR works on translucency in the deferred renderer. As to when we’ll get to these - hard to say as we’ve found they behave poorly in VR.

This is really great news, however, can you tell me if this is enabled in the the latest 4.14 preview? I cannot seem to get MSAA coverage working when I try it with my masked materials, below is my material and my editor settings, am I missing something here?

f5487906cd38ae501944ad437036688123602fd3.jpeg

Result In Editor:

alphatocov02.jpg

Note: MSAA seems to work fine on opaque geo, so it is definitely enabled.

It behaves poorly without TAA, but with TAA it looks great, even in VR. Just TAA behaves poorly in VR. Thats why I asked about this:

It is looking very bad in VR because of these artifacts which are in screen space, so those individual points stay at the exact same pixel all the time, looks very wrong in VR:

&d=1470336062

But once it’s blurred, that problem goes away and SSAO looks great in VR:

&d=1470336112

What do you think about it? Shouldn’t be too hard to make that an integrated option for SSAO with MSAA or FXAA, right? The code is there, just needs to be integrated to UE4 :slight_smile:

I completely agree about SSR, that is already problematic without VR since reflections suddenly disappear on the edge of the screen, but in VR that looks even more wrong. And it’s quite expensive, a lot more than SSAO. I tried to use SSR in VR for a while, but it just doesn’t work.

+1 for this - I really wanted to enable SSAO in certain light scenes, but the noise pattern being stationary across the view is yuck in VR.

It seems to work when you enable Dithered Opacity Mask in the Material. I’am not sure if this is the right way to go, though ?!

Are you sure? I just turned on dithered opacity mask and got this:
dither.JPG

Can you post a pic of it working?

It looked like this with foliage, guess i was wrong there. Sorry. I tested it again with FXAA and the foliage looked better.

Currently the performance with 4xMSAA in a scene with lots of foliage is also worse than with the deferred renderer + FXAA. At least for my project.

Shouldn’t MSAAx2 be enough? MSAAx4 would have leaps and bounds better image quality than deferred+FXAA in VR.