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

Posted on

Occlusion query demo on Android
Occlusion query demo
Occlusion query demo on desktop

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.

Notable Replies

  1. 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 ?

  2. 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.

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

  4. 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”).

  5. 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:

Continue the discussion at Castle Game Engine Forum

1 more reply

Participants

Avatar for sledge Avatar for michalis