Skeleton code to start a new renderer (Metal, Vulkan, Direct3D…), OpenGLES improvements

Posted on

It's a skeleton, symbolizing the "skeleton code" of a new renderer. Get it? Get it? I'm so funny... Human Skeleton by glendonwaldner from .

1. Adding new renderer to the engine

I sometimes get questions “Will there be another renderer available in the Castle Game Engine?”. My answer was always this: “Yes! Contributions for this are most welcome. It is just not my own priority now, because the current renderer (using OpenGL / OpenGLES) works great, and it works on all platforms.”

To make it easy for everyone to actually start experimenting with a new renderer, I wrote a simple example code that shows how you can start a new renderer. Just fill the TVulkanWindow.Open and TCastleSceneVulkan.LocalRender and test on any 3D model 🙂

And if you have something (even just a start!) ready, don’t forget to show it on our Discord or forum (bonus points if you will already show a CGE fork on GitHub where it can be tested). This will make Michalis extremely happy:)

2. OpenGLES: suggestions for new contributors

If you know your way around 3D coding, and you’re looking for interesting tasks to implement in the engine, please take a look at our OpenGL ES (Android and iOS) TODOs. This page describes 6 features that are implemented in OpenGL, but are not (yet!) implemented in the OpenGLES version.

Some of these tasks are “relatively easy (and fun!) with high reward“. You can make a cool graphic effect working on Android and iOS. The groundwork is already done (since it’s a feature already working for OpenGL), and your job is to adjust the code to work also on OpenGLES. E.g. you can activate shadow volumes on OpenGLES just by changing the current fixed-function shadow volume rendering to use shaders (the desktop OpenGL rendering will be upgraded by this too, of course — we don’t need a fixed-function implementation of shadow volumes at all).

3. Renderer improvements implemented lately

  • Gouraud shading in the shader pipeline now honors ccw field correctly. The Gouraud shading performs one-sided lighting, and now you can control which side receives the lighting using the ccw field, see the link for details.
  • 2D rendering (TGLImage, DrawPrimitive) since some time uses shaders by default on desktop OpenGL.
  • Occlusion query (Scene.Attributes.UseOcclusionQuery) does not use the fixed-function pipeline anymore.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.