HTML5 Setting AntiAliasing Quality to 1 or 0 hangs game

Setting the AA Quality to 1 or 0 using sg.AntiAliasingQuality in the console causes the game to hang in the browser. There’s nothing in the browser console or the debug output from the game detailing any errors. The game just freezes. AA Quality settings of 2 and 3 both work fine.

I’ve observed this behavior in both 4.17.2 (Firefox 64-bit) and 4.18 Preview 3 (Firefox 64-bit and Chrome 64-bit).

Browser versions:

Chrome 61.0.3163.100 (Official Build) (64-bit)

Firefox 56.0 (64-bit)

Steps to reproduce:

  1. Create a new project. I choose Third Person C++ with no starter content.
  2. Launch or Build for HTML5.
  3. Open console and type in sg.AntiAliasingQuality = 1 or sg.AntiAliasingQuality = 0
  4. Game will hang.

The expected result is that the game will operate normally and reduce the AA quality like it does in the editor or a Windows 64 build.

This sounds like a new one, great find!

Do you know if it is just the rendering output that disappears/freezes for some reason, and the content would actually be continuing to run on the background? I wonder if for example after setting sg.AntiAliasingQuality = 1, is it still possible to set sg.AntiAliasingQuality = 2 in the console by writing blind on the console. Does the CPU usage of the browser drop to 0% after the hang, or does it look like it’s still rendering/processing an event loop on the background in full steam?

Try doing a Development build, and after the page hangs, open the web page console, and type

document.getElementById('logwindow').style.display = 'block';

to show game’s console window (there will be a button in the future to toggle the log window). That might have an assertion failure message that was not otherwise shown.

Hi juj!

Sorry that’s what I was referring to by “debug output from the game”. I used the wrong term there, my mistake!

When using sg.AntiAliasingQuality = 2, the logwindow says

[2017.10.07-06.58.55:357][820]Warning: Processing the console input parameters the leading '=' is ignored (only needed for ini files).
[2017.10.07-06.58.55:357][820]sg.AntiAliasingQuality = "2" 

When using sg.AntiAliasingQuality = 1, the logwindow says the same thing

[2017.10.07-06.59.29:740][883]Warning: Processing the console input parameters the leading '=' is ignored (only needed for ini files).
[2017.10.07-06.59.29:740][883]sg.AntiAliasingQuality = "1" 

While in the hung/frozen state, the game uses the same amount of CPU as before (Firefox is reporting 4-5%) and same amount of RAM.

Following your suggestion of just trying to blindly open the console and set the AntiAliasingQuality back to 2 or 3 actually does fix the game. It works again. However setting it back to 1 or 0 freezes it again.

[2017.10.07-07.00.54:104][945]Warning: Processing the console input parameters the leading '=' is ignored (only needed for ini files).
[2017.10.07-07.00.54:104][945]sg.AntiAliasingQuality = "3" 

So the game itself is still running, the screen just stops updating but it can still accept and process input.

Interesting. I’m not familiar with the different antialiasing methods. Perhaps the quality between 0/1 and 2/3 are fundamentally different somehow, where 0/1 uses an incompatible method that is unable to render at all.

Btw, something I probably should have realized to mention in the very first message: currently in UE4 HTML5 builds, antialiasing is not supported at all. This is because WebGL 2 lacks the needed GL extension to enable antialiasing (https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_multisampled_render_to_texture.txt). That is an extension that was only added to OpenGL ES 3.1 core specification, whereas WebGL 2 currently is up to par with OpenGL ES 3.0 only.

OpenGL ES 3.0/WebGL 2 core specification does have a different (bit weaker) form of MSAA when one uses renderbuffers, but that is not enough for UE4. We have had conversations with the WebGL working group to introduce EXT_multisampled_render_to_texture to WebGL 2 as an extension for this reason, but so far that has not yet progressed. Hopefully WebGL will get there soon, after which UE4 should get antialiasing “for free” with their existing implementation.

I could have sworn that there was a visible difference between 2 and 3, but now going back and actually looking carefully, I see no difference. I think you’re right and there’s no AA at all. Thanks for making me take a second look at that, juj.

I guess AA is more of a feature request already on your radar than a bug; however, setting sg.AntiAliasingQuality to 0 or 1 shouldn’t freeze rendering. It should just do nothing or even better display an error in the logwindow stating that AA isn’t implemented for HTML5 yet due to a missing extension in OpenGL ES 3.0/WebGL 2.

Thanks again, juj!

Hello DanimalsOnParade,

Thank you for your feedback, I did some digging and found that there is known a request for this (Anti Aliasing Support For HTML5) to be supported.

Make it a great day