This time around the interiors were almost completed. Now NPCs show up where they’re supposed to, you can even click on some of them – although right now you can loot them like dead bodies – except with no loot. 🙂 Obviously they’ll talk eventually, though not in the next demo. Next up the interior textures are now corrected for region like the exteriors. The taverns, mage’s guild, temples, etc. look more fitting for the Daggerfall region now. The doors that connect the exterior and interior are fully functional, before they only worked if you were on the ground level. Now you can go through upper level doors, climb the spiral staircase and get on the wall and so on. And finally the interiors use the proper dungeon like lighting (no more directional lighting) and the lights work correctly now.
Exterior NPCs are now showing up in cities, although the work is still preliminary. The outdoor lighting intensity also changes with the time of day, so the lighting matches the sky better. The sky now smoothly fades between images, so you won’t see a pop when it changes. This cross fade happens over about 5 seconds, so the gradients actually change very smoothly. I also implemented an optional sky filter that smooths out the sky gradients and dithering but preserves the edges – the sky looks smooth but not blurry. This is done on load, if the option is enabled, so there is no additional runtime cost or memory consumption – so there’s no reason not to use it unless you don’t like the effect. The luminance range is computed for each image and used to automatically adjust the filter parameters to preserve edges and provide just enough smoothing regardless of how bright or dark the image is.
Windows now work correctly. No additional memory or textures is used and the palette information is lost once the textures are uploaded to the GPU, so it took a little work to get the proper color to change without any filtering artifacts and only changing the correct color and nothing else. The way the renderer works is that alpha controls opacity and emissiveness. However with outdoor textures, not including flats which have a different shader, no pixels need to be emissive except for the windows at night. So what I did is leave the color alone (a middle-dark gray) and set the alpha to fully emissive. Then in the exterior shader (for geometry) I blend in the proper window color over an alpha range that is otherwise unused, which gives a smooth bilinear look even though its blending in a different color. I also blend between different colors for the window based on time of day (represented as a single float in the shader), as well as different final emissive values. This way windows are full bright at night but are properly shaded during the day.
This leads to the last feature I want to talk about, an optional feature: bloom. Basically only those pixels that are marked as fullbright (windows when they’re fullbright at night, light source flats) glow and only if the intensity of the color is greater than a threshold – that way fire on top of a torch will glow but not the wood. The geometry is rendered only once, the intensity value is written into a second render target as the scene is being rendered. You can see the bloom in the screenshots below, they are the last set.
Interior NPCs, proper region texturing and proper interior lighting: