Mobile (OpenGLES) rendering upgrades: occlusion culling, anisotropic filtering, 3D textures, shadows; plus new occlusion query demo

Our OpenGL and OpenGLES code is now more streamlined, which allowed to “unlock” various rendering features on OpenGLES.

This means we will use some features from OpenGL ES 3.0, if it is available:

Note that we still require only OpenGL ES 2.0. The OpenGL ES 3.0 features are optional for us.

Moreover:

  • Anisotropic filtering is now supported on OpenGLES, through an almost universally-available extension, just like on the desktop. See e.g. anisotropic_filtering demo. (Yeah, we should have a more comfortable way to adjust anisotropic filtering visually — I have 2 ideas about this, will explore them.)

  • We also fixed support for rendering shapes that require 32-bit indexes. While OpenGLES 2.0 guarantees only 16-bit indexes (OpenGLES 3.0 bumps it to 32-bit), we now automatically deal with it inside a renderer, if necessary doing additional processing to enable bigger meshes even for OpenGLES 2.0. This can be tested using fps_game on mobile.

1 Like

So much progress !

I needed to search a bit. Does “Occlusion Query” also inculdes “Occlusion culling” ? From my understanding:

  • OC = don’t draw objects that are outside the camera frame
  • OQ = don’t draw objects that are behind others, that are not visible

Does CGE has both features ?

The terminology we use is:

CGE does:

  • “frustum culling” by default. You can control it using TCastleScene.SceneFrustumCulling, TCastleScene.ShapeFrustumCulling , see Castle Game Engine: CastleScene: Class TCastleScene .

  • “occlusion culling” if you activate it, following Occlusion Query | Manual | Castle Game Engine (RenderOptions.OcclusionQuery := true). See new “examples/viewport_and_scenes/occlusion_query” demo.

  • note that we also have “distance culling”, esp. nice when you have dense fog that limits visibility beyond a certain distance. See “examples/viewport_and_scenes/fog_and_distance_culling” demo.

Okay. Got it. Thanks for making it clear :+1:. “distance culling” is really something useful !

Note that, as I saw both Godot and Unity using terms “occlusion culling”, and I like it more too (it’s a more general term, and consistent with “frustum culling”) → I will do some renames in our terminology to be simpler, and just use “occlusion culling” term in CGE more (instead of “occlusion query”).

Nevertheless … we all learn from here. If we need to search something specific, we know the name now (or we know some more terms) :slightly_smiling_face:

Note that the renames to “occlusion culling” are finished now, along with renderer improvements just announced on Big renderer improvements: Correct and automatic blending sorting, more powerful batching (now cross-scene), easier and more reliable occlusion culling and occlusion sorting – Castle Game Engine . So CGE naming is consistent at least with Unity and Godot.