Does UE4 support OpenGL ES3.0?

In the build settings for android, there are options to support OpenGL ES2 and OpenGL ES3.1, but there are no options to support OpenGL ES3.0. Is ES3.0 actually supported? The mobile preview always shows ES2. The jump in functionality between ES2 and ES3.0 is pretty large, and given that only the newest phones support ES3.1, wouldn’t it be better to be able to target ES3.0 devices?

Hi vle07,

From my understanding and what I’ve seen, it already is supported. When you package for ETC2 it’ll use ES 3.x. ES3.1 is experimental and requires a source build of the engine from GitHub to even work currently.

I hope this helps.

Tim

Is it possible to sample textures in the vertex shader (specifically feeding into the world position offset)? From my understanding, ES3.x should support vertex texture sampling (even ES2 can support texture sampling on some devices if the texture2dLod function is used), but I can’t get the texture2dsampler node to work. I’ve tried setting an absolute mipmap level, and I’ve also tried creating a custom expression node to call texture2dLod. Even setting my build settings to ETC2 like you suggested, I still can’t get vertex texture fetches to work.

Do you have any suggestions? I think the material nodes just aren’t giving me access to the correct texture sampling functions. The next thing I could try is writing a custom shader and adding it to the engine, but that seems really complicated (and the only sources out there are outdated).

Using the “ES 2” checkbox supports ES 3.0 devices and we take advantage of many features ES 3.0 features when they are available. Even with the ES2 checkbox, we compile shaders targeting ES 3.0 when launched on ES 3.0 devices. The ES 2 checkbox would be better described as “ES 2 - 3.0”. The main limitation of the “ES 2” target is that it only supports 8 texture samplers because that is all that is guaranteed. I’m surprised you could not get vertex texture fetch to work. Looking at the material compiler (HLSLMaterialTranslator.h, TextureSample function), a TextureSample node should work for WorldPositionOffset provided you set the MipValueMode property to “MipLevel (absolute, 0 is full resolution)”

In version 4.13 we added a new ES 3.1 checkbox (not ES3.1+AEP which is an entirely different renderer intended for Nvidia Tegra K1 devices). Using the new ES 3.1 checkbox removes the need for a lot of the compatibility work-around code we use for the ES2 renderer because it can assume more available base functionality. It uses uniform buffers which improves performance for things like skeletal mesh renderering, and in this mode materials support 16 texture samplers. Incidentally this is the same renderer we use for Metal on IOS devices, and Vulkan on Android.

  • Jack

I took a look at HLSLMaterialTranslator.h, and it looks like there’s two if statements that work together to prevent texture sampling in vertex shaders in ES2. The first says “Sampling from vertex textures requires an absolute mip level on feature level ES2!”, the second says “Sampling for a specific mip-level is not supported for ES2”. I commented out the second if statement, and vertex texture sampling now works in the level editor mobile preview. But it still doesn’t work when I launch to my device, giving the warning “Failed to compile Material for platform GLSL_ES2, Default material will be used in game.” Is there no way to force it to only use ES3? It seems like the features are being limited to ES2, when my phone is capable of ES3. Also, doesn’t ES3 have more than 8 texture samplers available? So what would be the benefit of capping it to 8 textures if I’m not targeting ES2 devices? Thanks!