Sojour

The solo virtual table top

Tag: Dorian

  • Dorian now supports IBL!

    IBL in action!

    After a significant amount of work, Dorian now supports Image-Based Lighting (IBL).

    This is an important milestone because it dramatically improves how objects integrate with their surroundings, bringing Dorian’s rendering closer to the visual standards expected from modern graphics engines.

    What is IBL, and why do we need it?

    Traditional rendering engines calculate illumination using only the light sources present in a scene. While this approach works, it ignores an important aspect of real-world lighting: light scattering.

    Light is constantly bouncing off surfaces around us. The ground reflects light upwards, the sky casts ambient light downwards, and nearby objects subtly influence the colour and intensity of the light reaching other surfaces.

    In the scene shown at the top of the post, both the sky and the ground contribute secondary illumination to everything in view.

    Without these indirect lighting effects, objects often appear disconnected from their environment. They may be correctly lit, but they do not quite look as though they belong in the scene.

    The most accurate way to simulate these interactions is through ray tracing. However, ray tracing is computationally expensive and typically requires high-end graphics hardware to run smoothly.

    IBL approaches the problem from a different angle.

    In simple terms, it cheats.

    How IBL works

    IBL captures a low-frequency, 360-degree sample of the surrounding environment and uses that information to approximate indirect lighting.

    Some systems sample only the sky. Dorian samples both the sky and the ground, allowing it to capture a broader range of environmental lighting information.

    More advanced rendering systems go a step further and often use light probes, which can sample lighting from anywhere within a scene. Dorian does not currently support light probes – that’s a future story on the roadmap.

    A low-frequency sample of the surrounding environment. This is known as an irradiance map.

    At runtime, Dorian tracks the orientation of the environment relative to the camera and uses the irradiance map to influence the lighting calculations applied to objects in the scene.

    The result is subtle but important: objects begin to inherit colour and lighting cues from their surroundings.

    The effect in practice

    You can see the effects of light scattering on this TIE Fighter

    The underside of the craft picks up a slight green tint from light reflected by the ground, while other areas receive warmer tones from atmospheric scattering and the sky.

    Normally these colour shifts are extremely subtle, but they help convince the eye that the object genuinely exists within the scene rather than being placed on top of it.

    However, this effect is a lot more pronounced on the TIE Fighter because its light grey hull readily reveals changes in environmental lighting.

    In the image below, a magenta false-colour visualisation highlights where ground-scattered light is contributing to the final image.

    Magenta false colouring is used to show just where the ground light scattering is being applied.

    Reflections benefit too

    IBL also improves the appearance of reflective materials.

    The chrome TIE Fighter below demonstrates how environmental lighting contributes to more convincing shading and surface definition, even without the use of light probes.

    The chrome TIE Fighter benefits from more realistic environmental lighting despite the absence of lighting probes.

    Looking ahead

    With the addition of IBL, Dorian’s lighting system is continuing to mature towards the capabilities expected from a modern professional rendering engine.

    Combined with its existing support for tone mapping, HDR-to-SDR conversion, and post-processing effects, the renderer is now producing significantly more convincing images than it was only a few months ago.

    There is still plenty of work ahead, but the investment is beginning to pay dividends.

    That’s it for today’s fly-by post.

    Have Fun!

    RobP

  • Dorian now supports glass!

    Today I wrote the shaders that model the way glass behaves.

    Dorian is already coded as a PBR sorted, multi-pass renderer, so incorporating the new glass system was pretty trivial.

    In previous videos, the TIE Fighter’s “glass” was simply represented by non-rendered gaps in the geometry. Now those panels are rendered as actual glass.

    The glass calculations include almost everything except refraction which is a rendering feature rather than a shader feature.

    Fresnel and environmental reflections!

    The effects of the glass shader are quite subtle in a still image, but if you look carefully, you can see them.

    The video below shows the TIE Fighter moving around, which helps demonstrate the glass modelling in the external views. Alas, the internal view has no glass modelling because the author of the model did not include any internal glass geometry.

    Concentrate on the left and top panes, and specifically on the TIE Fighter’s glass panels, both on the canopy roof and on the front windows.

    That’s it for this fly-by post!

    Have Fun!

    RobP

  • Back to Dorian – Sojour 2’s new graphics engine

    Dorian being put through its paces!

    I took a month off to pursue other hobbies and have now returned to continue work on Dorian, Sojour 2’s new graphics engine.

    Dorian is needed because Sojour 2 will use Microsoft’s latest .NET framework, and that framework comes with a development environment that can only compile 64-bit applications. Alas, Ionian, the graphics engine used in Sojour 1, is only 32-bit, hence the need for a new engine.

    On the plus side, Dorian can render to multiple windows simultaneously, which has huge implications for Sojour 2, including the ability to project a DM-only view of a map during in-person games.

    During this development tranche, the ECS engine received a major overhaul. I now have a much deeper understanding of the ECS architecture, which enabled me to make some significant performance improvements.

    I’ve also added the ability to import external 3D models, giving the engine feature parity with Ionian.

    Finally, the lighting engine has been improved, although there is still a long way to go.

    Here is a video showing the current version being put through its paces. The measured frame rate is accurate, as verified using NVIDIA’s FrameView tool.

    I’m running Dorian with VSync disabled and letting it run flat out, which explains the rather high frame rate.

    Unfortunately, game engine videos on YouTube never look quite as smooth as they do in person, but the engine itself is ultra-smooth. You can watch the video here:

    There is still a great deal more to do, but once Dorian is complete, I can turn my attention to developing Sojour 2 itself, which will incorporate this graphics engine.

    As noted in previous posts, Sojour 2 will be free for all existing Sojour customers.

    Have fun!

    RobP

  • Dorian now supports skyboxes and auto light detection!

    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)

    That’s it for this post! Nice and short!

    Have Fun!

    RobP

  • The Cascading Shadow Map System is Done!

    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!

    Please have patience!

    Have Fun!

    RobP

  • Another Dorian Graphics Engine Sneak Preview!

    There’s going to be quite a few of these – sorry!

    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!

    Have fun!

    RobP