Dorian is now almost on par with it’s POC (Proof of Concept) in terms of outward functionality.
It now supports skyboxes – that is the sky domes that you see in games.
Unlike the POC, Dorian’s skyboxes can be rotated and Dorian can detect where the sun is and automatically setup the appropriate directional lighting!
For those that don’t know yet, I have had to write this new graphics engine because the one currently in Sojour is no longer supported by Microsoft’s development tools because it is 32 bit only.
This is why producing a new 64 bit graphics engine is critical to taking Sojour forward, even if it seems like a diversion.
Dorian now supports skyboxes and auto-light source detection! (Best watched on You-Tube at 4k)
Dorian now supports cascading shadow maps for better quality shadows! (Click to see full size!)
What are Cascading Shadow Maps (CSM) and what does it achieve?
Shadow map based systems create a depth texture representing the scene depth from a light source’s point of view. This depth texture is then sampled across a whole scene from the camera’s point of view to work out what’s in shadow and what isn’t.
The issue with shadow maps is that the greater the range of depth that you are dealing with, the more the depth texture has to be stretched in terms of its depth to cover all possible values. ie you are trying to squeeze larger ranges of depth information into the fixed number values that a single pixel can hold. This can then lead to sub-par shadows.
You’ve probably seen these low resolution shadows in some commercial games where the shadows have jagged triangular looking edges.
Dorian’s CSM system gets around this by creating multiple depth textures that are range dependent. These are called cascades. Each cascade is responsible for creating shadows over a specific depth range.
Having multiple depth textures in cascades reduces how much each one is stretched out to fill the scene depth. What’s more, these cascades are tuned so that the nearer cascades have smaller overall depth ranges (less stretching). This results in pin sharp shadows!
Medium to long distance cascades have larger depth ranges which results in fuzzier shadows, but in these cases the objects are far enough away that a player won’t notice.
The overall impression that the player gets is one of pin sharp shadows!
The image at the top of this post shows the effect of ramping up the cascades – Dorian supports differing numbers of cascade on a per light source basis.
The one cascade image on the left is what a typical shadow mapped engine looks like. The shadows don’t look too bad in that example, but the bigger the world, the worse it gets – and the demo world above is very small.
Note that as I add more cascades, the shadow quality improves
I’m happy with the shadows system but I still have a lot more work to do and this work should be done now whilst the iron is hot.
Why?
I tend to forget hard won knowledge unless I continually work at it. I had the same issue with Ionian – the previous graphics engine. That graphics engine lasted over twenty years – but it was so reliable that I rarely had to look at its code, which resulted in my graphical knowledge draining away.
It’s the driving reason why Dorian’s capabilities will be taken to a much higher level than Sojour needs, as the expectation is that once it’s done, I’ll rarely touch the actual code again – which means lost knowledge. Hence my determination to strike whilst the iron is hot!
That said, Ionian which is currently used in Sojour is no slouch. It can do real-time shadows – using shadow volumes, real time reflections, skyboxes and bill-boarding:
Ionian – Sojour’s current graphics engine as used in an early version of Ancient Armies (circa early 2000’s). Another shot of Ionian in action. The real-time shadows and reflections are especially apparent here.
I will need to get Dorian to a point where it can do everything that Ionian can do at the very minimum. Though my plans are for a lot more!
Working on a graphics engine seems like a diversion but it is critical for Sojour as the latest Visual Studio will not build 32 bit apps. Alas, Sojour’s current graphics engine, Ionian, is 32 bit only – hence the re-write.
On the plus side, Dorian is way more powerful 🙂
Dorian strutting its stuff! (Best viewed on You-Tube in 4K)
The ECS system in Dorian makes all the animations and camera movements completely trivial. It really is a joy to work with!
This is a video of the first version of it’s shadow system. It has one more iteration which is to make it use Cascading Shadow Maps then we are done with shadows and can then work on the next features!