After a week of studying rendering algorithm, light simulation equation etc I was able to implement a full PBR (physical based render) in SuperTuxKart. Let's see what changes and what it means for artists.
Here is an example (left is in Substance Painter with unreal engine preset) (right is in SuperTuxKart)
background
So first of all let me answer a question:
Why do we need to change? Is it really needed
The rendering system of Antarctica (SuperTuxKart's engine) is using a strange combination between traditional rendering and PBR.
It makes the system cumbersome and difficult to understand.
* New artists must learn from ground a material setup that is only used in SuperTuxKart and in no other software/engine
* There is no resources other than our website and easy way to create a material. We need pretty much to adapt all assets by hand + verify the result in stk.
* We can't preview easily in other software like Eevee (blender's new viewport). We don't need to load every time stk to check the materials.
* The previous system only allowed to emulate non metallic surface. Now we can emulate all materials correctly.
Basic concept of the new material system
In order to setup any material you must answer a few very easy questions
The first texture input is what we would call diffuse in the old system. Now it's named albedo or baseColor
* What is the color of the material, without shadows or shades. The pure color of the surface
The second texture is normal map (this doesn't change compared to the previous system)
The third map is what we would call a gloss map in the old system. Now it's named glossiness and it's a combination of three different maps (to save memory)
* The red channel How is the surface of the material: Polished or rough? 0 = unpolished / 1 = polished
* The green channel Is the material a metal (like bronze, steel) or anything else (plastic, wood, etc) 0 = non metalic / 1 = metal (dielectric)
* The blue channel (like before) Is the material emitting light 0 = doesn't emit light / 1 = emit light
By default all values are set to 0
OMG as an artist does it mean I will have to redo everything?
Nope, all assets with the current system look surprisingly good.
I will take some time to convert them however it's not a necessity because most of them don't use a gloss map anyway.
All future assets will be created to fully use the new system.
How can we test it?
Currently it's in a custom branch. It will be soon merged into the main game. I will also create the first map to take full advantage of the new material system.
Here is a quick test made in substance
There are slight discrepancy between the result in other engine and stk however it's a bit beyond my knowledge why is it happening.
If anybody has knowledge of rendering equations, please let me know. Any feedback would be appreciated.
Have fun!
Sam