Lighting and Reflections - Dev Blog #22
Updated: Apr 14
Lighting in Techblox
The lighting and materials in Techblox are going to be pretty special as a result of us using Unity HDRP for the rendering. This blog will talk a little bit about some of the features we’re using:
HDRI Sky image provides physical light
First up is the sky, which is a 8k HDRI panoramic image. Having an image in the sky isn’t really a new thing, games have had that for years, but in Techblox, every pixel in that image is contributing to the ambient and bounced lighting of the scene.
So, the pixels of that 8k image are being raycast through windows like this and bouncing around off of physically simulated materials (metals, plastics, woods etc.) depending on how shiny, metallic, or translucent they are.
This information is baked into textures for static parts of the world and baked into ‘Light Probes’ for dynamic objects.
Glowing surfaces emit lights too. These don’t just look like they are glowing but actually emit bounced light in the baked scene, so the ambient light in this workshop comes from the Sky, and the emissive material on the strip lights (not the realtime lights placed in the scene). For emissive material we have to specify the brightness of the material in ‘Nits’ which is a light parameter (you might be more familiar with Lumens). Here is an image of the light probes in this scene.
So as objects move around the scene, they are affected by ‘Direct Light Sources’ like the sun and strip lights in the room, and also by the ambient light levels recorded in the probes.
Then there’s reflections. Reflection probes render the world from the perspective of the probe and store these as textures. Here is a single reflection probe:
All objects that are within the influence area of the probe receive their reflections from the probe, so even relatively non reflective surfaces like wood are picking up a subtle sheen and the colours are coming from the reflection probe.
Reflection probes can be placed at key intervals around the scene. In the case of a race track you may want to place quite a few along the road so the vehicle's reflections are always representative of the reflections surrounding the cars.
We can place a few reflection probes in a scene like this:
Here you can see the ‘influence volumes’ as well.
It is possible to update these reflection probes at the start of a loaded level, so in the case of worlds built by players, we can render all the probes on frame 0 when the level is loaded and then freeze them to maintain high frame-rates during gameplay. It’s even possible to update them every frame but that’s expensive. Potentially we can have a reflection probe that follows the player's machine and renders every frame for the highest GFX settings so that the reflections in your machine are always as if you’d ray-traced them. Something we can explore later.
Even the camera is physically representative of a real-world camera. Here are a few of the settings on the camera.
There are loads of post process effect possibilities. Most commonly we’ll be using Anti-aliasing, Ambient Occlusion, Tone-mapping, Bloom, Volumetric Fog and Exposure. Exposure is a neat one. It allows you to control the total amount of light coming into the camera, so it allows you to ensure that a scene's lighting is balanced for the eye, based on what’s on screen. In this example of Exposure below the effects have been ramped right up so you can see the effect, but as you can see, when looking directly at bright surfaces the overall exposure is dimmed to balance things, and then when you look away to a less brightly lit part of the room the exposure automatically adjusts to balance things. Of course, in the real world your eye does this by adjusting your pupil to let less light in when you go from a dark to a light place. Without this in a game, you have to pick a midpoint and fix it, but that makes everything look less real.
A playable Pre-Pre-Pre-Pre-Pre-Alpha is now available! Make sure to visit our home page at http://www.techblox.com/ to sign up to play it!