Version 1.09.431 Jul 2023
Some time ago, I started on the “True Color” release for TFE - originally planned to be version 1.20, and then moved to 1.10. During development the amount of time available for TFE shrunk dramatically due to various events and obligations. As a result work slowed to a crawl, and honestly the True Color branch became a mess of partially implemented features.
Recently things have settled on a new normal and time for TFE opened up again. However, given the mess that version 1.10 turned into, I needed a plan to get the features I had worked on finished and released, to increase the release cadence once again. So I decided that I would split the 1.10 release into multiple smaller releases, and that I would port the code for each release to master as needed, and finish the features there.
Version 1.10 Plan
Version 1.09.4 - Bloom This release, see below.
Version 1.09.5 - True Color
- True-color mode (textures are pre-converted to 32-bit color on load, the “material” texture is another texture generated or loaded).
- Bilinear and Sharp Bilinear texture filtering options (previously shown in a screenshots).
- Mipmapping and Anisotropic filtering options.
- Colormap handling in True-Color (simple method initially).
Version 1.09.6 - Lighting
- Dynamic light support.
- Per-object light settings using text-based definition files.
- Automatic light generation for objects based on emissive values, if no definition is specified.
Version 1.10 - True Color Assets
- Support for true-color sprites and frames.
- Support for true-color textures.
- Subtitles/Captions for cutscenes and in-game (@kevin_foley).
Version 1.09.4 is the first of those releases. It was meant to focus on getting the “Bloom” feature implemented, but as it turns out a couple of other large features made it in as well. Below is the full change list, but I will go through the more impactful features below.
- Smooth Vue Animations (optional).
- Fixed color flashing when switching between levels.
- Ported over GPU Renderer portal fixes - now supports up to 65536 visible portals as originally intended.
- Fixed GPU Renderer issues when using more than 65536 vertices for sector or sprite geometry in a frame.
- Fixed Wireframe so it works correctly in release mode, and made 3DOs solid color when in wireframe.
- Added a new “Retro” settings template which matches the “Modern” template from previous versions, where “Modern” enables new features, such as Bloom by default.
- Added an “8-bit Interpolated” color mode, which smooths out colormap-based shading and removes most of the banding.
- Added a new console command exportTexture that will export the texture on the surface the camera is currently pointing at.
- Added a bloom option, with the ability to adjust its strength and spread.
- Added Accessibility options, starting out with Closed Captions / Subtitles (Beta).
8-bit Interpolated Color
Previously, TFE only supported direct 8-bit colormap based shading producing the same results as the original game. While Dark Forces looks pretty good at higher resolutions, hard banding can be seen in many cases - due to the limited number of shading steps.
Another option is to remove the quantization in the shading calculation - to generate a smooth result. The issue is, how do you use this smooth result with 8-bit colors and colormap? TFE will use the shading value to lookup the nearest colormap results, and then use the fractional component to blend between them.
Doing this smooths out shading falloff with distance (where the color gets darker or more foggy farther away), but banding can still be seen when using the headlamp or during weapon fire. The reason is that a 128-entry ramp is used to map between z-distance and ambient value. The issue is that this map contains duplicate values - so direct interpolation still leads to hard banding.
The solution that TFE uses is to generate a smoothed version of the light ramp on the CPU when the feature is enabled that contains fractional ambient values, and the shaders interpolate between the nearest light ramp values to generate the final result.
Comparison Images: Vanilla / Interpolation
Star Wars environments are filled with glowing panels and lights, and so bloom tends to work really well to simulate this effect. For TFE, I wanted to implement a high quality, tunable effect - so went with a more modern implementation than seen in projects like DarkXL.
Emissive data is automatically generated from the textures, frames, and sprites by assuming that fullbright palette entries map to emissive pixels. This isn’t perfect, but generates very plausible results in the base game. The same mapping is used when decided which solid colors are emissive when rendering 3DOs.
The core technique supports very large blurs, and works as follows:
First a half sized image is generated from the full size color data and emissive data:
result = post-conversion RGB * Emissive. A 13-tap downscaling filter is used that utilizes bilinear filtering to emulate a full 36-tap filter, in order to reduce flickering and aliasing.
Then that image is downsampled multiple times using the same filter (though the emissive values no longer need to be used), similar to generating a mipmap chain. Each downsampled texture is lower resolution than the previous, but later upsampling blurs cover a larger area.
Finally the downsampled images are recombined and merged together. At each step a lower resolution merged result is blurred and added to the next highest resolution. The way the frequencies are mixed together changes the spread of the blur.
Downsample chain (smallest 8x8) ->
Merge from bottom up (8x8 + 16x16 -> 16x16, 16x16 + 32x32 -> 32x32, ...->
Final bloom with all frequencies composited
- Strength - Intensity of the bloom effect.
- Spread - How far the effect spreads, lower spread results in more focused bloom, higher results in more atmospheric/foggy looking bloom.
Emissive Overrides In a future release, it will be possible to override the generated emissive values for each texture. This is useful for adding emissive pixels where they are missing, to handle True Color assets later for mods, and to remove emissive pixels that are generated by assets that accidentally used fullbright palette entries incorrectly.
To make creating overrides easier in the future, a new console command exportTexture has been added. To export a texture that you can see, simply look at it (point the crosshair at it, if that is enabled), and the type
exportTexture in the console. TFE will write out the BM, a palette converted version as PNG, and finally a “material” PNG that contains the generated emissive values.
No Bloom / Default / High Strength / High Strength + High Spread
More screenshots are various settings
Smooth Vue Animations
A previous project, DarkXL had a feature that smoothed out Vue Animations. For a while now, I have been meaning to implement a similar feature for TFE, but contributor Kevin Foley recently contributed an implementation of the feature.
Smooth Vue Animation blends between frames when animating 3D objects or sprites using the Vue System. This produces a much nicer animation and does a far better job of selling the movement of the various ships and cargo containers that fly through the levels of Dark Forces.
Since before TFE version 1.0 was even released, there are been requests for subtitles for cutscenes. And so Kevin Foley has been hard at work implementing a Closed Caption system for TFE that covers both cutscenes and gameplay. As voice lines are spoken or certain sound effects play, the appropriate subtitles are displayed. Kevin implemented a number of options to customize the system, such as changing the font size and color; and disabling captions for different categories of sounds.
There is a lot of upcoming work, such as supporting UTF8 and handling translations, but most of this will not be tackled until Outlaws support is further along, so that we have a better view of its implementation and how the systems interact.
Below, Kevin will talk about what to expect in this release in his own words:
Hey everyone, here are my dev blog notes for the new Accessibility options. First, what to expect with the next release:
- Full subtitles for all voice lines in cutscenes and gameplay
- Descriptive captions for key sound effects in cutscenes and gameplay, such as
- New Accessibility menu with many customization options:
- Enable/disable captions and subtitles separately for gameplay and cutscenes
- Adjust font size and color
- Adjust text background opacity, with optional border
- Adjust how many lines of text are displayed during gameplay
- Adjustable volume threshold for gameplay (sound effects that are quieter than the specified volume are not captioned; good for eliminating captions for distant sound effects)
- Subtitles/captions are defined in a user-editable file (please note only ASCII is supported for the next release)
A major focus, once version 1.10 releases, will be on the TFE level editor and support editors. During this phase some of the new engine features from Outlaws will be integrated and tools developed to use those features. This is the first way that previous and future Outlaws work will be integrated in a visible way. That said, there is little point to implement new level-based features until there are tools that can be used to test them.
There are other long standing features that will be added during this period as well, with tools - such as the long awaited voxel support that was prototyped before version 1.0 shipped.
In the background, Outlaws work has already begun. Initial work involve looking at the low-level engine code and loaders, with the goal of being to able to load and fly around in levels. This initial work will be used to integrate some of the Outlaws engine-features into options for new Dark Forces mods as well.
After the initial Level Editor release, most of the focus will shift to Outlaws support, but the level editor and other editors will be updated over time - to iterate on the tools, make improvements, and fix bugs; but also to add more Outlaws specific features for testing.