Daggerfall Unity 0.13 Rendering Update

There are some long-standing items on Daggerfall Unity’s Roadmap that have at last found their way into the game. These changes relate to visual rendering of classic textures in Unity engine and how they interact with lighting. There’s also a long-overdue update to the postprocessing stack. To summarise everything before getting into details, these changes are:

  • New default shaders for classic textures
  • Switch rendering from Gamma to Linear colour space
  • Lighting review
  • Update postprocessing stack

New Default Shaders

You might have noticed the visuals in DFU have a kind of silvery “shine” on top, and some textures tend to wash out easily under certain lighting conditions. Examples are objects that emit light, such as lanterns, and naturally bright textures like snowy terrain at midday. Even when using retro rendering with palletization, deep blacks will tend to shift value towards lighter greys.

The reason for this is somewhat technical. A concise version is that modern engines like Unity use something called Physically Based Rendering (PBR) which attempts to simulate the physical properties of a material and how it interacts with light. However, old games like Daggerfall predate physical material properties such as normal maps, smoothness maps, etc. and instead have only basic colour information in a single texture. When attempting to render these simple textures in a PBR engine without any other material properties, they are perfectly smooth and will reflect light in unsatisfying ways. This can give objects a shiny kind of look, as if made from plastic or dull metal.

In fixing this, the goal was to correct lighting incongruity while using classic textures and still allow mods like DREAM to use PBR materials. It was also necessary for these different materials to work together in the same scene with any combination of classic and modded materials. This presented some challenges that were eventually overcome with the help of new shaders and several updates to material pipeline.

The best way to see the difference is to compare a scene in 0.12 and 0.13. Pay close attention to the dark areas of the rat while adjusting slider. You’ll notice in 0.12 screenshot the rat has a uniform specular shine that is removed in 0.13. You’ll see the same across the entire scene, although most obvious in darker textures.

To fix this specular shine required new shaders better suited to Daggerfall’s classic textures. These new shaders lean fully into the retro textures and use simple Lambertian reflectance like older games of the time. This leads to better colour sampling under most lighting conditions and fixes brighter areas from becoming overbright. For example, the lantern and Fire Daedra wash out to bright yellows in 0.12 using PBR shaders but show their true colours in 0.13.

While relatively basic, the new shaders still support Normal maps and Emission maps, and conditional compilation. They are more lightweight than Unity’s Standard shader and will perform slightly better on lower-end computers running without mods.

Gamma to Linear Colour Space

The next change was switching from Gamma to Linear colour space. This is another technical subject, but in short it relates to how colours are added and multiplied. Linear colour space leads to more accurate results with improved lighting falloff and softer shadows. The results can be subtle in unmodded DFU, but the combination of new materials and linear lighting uplifts every scene with deeper colours and improved contrast while eliminating bloom and flat specular shine.

With the change to Linear colour space, modded materials now have a chance to look their best at all times with more accurate colours and no unwanted bright spots near lights. Of course, all these changes also require lighting to be reviewed and materials tweaked so they still look good. This leads into the next item on the list.

Lighting Review

Linear colour space blends and lights differently than Gamma. Lights appear to have a larger radius and is more defined on edges. This is more accurate overall, but also different if you’ve become accustomed to Gamma lighting. As a result, all the light sources in the game need to be tuned so they aren’t too bright and still resemble the game as it was.

In general, dungeons will appear a bit darker from 0.13. The combination of new shaders, Linear colour space, and lighting review result in darker colours becoming more prominent. You can really see the flat silvery shine over everything in below screenshot when comparing 0.12 to 0.13. The dark parts of brick textures stay dark rather than shifting value towards lighter greys.

Towns are still nicely lit oases, with Linear’s different light falloff visible against sides of buildings in below screenshot. But the removal of flat specular shine means night-time scenes have better overall contrast between light and dark areas.

Daytime scenes will light much the same as there’s only a single directional light source (the sun). The change to Linear with new shaders also resolves the problem of terrain textures looking over-bright under a midday sun. Finally, the daytime light curve was adjusted to provide a longer plateau of sunlight around 10am-3pm.

Update Postprocessing Stack

For some years now, Daggerfall Unity has continued to use an older embedded postprocessing stack. This has now been removed and replaced with current Post Processing 3.1.1 via Unity’s package manager. This updates deferred fog and postprocess capabilities to be in line with current engine. It also required some minor code changes and retuning fog as some parts of the old Post Processing library have been deprecated.

Fog is roughly the same, other than being a bit thicker towards limits of view distance. Compare the distant trees and buildings in below winter scene.

Preview Release and Mods

Daggerfall Unity 0.13 will be available as a Preview release soon. Due to all the changes across asset pipeline, colour space, default materials, and postprocess stack, you should expect some mods that work under 0.12 not to work in 0.13. Mods that include new materials and shaders will be most affected. Any non-graphical mods, or those which only change game settings, should be unaffected or only need minor tuning.

It could take several weeks for mod authors to update their mods to be compatible. If you don’t want to help test 0.13 and provide feedback to developers and modders, you can happily stay on 0.12 until 0.13 release is out of preview. You can also run 0.12 and 0.13 side-by-side by unzipping releases to different folders and running different mod loadouts. Other than changes outlined above, the 0.13 release is identical in terms of gameplay and patch level to 0.12.

Looking to the future, this represents the last major change to Daggerfall Unity leading up to 1.0. Bug fix and general refinement will resume once 0.13 is considered stable.

Thank you for reading! I hope you decide to try out Daggerfall Unity 0.13 preview to help test mods and provide feedback.

September Builds 0.10.6

Live Builds have been updated with version 0.10.6. This release patches a massive number of bugs, and we still made time for some new features. I’ll provide a quick summary of the major stuff first.

Quest Lists (Hazelnut)

If you enable setting Advanced > Enhancements > Guild quest player selection, then guild quest-givers will offer multiple quests at a time, rather than needing to keep clicking “no” until you see a quest you like.

 

Quests will rotate every so often to give you a fresh selection to choose from. This feature also has thanks to Firebrand who entered all the quest display names.

Continue reading

Creating SDF Fonts For Daggerfall Unity

Note: This information is out of date as of July 2019 and no longer applies. Fonts in Daggerfall Unity are now standard Unity TextMeshPro (TMP) fonts internally and font replacements are part of the Localization features entering preview in v0.10.26-alpha.

Introduction

All the way back in September, I upgraded font rendering in Daggerfall Unity to support Signed Distance Field (SDF) fonts. This enabled smooth high-resolution font replacements which can operate under the same “layout rules” as classic Daggerfall’s pixel fonts, with a substantial improvement to reading comfort as this comparison screenshot demonstrates.

 

Rather than storing individual display pixels of a text glpyh, SDF fonts store a distance value that can be turned into display pixels later at any resolution using a custom graphics shader. Unlike regular pixel fonts that become quite pixelated at high resolutions, SDF text can use those distance values to generate sharp detail even at UHD resolutions and beyond. If you’re interested in the inner workings of Signed Distance Fields, there are loads of great resources out on the web. This tutorial doesn’t look very deeply at SDF concepts, only the process of creating new SDF fonts for Daggerfall Unity.

 

Resources

There are a few resources you will need to work through this tutorial.

You can use whatever font or tools you like to generate your SDF font atlas. This is just the process I’m using that will generate known-good output for Daggerfall Unity. If you do use a different toolchain, the only thing that matters is the output image is a proper SDF texture and the glyphs are laid out in a specific way.

 

Continue reading

Magic & Effects Back-End

In my previous article, I showed progress on the visual side of spell-slinging and had lots of fun with casting animations and throwing around missiles with lighting effects. Now I have to regard the business end of the spell system and how all of this holds together under the hood. This article will be a lot more tech-oriented than my previous one, but may still be of interest if you’re curious about how spells will operate in Dagerfall Unity.

Please keep in mind this is all under active development so concepts discussed here are likely to be refined or expanded by the time everything rolls out.

 

Magic & Effects System

One major shift in this process was changing how I think about the spell system. I have a long list of goals I want to achieve during this stage of development, above and beyond just emulating Daggerfall’s classic roster of spells. Primarily, I want to create a central way of handling the majority of effect-based gameplay. This means advantages/disadvantages, diseases, poisons, spells, magic items, potions, and so on should all come together under the one system or group of related systems. Once I had made that decision, it no longer made sense to call it the “Spell System” as spells are just one part of the collective. So the Magic & Effects System was born.

This is why you won’t see the word “spell” very much moving forward but you will see the word “effect” a lot. In this context an effect isn’t something visual, it’s how something works. For example, an effect that heals the player is a script which increases their current health. This naming is taken from Daggerfall itself where spells and magic items reference effects directly using a type and sub-type.  You can read more about classic Daggerfall’s spells and their effect indices on this UESP page.

You will also see the term effect used by Daggerfall’s Spell Maker UI when creating a new spell. You can add up to three effects per spell as shown in screenshot below from classic Daggerfall (spell maker is not yet implemented in Daggerfall Unity).

 

Continue reading