23 votes
Accepted

Why do red, green, and blue make up all the colors?

Let's reminds ourselves what light is. Radio waves, micro waves, X rays and gamma rays are all electromagnetic radiation and they only differ by their frequency. It just so happens that the human eye ...
Julien Guertault's user avatar
20 votes

Why do red, green, and blue make up all the colors?

They don't. The problem with the diagrams representing the visible and RGB gamuts is that they're presented on RGB displays. They obviously cannot show you what they cannot show you : the area inside ...
Eric Duminil's user avatar
17 votes

Why do red, green, and blue make up all the colors?

Humans are trichromatic, which means we have 3 different kinds of color receptors (better known as cone cells), each sensitive to a different set of wavelengths: Image source: wikipedia So it only ...
ratchet freak's user avatar
13 votes
Accepted

For shader math, why should linear RGB keep the gamut of sRGB?

Talking about Linear RGB must be avoided because it does not tell you anything about the RGB colourspace intrinsics, i.e., Primaries, Whitepoint and Colour Component Transfer Functions. A few years ...
Kel Solaar's user avatar
11 votes
Accepted

Why does checkerboard pattern on a computer screen appear with a yellowish tint?

Because your monitor is not properly calibrated. On my screen at home the top and bottom parts have the same hue. At my office though, the top part tends to looks a bit yellow compared to the bottom ...
Julien Guertault's user avatar
9 votes

Why does the 1/r² term appear with point sources?

The concept of a point source is an approximation. Physically, light sources are extended objects and emit light from every point on their surface; but when you're far enough away (i.e. the distance ...
Nathan Reed's user avatar
8 votes
Accepted

Understanding Jump Flooding Algorithm (JFA) for Voronoi Diagrams

I think that there is a bit of confusion in terminology. My understanding is that only the initially colored points, before step 1, are called seeds. Maybe this helps clarify the algorithm as well. ...
StinkySkunk's user avatar
7 votes
Accepted

How much precision (half, float, double, etc) is enough for a Color class?

Colors shown on your display or saved to standard image file formats use 8 bits per component. So to store these colors it suffices to use four bytes (unsigned char)...
Nathan Reed's user avatar
7 votes

Spectral path tracing - image color/brightness incorrect

The problem lies mainly in CIE1931XYZ::tristimulusValues() function, where you normalize the resulting color to the luminance of your illuminant which causes that ...
ivokabel's user avatar
  • 1,454
7 votes
Accepted

What is the most physically accurate representation of color possible in computer graphics?

The most physically accurate way would be to have a $l(\theta)$ which for each possible color frequency has a certain value. Converting to RGB would then need a frequency responce function for each ...
ratchet freak's user avatar
6 votes
Accepted

Is there a way to interpolate color across the line with only integer calculation ?`

Yes, it is possible to use only integer calculations. I will describe how, but bear in mind that the difference in speed between integer arithmetic and floating point arithmetic is not as great as it ...
trichoplax is on Codidact now's user avatar
6 votes

What is the most physically accurate representation of color possible in computer graphics?

There is spectral rendering, where you can quantize the visible wavelengths from ~390nm to ~700nm to N discrete wavelengths instead of the standard 3 for RGB. Then if you had to model say a prism, you ...
JarkkoL's user avatar
  • 3,636
6 votes

How do you deal with clipping when rendering to a limited colorspace?

Effectively, before you start to think about clipping/clamping, you'll need a general approach to map the much wider color range you are working in onto the [0,1] triplets you want to output. There ...
Paul-Jan's user avatar
  • 266
6 votes

For shader math, why should linear RGB keep the gamut of sRGB?

In practice, when we say "linear RGB," we mean "sRGB without the gamma correction." It would be more correct to say that there is the "sRGB colorspace" and the "linearized sRGB colorspace", with the ...
Nicol Bolas's user avatar
  • 9,772
5 votes
Accepted

Calculate an equally bright grey to a linear RGB colour

The easiest way to get the perceived brightness of a color is to calculate the Luma. Finding the grey color with the same luma is easy - just set all of the RGB components to the desired luma value. ...
Quinchilion's user avatar
5 votes
Accepted

Encode two R11G11B10F buffers into one using Y'CbCr?

You might want to look at The Compact YCoCg Framebuffer. It uses a 2-channel buffer to store luminance for every pixel and the two chroma components in half the pixels each, forming a checkerboard. It ...
Nathan Reed's user avatar
5 votes

Why does the 1/r² term appear with point sources?

It is the inverse square law of light for a pure point light. $E = \frac{I}{r^2}$ Where E is illuminance and I is pointance or power/flux per unit solid angle.
Syntac_'s user avatar
  • 561
5 votes

Why would a 4d texture be used for color conversion?

I think your quote refers to conversion between color spaces, rather than color grading. 4d textures could be used as lookup tables to convert color spaces like CMYK to some other space. Since CMYK ...
wolle's user avatar
  • 302
5 votes
Accepted

RGB nonlinear, what does it mean?

In general, non-linear function would mean that an increase in an input does not produce a proportional increase or decrease in output. Mathematically, any function that relates one value to another ...
user1118321's user avatar
  • 3,401
5 votes
Accepted

Generating and Combining Spectral Colors

Your way of calculating XYZ functions is probably the most efficient way to go about calculating accurate colors from a spectrum. It is standard practice afaik, for examples the books Physically Based ...
Tare's user avatar
  • 1,551
5 votes
Accepted

Calculate the average color of an image

Averaging RGB should be correct assuming you do it in linear RGB. If your images are in sRGB, you can remove the gamma correction by doing something like the following for each of the R, G, and B ...
user1118321's user avatar
  • 3,401
5 votes
Accepted

"whiteness" in center of bright colored lights - what is it called?

In general this is caused by HDR tone mapping. Tonemap curves typically decrease saturation as the input light gets brighter, so that very bright lights are rendered closer to white on the display. If ...
Nathan Reed's user avatar
5 votes
Accepted

How do I add two color values containing alpha?

First, you have to consider what having an alpha value less than one means. You can consider an RGBA colour like $(1,0,0,0.5)$ as "a red object that is 50% transparent"; but an equivalent ...
gilgamec's user avatar
  • 901
4 votes

Why does the 1/r² term appear with point sources?

I'll give an intuitive idea of the reason in this answer. Once this intuitive idea is grasped, it can be easier to absorb the mathematical descriptions. Other people find it easier the other way ...
trichoplax is on Codidact now's user avatar
4 votes

What is the effect of the BRDF denominator?

Firstly, I highly suggest reading Eric Heitz's paper "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs", which covers the full derivation of microfacet-based BRDFs. The $\frac{...
RichieSams's user avatar
  • 3,782
4 votes

How to detect a screen in a photo

The first things I would try is to see if smartphone pixels are visible (if the photo is high res) or if strange aliasing occurs (your example image shows both). Another classical test (but not ...
Fabrice NEYRET's user avatar
4 votes

Change particular color in an image

In order to replace a color with another color, you need some sort of distance metric between the colors and a function for calculating the blending based on that distance. Finding a distance ...
user1118321's user avatar
  • 3,401
4 votes

How to correctly render visible spectrum with uniform intensity?

I guess that this is related to the sum of the three functions having a minimum there. See the sum plotted against wavelength This is actually a wrong way to sum these functions: sRGB model specifies ...
Ruslan's user avatar
  • 416
4 votes

What is a good color similarity metric?

If complex metric is acceptable I would suggest to look at perceptual based approach described here. The metric is designed to pick perceptual difference of two images. There are two main tests for ...
reinsteam's user avatar
4 votes

What are the advantages of having two chroma channels and a luma channel vs. three chroma channels?

From a historical context, the YUV color encoding was originally designed to support the existing black-and-white infrastructure. In addition, as jooja mentioned, humans are generally less perceptive ...
AnimatedRNG's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible