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

Many modern Particle simulation engines rely on user input for their maximum particle count, despite the maximum particle count being something that can be calculated ahead of time. All you need is the highest possible spawn rate (as particles per second), the minimum decay rate (as decay value per second), and the maximum life time (in seconds).

Once you have these variables the following formulae will result in the maximum particle count:

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

Color Conversion/Rendering

Is YUV to/from RGB conversion lossless?

It depends on the matrix used to transfer to and from YUV, as well as the number of bits per channel. To be on the safe side, it should be assumed that converting to and from YUV will result in slight quality loss, which may be acceptable to you, but will result in accumulating error.

Is Color Banding avoidable?

Not perfectly, but it can be worked around. A higher number of bits per channel will result in a cleaner looking transition, and you might even adopt the usage of dithering which also helps with this. For example, you could opt for an internal storage using 10/10/10/2-bit texture, instead of 8/8/8/8-bit, which gives you two extra bits of precision, and then use dithering to convert to 8/8/8/8-bit display output.

Can you store HDR in 8/8/8/8-bit?

No, at least not true HDR. In the past this was actually used to achieve simulated HDR with GPUs that had yet to support 10 bpc or 16 bpc textures, but the downside of that approach was huge precision errors, and only having limited control over the range. These days 10/10/10/2 and 16/16/16/16 are preffered as they do not have this issue – plus you still get an Alpha channel to use.

Can Dithering help achieve higher Quality?

Most definitely yes, even though it will only be perceptual quality – human vision is awful, and our brains love to cheat a little bit when it comes to vision. In fact we can trick our brains into thinking a gradient is smooth by just applying a little bit of clever static or random dithering to it, as explained above.

We can even abuse this loophole to get a virtual extra bit of color depth from an 8 bpc monitor. Roughly every 50 fps (starting with 50 fps) you can get an extra bit of precision by using temporal dithering. This allows you to approach the color depth of a HDR monitor while actually rendering SDR content.

Glossary

  • Bits per Pixel (bpp, BpP)
    The number of bits that are used for a single pixel in total.
  • Bits per Channel (bpc, BpC)
    The number of bits that represent a single channel, such as Red, Green, Blue or Alpha. Usually describes a buffer that will be aligned with 2^n sizes.
  • Dithering
    A technique used to create a percieved or actual additional color by taking advantage of human or physical faults. Very common in Games and Software written during the CRT days, where color reproduction was based on physical properties.
  • Frames per Second (fps, FpS)
    The number of frames displayed in a single second at a constant pace.
  • SDR
    Output with 8 bpc or less, often paired with color spaces which can’t reproduce all visible colors.
  • HDR
    Output with 10 bpc or more, often paired with color spaces which can reproduce 95% and more of the visible color spectrum.
  • FakeHDR
    An ancient technique that abused the last channel in a 8 bpc texture as a multiplier.

Notations

  • A-B-C-D or 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.