ETC2_RBG which is not supported

We are trying to package our data to run on the GearVR. We have successfully launched the application in GearVR but are having difficulty packaging it. So in the Editor, if we select Launch and select the android device, it appears to start building data for the ASTC texture format. That builds successfully and deploys to the device and we are able to play the game mostly correctly. There are a number of textures that appear to be still using the default material that we don’t see in the editor, but it does run. Given that, we would like to now package the data up so I select File\Package Project\Android\Android (ETC2). This starts the process of packaging the data but we get a large number of errors that looks like this:

MainFrameActions: Packaging (Android (ETC2)): UE4Editor-Cmd: [2015.12.14-19.06.07:764][ 0]LogInit:Display: LogTexture:Error: Texture2D /Engine/EngineMaterials/InvalidLightmapSettings.InvalidLightmapSettings is ETC2_RGB which is not supported.

I have also tried Android (ASTC) with similar texture errors.

I did some digging and found that the ETC2_RGB format is by default disabled and only appears to be enabled if we detect OpenGL ES 3.0 or greater. We are currently on AndroidWorks1R1 using Visual Studio 2013 on Unreal Engine version 4.10. I messed around with enabling the “Support OpenGL ES31 + AEP” option in the Android project settings but no luck. I also ensured that bBuildForES31 was set to true in our DefaultEngine.ini.

Looking through the logs when we launch the project vs. when we package the project, the textures that it is complaining about during packaging, do seem to be cooked correctly when we launch the project. I’m wondering what is different about the cook process when we launch vs. when we package? Or has anyone run into similar problems and may know what we are missing in our current project?

Hello brantfrench,

I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. What device exactly are you using with the Gear VR?
  2. What version of the OS is currently being run on the device?
  3. What version of the Gear VR are you using?

We are using a Galaxy S6 device. The OS on the device is Android version 5.1.1. I don’t normally use the GearVR device. I just put the phone in GearVR developer mode. So I hacked around the problem just to verify that it could work by just forcing those textures types to be supported during the cook process and it successfully builds the package and we were able to run that on the device. So it seems like it is just a matter of figuring out how to tell Unreal that it’s OK to build ETC2 or ASTC texture formats for our project.

I have some additional questions for you to help narrow things down further.

Additional questions:

  1. Can you reproduce this issue in a clean project?
  2. If so, could you provide a detailed list of steps or a sample project to reproduce this issue on our end.

Unfortunately, we haven’t been able to reproduce this on a new project but we have been looking into differences in our project vs. the stock project to see what is causing this. The project that isn’t working was not started as a GearVR project. We’ve been trying to convert it over and this seems to be the only remaining issue. We have actually been able to create a working package using the Launch\Project Launcher option in the editor by setting up a custom Launch Profile that tells it to package the data. I’m not yet sure if this works fully without the hack I put in to make all texture formats supported but if so, we may just go with that for now. I’m just not sure what the differences are between cooking using the Launch menu vs. the Package Project menu.

So I got back to the point where I could revert my texture hack and unfortunately we get the same error trying to package the files with both the launch and package project method. So this is something that we will need to figure out. So looking at OpenGLDevice.cpp, it looks like the ETC2 formats should be enabled if FOpenGL::SupportsETC2(). That looks like it only gets set if bES30Support is set in AndroidOpenGL.cpp. That is set if the GL_VERSION string contains the text “OpenGL ES 3.”. Now I think we are building OpenGL es2. I have tried enabling es3.1 using the checkbox in the Android project settings but we still get this error. I know I’ve seen several videos of people using ETC2 textures without checking that box and that was not necessary on the project we have that was set up for GearVR. I have not been able to pin down what the actual GL_VERSION string is as we can’t step into this while its running the cook. Not sure how this gets executed from the editor. I have tried just forcing the bES30Support boolean to true right there, but that didn’t fix the texture support issue. Either that change didn’t get picked up when I recooked or that was not the real problem.

I’ve traced a different problem we are having back to similar code. We were running into masked materials not compiling correctly so falling back to the default material. So I tried enabling OpenGL ES 3.1 in the editor. That appeared to clear up the errors during cooking. However, it crashed when I went to run it because it was saying the shaders were not cooked for the ES2 target. I thought this was strange because I told it to cook both code and data for ES31 and it successfully built ES31. Looking back through the logs, it looks like it failed to find the extensions so it fell back to ES2 which is I believe why it’s failing to load the shaders. Looking through the code at how it could fall back to ES2, I ran across very familiar code in OpenGLES31.cpp in the SupportsAdvancedFeatures function, where it looks to see if the OpenGL version string contains the text “OpenGL ES 3.”. That is the exact same problem we are having with the ETC2 textures not being supported. The version of the OpenGL libraries we have in our project does not support OpenGL 3.0+ but the stock Unreal project does. I was expecting that to be brought in with the AndroidWorks1R1 setup, but now I’m wondering if that is maybe built into unreal and perhaps we just don’t have the right version of the OpenGL files or something? Any idea what we should be looking at to figure this out?

A little more information about this. I printed out the glGetString(GL_VERSION) and it was garbage text so obviously didn’t have the “OpenGL ES 3.” text in it. Not sure what could be causing that.

Hello brantfrench,

After doing some digging I found that the Gear VR does not appear to support OpenGL 3.1, this appears to be a limitation of the device. As for having access to OpenGL 3.1, this is only supported through GitHub Source. I hope that this information helps.

I hate to say it, but I’m back to this problem. We had a workaround that allowed us to package the data which was working. However, now I’m realizing that textures are not being compressed. I think I’ve tracked that problem down to the same problem I was having here. Our OpenGL version string is garbage so it doesn’t think it supports OpenGL 3. Specifically, I’m looking at AndroidOpenGL.cpp in the ProcessExtensions function where the const bool bES30Support is set. That seems to ultimately makes its way to the point where the ETC2_RGB and ETC2_RGBA format support is turned on. I’ve tried simply forcing bES30Support to true in this file and rebuilding both the editor and Development Android, then repackaging the content but this change does not appear to be getting picked up. Do I need to rebuild something else to get the repackaging to pick up this change? I’m not sure how this code is executed during packaging.

Hello brantfrench,

Would it be possible for you to provide the project that you are having issues with so that I could take a closer look on our end?

Hello brantfrench,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.