After two months of vigorously sweeping through thousands of lines of code, ripping out old systems with new ones and altering the architecture of the renderer we are very proud to present a much more visually stunning engine! With brand new lighting algorithms, advanced shadows, new post processing and more detailed GPU diagnostics, Bright Engine has drastically improved both its performance and results!
If you are interested in Bright Engine and want to snag up a free copy you are welcome to join the Discord community Ask questions to existing testers, get real time development progress updates or even download the engine to try it out for yourself!
In order to achieve accurate and realistic lighting for any game, reflections play a huge role. Even if they aren’t crystal clear like a mirror, the amount of detail reflected off a smooth surface defines much of the material properties and why it may not seem like it in real life, reflections are everywhere. This problem has puzzled game developers for years as simply reflecting the world in real time onto each object is far too expensive to maintain 60 fps. So how do games pull it off? Well, they fake it, with Reflection Probes!
A reflection Probe is an invisible point within the world which stores a baked render of the scene around it. Whenever an object is within the specified range of the reflection probe it will use the corresponding baked data when calculating the specular reflections. Through clever placements and smart blending between probes, you are able to effectively fake real-time reflections of your environment without your player even noticing and with virtually no impact on frame rate!
Bright Engine now has an entire Reflection Probe toolbox, including the ability to bake the surrounding environment from within the editor! This baking system has laid the foundation upon which we will expand for other baking solutions in the future, such as lighting and shadows!
Changes & Improvements
Bright Engine’s visuals while initially decent, simply weren’t decent enough and so we fixed that problem by pretty much rewriting the whole lighting system. But before we dive into that rabbit hole, we had to perform some clean up in our PBR shaders and discovered a lot of redundant code which was dragging performance down. While developing the Reflection Probe system we uncovered some serious maths errors when it came to normals. The calculation of the TBN matrix was incorrect but only noticeable when looking directly down on top a smooth surface which resulted in an inverted vortex reflection instead of the correct sky reflection.
As you can see we fixed the maths but at the same time found a much more efficient method of calculating the matrix which lead to a small boost in general performance of the entire scene! This further led onto our parallax occlusion mathematics. While it was correct, the chosen method resulted in a large unnecessary overhead so we re-wrote that too, and managed to get better results than before!
Now let's talk about lighting. Most of the problems that existed before were discovered to be caused by the incorrect normals but with the old method everything was treated as if it had the density of a neutron star when in fact in reality different materials absorb and reflect light in very different ways. Ever noticed that the lighting on dynamic foliage was horrible when a light source was placed near it? Well that’s because in reality light can partially pass through materials like leaves or skin illuminating the other side slightly.
The scientific term is Subsurface Scattering and that's exactly what we have added to the PBR shaders to fix this problem!
Materials now have a new collection of settings which allow you to control the intensity of the effect and apply thickness maps for additional level of detailing!
The process of Subsurface scattering has a history of being quite a performance intensive one, however our approach with thickness maps means it has virtually no impact on performance. But we have added options to disable it for individual objects where it is not needed!
Let's talk shadows. They remain one of the most costly rendering operations for modern engines due to the additional draw calls. Regardless, being the stubborn developers that we are we looked for ways to not only improve the quality of Bright Engine’s shadows but also increase their efficiency. This was no easy task and yet we manage to succeed! The biggest difference came from a revamped drawing architecture when calculating real time shadows for Point lights.
Aside from the faster data transfer between the CPU and GPU each frame, it also freed up 3 texture unit slots which was a particularly useful upgrade for the terrain shader as it allows for the possibility for additional textures to paint with!
Visually speaking, shadows got a complete makeover! With new options for fading and bias control, the quality of detail has significantly improved while giving more power to the user. One long standing problem, was shadows were calculated based on geometry which caused this visual error
While shadows are still geometry based (as this significantly improves performance) we added some additional trickery to introduce alpha consideration, solving the above problem and producing accurate shadows!
Onto more specific shadow casters, Spot Lights now officially cast shadows! This has been something we’ve wanted to add for a long time but kept pushing down the list due to other priorities. But after a long put off period, they are finally implemented (the community insisted!)
Last shadow upgrade was that of a directional nature. Directional shadows are probably the trickiest to get right, due to the notorious Peter Panning visual error. In layman's terms, this is where shadows become misaligned with their casters due to the inaccuracy of the depth buffer over long distances and Bright had a serious Peter Panning problem!
Truth is, it's just not possible to have a global solution due to the infinite possibilities of environment design, so we simply opened up the drawing settings to the user, and while not perfect, it is drastically better!
Moving on from lighting, the next biggest method of making stuff pretty is Post Processing and we have doubled the possibilities of our suite by adding a plethora of new effects and settings!
- Filmic Tonemapping has made its appearance with complete control over the color curve.
- Additional Color Correction settings to add even more vibrance and contrast to your scene.
- Refine your render clarity with sharpness modifiers
- Depth of Field with three dimensional focal point and transition blurring for epic results
- Chromatic Aberration for the simulation of physical cameras
When combined together, the improvements are frankly astounding!
The addition of all these new tools and rendering methods adds a lot more data to be diagnosed for the smart developer. We thought we would help out by expanding the GPU diagnostics suite to display a lot more useful information. Aside from more in depth analysis of draw calls (along with the inclusion of the newly added spot light shadows), Depth buffer visualisers have now been linearized so its significantly easier to see what is going on in the scene. We have also added a new real-time graph which tracks draw calls and performance, to visually show which parts of the scene are the most resource intensive along with identifying areas that may need further optimisation!
The final focus of this update was the Editor itself. Over the years of development our knowledge has expanded and looking back through old code fills your mind with questions like “what on earth is that rubbish?!?”. While it takes more time to continually improve code, we are determined to ensure Bright has always got the best possible architecture for both performance and general tidiness. This resulted in us spending a week reworking the Data Management system of Bright Engine. From a user's perspective, there will be no difference but when taking a look under the hood then a wonderful surprise lies in wait. We removed nearly 1500 lines of unnecessary duplicated or redundant code, while also streamlining lots of methods into a single function. Not only does this save on memory (albeit small) it saves us a lot of time when implementing new systems as we only have to edit one function instead of the original five (and that was just for adding an object to the scene)!
In terms of the less technical stuff, interactions with spot lights is now far more pleasant, with a new rotation system and a blocker to prevent you from setting the outer radius of the cone lower than the inner radius which produced some pretty nasty results.
We have removed the post processing section of the Render Panel as all the settings are now located within the Post Processing Panel itself, along with adding new visualisers for debugging.
And to top things off, we found further improvements to the UI integration reducing overhead allowing for faster data passing between the CPU and GPU and added helpful dialogs that prevents adding a model or texture to your scene if it is not located in the correct folder of your project (before it would just add it and crash).
- Fixed bug where duplicating an object without then editing it would prevent the zone from being reloaded.
- Fixed bug where changing the enabled state of post processing effects without changing any other settings would cause the data to save incorrectly, inverting the chosen settings.
- Fixed bug where Spot lights were not correctly reflecting off smooth surfaces.
- Fixed bug where adjusting the strength value of a spot light did nothing.
- Fixed bug where adjusting the flickering settings of a spot light did nothing.
- Fixed bug where the UI for flickering lights was not enabling/disabling properly when turning it on and off.
- Fixed bug where post processing settings for a zone sometimes would be reset for no particular reason.
- Fixed bug where Fog was not correctly rendered on terrain causing it to loose density if the camera was rotated.
- Fixed various mathematical errors in the PBR shader for Dynamic Foliage.
- Fixed bug where Disabling rendering Shadows caused strange artefacts on terrain and dynamic foliage.
- Fixed bug where Dynamic foliage was being incorrectly illuminated by Point Lights.
- Fixed bug where the sculpting brush would sometimes appear black.
- Fixed bug where creating more than one foliage layer caused dynamic foliage to draw incorrectly.
- Fixed bug where adding a new object to the scene didn't update the hierarchy correctly.
- Fixed bug where data wasn't being cleared from the memory correctly when generating textures. (memory leak)
- Fixed bug where deselecting an object by clicking in an empty space caused the 3D cursor to linger.
- Fixed bug where textures were being flipped upside down (this problem still persists for DDS format, temporary solution is to manually flip textures in image editing software).
- Fixed bug where texture quality and grid size wasn't being saved.
- Fixed bug where texture quality didn't apply to Terrain and Dynamic foliage.
- Fixed bug where selecting a texture for Terrain or Dynamic foliage caused an update even if the cancel button was pressed.
- Fixed bug where selecting a Foliage layer, then selecting a different object then re-selecting the terrain object caused a crash.
- Fixed bug where enabling SSAO disabled baked AO textures
- Fixed bug where instancing wasn't correctly removing objects from their corresponding cores if over 299 duplicates existed.
We now enter into our final update of the 0.1.5 series. As previously stated, these updates are entirely focused on improving on what we already have before we begin the next chapter of Bright Engine’s development (Gameplay). So what you can expect from the next update is a vast collection of bug fixes, general improvements along with a few new features to top off this rendering upgrade patch!