Lost Knowledge & Secrets

This is knowledge that used to be common, but has been lost or mostly forgotten due to it being considered common knowledge. Many of these are techniques that were widespread enough to be used every day, and now are barely used at all.

Particle Simulation

Calculate maximum Particle count ahead of time

If you know several variables ahead of time, it is possible to know the maximum number of particles necessary ahead of time. You need to known the maximum spawn rate, the minimum decay rate, and the maximum life time. Combining these gives you this neat simple math:

particles = min(maxSpawnRate / minDecayRate, maxLifeTime * maxSpawnRate);

Color Conversion & Rendering

Is converting YUV from/to RGB lossless at the same BpP?

No, unfortunately not. RGB and YUV do not map 1:1, so you will end up with accumulating error if you repeat this conversion multiple times. This loss can be avoided by working in a higher bit depth until the final result is needed.

Can color banding be avoided in SDR (8 BpC)?

To some degree it can be, but ultimately you are stuck with the accumulating error from working in SDR. If you do not need the alpha channel, you can switch from 8-8-8-8 to 10-10-10-2 and still maintain nearly identical performance.

Is it possible to achieve higher quality with Dithering?

Definitely, and this is only getting better over time as monitors aim for higher and higher refresh rates. You have two options which both require a HDR input:

  1. Dithering can be used to create a visually smoother color transition. This takes advantage of high pixel densities or players sitting far away (creating effective high pixel densitites), and drastically improves the percieved quality of your game, video or scene.
  2. Combining Dithering with Flickering can result in a percieved extra bit of color depth, at least once you reach 100 Hz and above. At that frequency, the eyes and brain start to merge percieved changes, resulting in fake colors that did not actually exist. You can get an extra bit of color depth every time the Hz number doubles. (100 Hz = 9 bit, 200 Hz = 10 bit, 400 Hz = 11 bit, …)

Can 8-8-8-8 store HDR effectively?

No. An early technique called “FakeHDR” tried to use the last channel to store a multiplier, allowing really bright textures, but this came at a massive quality cost the brighter you went. Since both the accumulated error as well as preprocessing error was multiplied, this approach was quickly dropped.

These days 10-10-10-2 and 16-16-16-16 are much better alternatives, and one of them does what the FakeHDR was supposed to do – just much better, and without any of the preprocessing or postprocessing overhead. Plus you even get a 2 bit alpha channel with it!

Glossary

  • Bits per Pixel (bpp, BpP): The number of bits that are used for a single pixel.
  • Bits per Channel (bpc, BpC): The number of bits that represent a single channel, such as Red, Green or Blue.
  • Dithering: A technique used to create a percieved or actual additional color by taking advantage of human or technological faults.
  • SDR: A buffer with less than 10 BpC in the color channels, such as 5-5-5-1, 5-6-5-0, 8-8-8-0, 8-8-8-8, …
  • HDR: A buffer with more than 9 BpC in the color channels, such as 10-10-10-2, 16-16-16-16, …
  • FakeHDR: An ancient technique that abused the last channel in a 8-8-8-8 buffer as a multiplier.

Notations

  • A-B-C-D: A combined texture format where each of the A, B, C, and D elements specify the bits for a specific channel, usually in the order R, G, B, A.

Comments are closed.