Search code examples
androidantialiasingunreal-engine4gear-vrmsaa

Is MSAA broken in Unreal 4.14?


I'm trying to use the new forward rendering with MSAA in GearVR, on a Galaxy S6. But there's definitely no antialiasing going on. At all.

After a lot of time searching online and in the editor I found the following variables which potentially could be related to turning MSAA on:

1. Window > Developer Tools > Device Profiles > Android:

  • r.MSAACount
  • r.MSAACompositingSampleCount
  • r.DefaultFeature.Antialiasing
  • r.MobileOnChipMSAA
  • r.MobileMSAA
  • r.MobileContentScaleFactor

None of the above seem to make a difference if I change them from within the Device Profiles editor within UEd.

2. Edit > Project Settings > Engine > Rendering > Default Settings > Anti-Aliasing Method:. Setting it to MSAA does nothing.

3. I also tried setting all of the previous variables from within DefaultEngine.ini and nothing.

There's got to be something I am overlooking. If anyone has any thoughts I'd really appreciate it.


Solution

  • Turns out that:

    1. MSAA is enabled by default for mobile.
    2. The Forward renderer in 4.14 has nothing to do with mobile. It's new only for desktop (i.e. HTC Vive and Rift).

    As to how to check that MSAA is indeed enabled:

    You can check when running on the device in the logcat by searching for: LogHMD: Enabling r.MobileOnChipMSAA, previous value 0

    You can also add a log (and recompile the engine) at OpenGLRenderTarget.cpp: line 201. You want to make sure you are hitting: glFramebufferTexture2DMultisampleEXT

    Since the else branch in this codepath would otherwise create a non multisampled FBO.

    The MSAA sample count however, appears to be hardcoded to 2 somewhere else in the engine source. After a long discussion in the Oculus forums I was told I could change the sample count (to have MSAA x4 for instance) at line 152:

    `// TODO: Mali supports 4x with similar hit as 2x, should we do something smarter here? Hard coded to 2 everywhere else
    
    const uint32 SampleCount = 2;
    

    But this codepath is not being executed when running on the device. So not sure where else the 2 might be hardcoded.