Compile Shaders Loop

Note: Right click video and switch on “Loop” to see it better.

Games get more complex and loading gets longer, especially the first time with complex shaders. If you have to wait for this wait not have a bit fun while doing so? In German we call this “nach fest kommt ab” :smiley:

This animation I created for the Drag[en]gine game engine for loading times. This is the full render I used to downscale to half the size before use.

Animation done using Blender 3. Materials use mostly no texture maps only flat colors.

Here also some screenshots of the setup and cast:

Note: Wrench model is somewhere from the internet. Gears are from Blender. The rest is done by me.

2 Likes

So am I correct in saying that the compiling step is once again considered a blocking operation in Drag[En]Gine?

I know it is the same story in other popular engines, but the Blender devs. found a way to keep things (somewhat) interactive when Eevee is doing it.

It is a nice animation though, how many times does it loop on your project?

You can not directly compare this.

The Drag[en]gine OpenGL module uses pre-made shaders since the user uses a physical material property system not messing with shader graphs. OpenGL though does not support pre-compiling shaders.

The first time (after installing or updating) a game using the Drag[en]gine is run the shaders have to be be once compiled and are then cached on the user system. Loading shaders from the cache is rather fast and hides inside regular game resource loading. Compiling shaders though takes longer depending on the GPU driver.

So the lengthy process of compiling shaders happens once the first time a game is run. For all subsequent runs the shaders are loaded from the cache which is fast. Shaders are also loaded once. Hence in contrary to other game engines you see the loading only once until you restart the game.

Also compiling shaders is by the way done in a loader thread. Hence this step does not block the main thread nor the render thread unless somebody requests synchronous loading of resources. This animation is only shown on screen to let the user know why loading the game for the first time takes longer than running it again later.

So in brief this loop is shown once at startup time for a longer time the first time “any” game started. For all subsequent games started it is shown only shortly once at startup time.