Spectral Primary Decomposition

Courtesy of https://graphics.geometrian.com/research/spectral-primaries.html

Spectral Primary Decomposition is a technique used in computer graphics and rendering to efficiently generate a reflectance spectrum from sRGB input data1, 2. It involves decomposing the sRGB reflectance spectrum into a linear combination of three pre-computed spectral primaries, each corresponding to one of the three primary color components (red, green, and blue) 3. The Spectral Primary Decomposition technique allows for efficient computation of reflectance spectra by using a small set of pre-computed spectral primaries. This reduces the computational complexity compared to directly representing the reflectance spectrum with a large number of samples, t can be used for computing reflectance spectra from sRGB input data.

Here is a GLSL example of decomposing sRGB texture values into spectral primaries.

// Define the spectral primaries
uniform sampler2D redPrimary;
uniform sampler2D greenPrimary;
uniform sampler2D bluePrimary;

// Convert sRGB to linear RGB
vec3 linearRGB = pow(texture(sRGBTexture, texCoord).rgb, vec3(2.2));

// Compute the coefficients for the linear combination of the spectral primaries
mat3 spectralMatrix = mat3(
    texture(redPrimary, texCoord).rgb,
    texture(greenPrimary, texCoord).rgb,
    texture(bluePrimary, texCoord).rgb
vec3 spectralCoefficients = inverse(spectralMatrix) * linearRGB;

// Multiply the coefficients with the spectral primaries to obtain the final reflectance spectrum
vec3 reflectanceSpectrum = spectralCoefficients.r * texture(redPrimary, texCoord).rgb
                         + spectralCoefficients.g * texture(greenPrimary, texCoord).rgb
                         + spectralCoefficients.b * texture(bluePrimary, texCoord).rgb;

International Commission on Illumination

CIE stands for the International Commission on Illumination, which is responsible for defining the CIE color spaces and standard illuminants used in colorimetry and spectral rendering.

The CIE color system characterizes colors by a luminance parameter Y and two color coordinates x and y, which specify the point on the chromaticity diagram.

The image below is the CIE chromaticity diagram for the sRGB color space, where the corners of the triangle represent the primary R, G, B colors. Colors outside of the triangle cannot be represented on an sRGB monitor.

Courtesy of Rendering Spectra

To convert from CIE XYZ coordinates to sRGB in a GLSL shader, you can use the following code:

vec3 convertXYZtoRGB(vec3 XYZ) {
    mat3 XYZtoRGB = mat3(3.2406, -1.5372, -0.4986,
                         -0.9689, 1.8758, 0.0415,
                         0.0557, -0.2040, 1.0570);
    vec3 RGB = XYZtoRGB * XYZ;
    return RGB;

void main() {
    // Define the CIE XYZ values
    vec3 XYZ = vec3(0.25, 0.40, 0.10);

    // Convert from CIE XYZ to sRGB
    vec3 sRGB = convertXYZtoRGB(XYZ);

    // Output the sRGB color
    gl_FragColor = vec4(sRGB, 1.0);

References: 1, 2, 3

Combining Relative and Metric Depth

Combining relative and metric depth refers to a technique that integrates both relative depth information and metric depth information to improve depth estimation.

Relative Depth: Relative depth refers to the ordering of objects in a scene based on their distances from the camera. It provides information about the depth ordering but not the actual metric distances. Relative depth can be estimated using techniques such as monocular depth estimation or stereo vision.

Metric Depth: Metric depth refers to the actual distance of objects from the camera, typically measured in real-world units like meters or feet. It provides precise depth information but may require calibration and additional sensors.

By incorporating relative depth information, the algorithm can capture the depth ordering of objects in the scene. At the same time, by incorporating metric depth information, the algorithm can obtain accurate distance measurements.

One approach to combining relative and metric depth is through the use of deep learning techniques. For example, the ZoeDepth algorithm combines relative and metric depth estimation by training a neural network to predict both relative depth and metric depth from a single image. This allows the algorithm to capture the depth ordering of objects while also providing accurate depth measurements.

Active Contours without Edges

Rendering reflections in Augmented Reality can be very difficult. Reflection surfaces must work with plane detection to compute a reflection normal. The color and texture of the reflection can be fine tuned to match the surface. In addition, the reflection must be clipped against the background. To do this we explore the paper “Active Contours without Edges” in the Chipper Chickadee development blog HERE.

Memory Chords- First Playable!

In the last week we’ve been having fun matching pictures and guitar chords in what we call Memory Chords.  We’ve even added a button to remove the pictures on the cards if you think you are good enough to match them by the chords alone.  This is a first playable demo, I encourage you to leave feedback, in the next phase we will be making a release to Android / iOS, currently this is only playable in PC Browsers supporting HTML5 such as Chrome, I recommend using the fullscreen button on the bottom right for best performance and don’t forget to turn on your speakers……


Click To Play Game!


Announcing our Memory Game!

2016-04-07 17_32_43-MemoryChoords (64-bit, PCD3D_SM5)


Here is a screenshot of the first project we are working on.  It is a Memory Game, the first playable will be this Saturday the 9th.  Each of the cards is hand painted and we will be releasing some of the originals on our twitter for our #screenshotsaturday event.

Come Play Blackjack in the Unreal Engine

We’ve been working on HTML5 deployment for the Unreal Engine and have compiled one of the early Epic demos in Unreal 4.11 with the advanced html5 features.  I have to say it looks great, the main problems are the loading times and pretty high html5 requirements, that is it doesn’t seem to run through a tablet browser.  We’ll put more out on this later, until then enjoy Epic’s Blackjack.


Click To Play Game!

Note: Use the fullscreen button at the bottom for best performance.

Chipper Chickadee Studios is Born!

Chipper Chickadee Studios is a game development and contracting company based in Virginia Beach, Virginia.  We have been supporting local groups with software development, art creation, and level design services for over 10 years and have come together to create Heroes Province, a unique puzzle rpg adventure where you must build  a province and protect it.


Hooray for Chipper Chickadee Studios.

Hooray for Chipper Chickadee Studios.