Support GLES3 in engine

Hi!
I m add support for GLES3 rendering API and it features:

  • Instancing
  • Uniform buffer object
  • Multiple render targets
  • Texture2DArray
  • Texture3D
  • Support for textures: ETC2, sRGB, floating point, depth, 1 & 2 channel (R & R/G).
    Worked render pathes - Deferred, DeferredHWDepth, Prepass, PrepassHWDepth.

Sources - https://github.com/orefkov/Urho3D/tree/GLES3_Support

For build set option URHO3D_GLES3=1
For CMake need -DURHO3D_GLES3=1, for Gradle /PURHO3D_GLES3=1.

Builded for Android (arm64, armv7a) - https://yadi.sk/d/PYWhzveBu58epg
Please test on some devices.

In the builded version, there are no Lua and Lua scripts, and in the example 06_SkeletalAnimation.as added 70 point lights and deferred render path used. Here is a screenshot from the phone - CPU MTK Helio P60, GPU - Mali G72 MP3.

After test I will PR it at main repo.

18 Likes

this is great! and I really like your launcher. the ui is a bit small, but still functional. (I had to use back softkey to exit console, touch wouldn’t register at the close button.)

are you planning to add an option for user data, like scripts/resources in /sdcard/urho3d/?

Launcher is not my work, it is stock Urho3D launcher. Later I will publish my own laucher, which I use for develop script games for Android.

There seems to be a problem with shadows.


I test on VinSmart Active 1+ ( CPU: Snapdragon 660, GPU: Adreno 512)

Yes, a strange picture.
On my device, it’s like that.


Now, for optimization on mobile devices, shadows from distant objects are not drawn.
And for some reason you have a character far from the camera, not like mine.
Can you take a screenshot with the HUD turned on?

1 Like

Yes,

Confirm. On other my phone with Adreno same picture. I will investigate it.

3 Likes

I am not a very big specialist in OpenGL, so it took a couple of days to find the cause. As a result, it turned out that it was just necessary to set the GL_TEXTURE_COMPARE_MODE parameter to GL_COMPARE_REF_TO_TEXTURE for the shadowmap texture.

Now I corrected it, plus a few more edits - I activated the use of constant buffers in uniforms.glsl for tests, and corrected a few more minor errors. I’ll make a commit soon, but for now, using the same link https://yadi.sk/d/PYWhzveBu58epg, you can download a new build for testing.

Here I checked the shadows on Adreno:

… In Mali:

Even on the old weak Adreno 330, deferred rendering works (although not so fast, but for its power the scene is complicated)

In general, according to https://developer.android.com/about/dashboards/index.html#OpenGL - OpenGL ES3.0-3.2 occupies about 80% of devices, it is strange that there is so little interest in adapting the engine for ES3. Using only ES2 now you will not achieve much on Android - there is no intansing, no ETC2 - the biggest problems.
I hope, with my improvements for ES3 and to improve interaction with Android (https://github.com/urho3d/Urho3D/pull/2538), the engine will be an excellent choice in the niche of creating Android games.

11 Likes

Yeah, this is great ^^

By the way, I noticed that in terms of instancing on GLES3 Urho3D works better than Unity. In particular, Unity disables the use of instancing when working in GLES3 on the weak models of Adreno (330 and others, with the GL ES 3.0 driver), while on Urho3D, the instancing on these GPUs works. This is due to the fact that Unity uses the uniforms array for instancing and fetching from it through gl_instanceID, which does not work correctly on these drivers. Urho3D uses vertex buffers with instanced attributes and glVertexAttribDivisor. They work correctly on these GPUs, and in addition, they allow transferring a much larger number of instances per draw call than when using uniforms arrays.

6 Likes