I've been testing a few things lately, so went back to
the alpha channel glow test I did back here.
I ran a basic test to see what values of alpha RT3 was capable of dealing with. It turns out that the limiting factor is the nVidia DDS add-on for Photoshop, as far as I can tell. That appears to set a limit of roughly 16 values for alpha channel colours. I say roughly because the results indicate that it's trying to set things to a maximum of 16, but close checking of the result shows some tiny variation with each grey stripe. It can be RGB 102 102 102, or it can be RGB 103 103 103, at east according to the Photoshop colour picker (which may not be perfect itself).
This explains why it's impossible to get windows glowing at night with a smooth gradient across them: any gradient will be converted into a set of shades of grey, where each shade is far enough apart from the next one to make it all look as rough as guts. The obvious conclusion here is that all night glows should be done with one shade of grey within each window (or within any other discrete chunk of pixels). You can have different windows with different amounts of glow, but you can't mix different amounts within one window if you want it to look good. I've attached screenshots of the alpha channel before and after exporting to DDS.
Original_gradient_alpha.jpg
Alpha_after_DDS_export.jpg
The shades in the exported alpha channel are:
Code: Select all
RGB 255 255 255 (hex code #FFFFFF, pure white).
RGB 239 239 239 (hex code #EEEEEE).
RGB 222 222 222 (hex code #DEDEDE).
RGB 206 206 206 (hex code #CDCDCD).
RGB 188 188 188 (hex code #BCBCBC).
RGB 172 172 172 (hex code #ACACAC).
RGB 154 154 154 (hex code #9A9A9A).
RGB 137 137 137 (hex code #898989).
RGB 120 120 120 (hex code #787878).
RGB 102 102 102 (hex code #666666).
RGB 85 85 85 (hex code #555555).
RGB 66 66 66 (hex code #424242).
RGB 47 47 47 (hex code #2F2F2F).
RGB 28 28 28 (hex code #1C1C1C).
RGB 9 9 9 (hex code #090909).
RGB 0 0 0 (pure black).
Edit: Aha! I should RTFM more often. It just occurred to me to run a search on "DXT3 alpha" and see what turned up.
Found this at the top of the search results:
https://www.fsdeveloper.com/wiki/index. ... _explained
The key point is this:
DXT3
Because the alpha information is stored in 4 bit, the smallest step in the alpha value that can be stored is 16. This means that very smooth transitions in the alpha channel can not be stored in the DXT3 format.
Which is exactly what my testing showed me yesterday.
So now I know.
Ran some more tests, and have got it thoroughly sussed now.
It goes like this:
The RT3 devs coded the game to accept 16 levels of alpha. Two of these are obviously pure black (RGB 0 0 0, Hex #000000) and pure white (RGB 255 255 255, Hex #FFFFFF). Theoretically, there are another fourteen levels available for various shades of grey.
The natural division of the scale is 17 units, which might sound odd if you are used to thinking in powers of 2. It took me a while to realise that if leaving out the starting point you have 255 steps, and 255 is 17x15. So if you're coding for 16 levels in total, the natural increment is 17 on the RGB scale, and that fits comfortably with DXT3's minimum allowed step of 16 units.
When working in an image editor it's easier to use hex instead of RGB to set your shades of grey. The natural increments come in at #000000, #111111, #222222, #333333, #444444, #555555, #666666, #777777, #888888, #999999, #AAAAAA, #BBBBBB, #CCCCCC, #DDDDDD, #EEEEEE and finally pure white at #FFFFFF. These are quicker and easier to type than the corresponding RGB values. They're also quicker and easier to type than any other hex values, since you're just hitting the same key six times, so using these hex codes makes sense.
These would, in theory, give you 16 shades of alpha. However, due to the vagaries of nVidia DDS export, using those hex codes in your PSD alpha channel will give a slightly different result after exporting. The upshot of it is that only 14 levels are usable. It's probably possible to find hex codes that would export in a way to open up the last two RT3 glow levels, but frankly I don't think it's worth the bother. The available levels are more than adequate anyway.
The RT3 scale is set so that hex values from 010101 (RGB 1 1 1) to 101010 (RGB 16 16 16 ) have no glow at all. They will display at night as purely transparent, the same as pure black. This is why the end window of the car tested back here had no glow. The value of #0A0A0A is below #111111, so is assigned to the first no-glow increment.
Much the same applies to hex values of #EFEFEF (RGB 239 239 239) or higher. They work like pure white, and have full opacity and no glow.
This is where the nVidia gremlins come in. If you use #111111 alpha in an attempt to get the highest level of glow, it will be exported as #090909. DXT3 alpha shouldn't allow this, since it's a step of only 9 units from pure black instead of the theoretical limit of 16 units, but it seems that limit doesn't apply to steps away from pure black.
Anyway, #090909 is down in the first no-glow increment, so displays as purely transparent. If you use #EEEEEE alpha in an attempt to get the lowest level of glow, that will be exported as #EFEFEF, which is just into the last no-glow increment, so you'll get full opacity and no glow.
If you use any of the other easy hex codes they will be exported with slightly different values, but they'll still use up the remaining twelve alpha slots perfectly. You'll still have those twelve levels of glow to choose from, and don't have to worry about the actual exported values. The last two levels you can't access are so dim it's hardly there at all, and so bright it'll burn your eyeballs out, so they're not really worth having anyway.
Short version, for people who don't care about the theory and just want to use this stuff: Stick to #FFFFFF if you want opaque pixels, and #000000 if you want transparent pixels. Use anything from #222222 to #DDDDDD if you want varying levels of glow, with #222222 being the one you need welding goggles for, and #DDDDDD being the one that needs new batteries in the torch.