How I could be simulation Display p3 Color Gamut inside Game-Engine development mode.

Author :

First published this topic : 2021.5.10

What is this issues I was focused on now.


Basically Chinese game industry have a lot of old stuff of Dell monitor even now 2021 in years.

So many artist When they working there absolutely use to sRGB thigh color gamut space but modern display totally support DCI-P3 or Display P3 also even if manufacture from China or Taiwan such as AOC and Alpha Scan.

Current gamming monitor all support Wide gamut and new industrial standard wide gamut such as Rec2020 and Display P3.

Back to general.

All artist like lighting look dev artist use sRGB gamut and then building with final look will use to Commercial monitor How they can be matching to final rendering tone and manner?

If company could be change to all display to new stuff It is best one but do not

Notify about Color Gamut It’s hard to expect to do that.

So I got some idea about approximation based simulation inside unity scene view or game view like iOS development mode view that I defined calling name so.

iPhone : Display-P3Generally DCI-P3 and Display-P3 have the same chromatic coordinates – they have exactly the same gamut. They are different by gamma curve, the display P3 has one borrowed from sRGB profile, so when viewed on non-color-managed browser or system it gives better result (as for contrast) with still dull colors.All new Mac’s use Display-P3 as standard color space, as they displays cover almost 100% of its gamut.

Modern Android(Chinese manufactured such as Huawei and Oppo and etc made after 2020 years) : DCI-P3Refer : 使用广色域内容增强图形效果  |  Android 开发者  |  Android DevelopersMost of artist used sRGB monitor until now.

You can comparing iPhone 11 and your dell monitor about How much saturated feeling.

Art final look development solution.Idea phase.Color matrix emulator.

C# Script parts.

Matrix4x4 srgb2xyz = new Matrix4x4(
                new Vector4(0.4123908f, 0.2126390f, 0.0193308f, 0.0f),
                new Vector4(0.3575843f, 0.7151687f, 0.1191948f, 0.0f),
                new Vector4(0.1804808f, 0.0721923f, 0.9505322f, 0.0f),
                new Vector4(0.0f, 0.0f, 0.0f, 0.0f));

             Matrix4x4 xyz2p3 = new Matrix4x4(
                new Vector4(2.4934969f, -0.8294890f, 0.0358458f, 0.0f),
                new Vector4(-0.9313836f, 1.7626641f, -0.0761724f, 0.0f),
                new Vector4(-0.4027108f, 0.0236247f, 0.9568845f, 0.0f),
                new Vector4(0.0f, 0.0f, 0.0f, 0.0f));

            Matrix4x4 srg2p3_boundary_direction = new Matrix4x4(
                new Vector4(0.225f / 0.23f, -0.042f / 0.23f, -0.02f / 0.23f, 0.0f),
                new Vector4(-0.225f / 0.24f, 0.042f / 0.24f, -0.079f / 0.24f, 0.0f),
                new Vector4(0.0f, 0.0f, 0.1f / 0.098f, 0.0f),
                new Vector4(0.0f, 0.0f, 0.0f, 0.0f));

            Shader.SetGlobalMatrix("srgb2xyz", srgb2xyz);
            Shader.SetGlobalMatrix("xyz2p3", xyz2p3);
            Shader.SetGlobalMatrix("srg2p3_boundary_direction", srg2p3_boundary_direction);
            Shader.SetGlobalVector("enlarged_srgb_max_color", new Vector4(1.23f, 1.24f, 1.098f, 0.0f));

Shader Parts

            // 1.225,   -0.042, -0.02
            // -0.225,  1.042, -0.079
            // 0,       0,      1.098            
            float4 min_rgb = float4(0,0,0,0);
            float4 raw_color = float4(,0);
            float4 raw_srgb_max_color = clamp(raw_color, min_rgb,enlarged_srgb_max_color);
            float4 overflow = max(raw_srgb_max_color-float4(1,1,1,0),min_rgb);
            float4 adjusted_result = mul(srg2p3_boundary_direction, overflow)+saturate(raw_srgb_max_color);
            float4 xyz = mul(srgb2xyz, adjusted_result);
            output.rgb = mul(xyz2p3, xyz).rgb;

Aligned acknowledge

Congraturations Finally you can watching to simulated Display p3 simliar results by approximation my idea even if you still use to old Dell display monitor When you development of look dev stuff.

Liked it? Take a second to support leegoonz on Patreon!

Categories: shader

Tagged as: , ,

댓글 남기기