Our graphics team wanted to share a little bit about the optimization process of the character rendering and shading. These are the things that give the final style and look of the character after all the lighting effects are implemented. This is the work that adds “soul” to the final characters, and is also implemented onto all other items in-game.
Just like in any devlog, we like to keep the community up to date with developments of the game. We are releasing these logs in not a sequential order but more in a random manner. Also when we share one thing, it doesn’t necessarily mean that team is strictly working on it, rather these are the things that we find interesting.
Today we wanted to show some info about the tweaks and configurations that we do for the shaders within our game. Specifically the skin shader.
As we are looking for a feel between stylized and PBR (Physically Based Rendering), we had to create a “Stylized PBR” shader for characters in-game. The testing process started by making an initial shader that takes light data and renders it in a non photorealistic way, extenuating the reflection of light and shadows on the mesh geometry.
Above, you are seeing the video of the changing lights and the different presets of the shader in the testing phase, included ones that are mat and don’t take smoothness data, while others reflect rim light, on the area where the direction of the light is at 90°, perpendicular to the faces of the sphere .
Issue : Skin shader smooths the normal map data on the dwarf.
After tweaking the shader’s light data calculation and adding some more code the result is looking promising and now we can see the full range of details, that the normal map contributes the Stylized PBR workflow.
Now the shader is able to compile normal map data without getting it missed up with the general light capturing, because the shader is aiming to deliver a stylized finish. Therefore we want to maintain that look but at the same time we want the normal map to be separate from the lighting calculation.
We went from this bland flat look:
To this after enabling “ shadows on the edges “:
And finally to this after adding the the influence of the ambient light and specular lighting:
The next step would be to control the intensity and the colors based on the lightning direction.
The persistent issue at the moment is the fact that once the dwarf is not facing the directional light we lose lighting on that face. And we end up with something like this.
All details are lost. In order to fix this issue we are making the shader not react to lighting. This way we would always have it rendered lit even if the scene has no proper lighting involved, and we can adjust the darkness contribution with coding instead with automatic real-time lighting reaction.
This is why we opt for a custom shader than the lit PBR shader unity already had.
This is the look of the dwarf with the default lit shader in unity:
Stylized PBR shader is supporting normals and isn’t reacting to light direction:
Stylized PBR dwarf skin reaction throughout the different position of the light source, to mimic a day, dawn and night-time lighting.
The details and the skin illumination is maintained. The character is ready to be included in Mist Metaverse.