Skip to content

Color mismatch when re-rendering camera stream [Android]? #7830

Answered by ss9326
ss9326 asked this question in Q&A
Discussion options

You must be logged in to vote

Managed to fix this by setting my View's Tonemapping from Filmic to Linear, but to correct the camera texture's colors I applied the Filmic function in the camera material.

fragment {
    vec3 filmicTonemap(vec3 x) {
        const float a = 2.51;
        const float b = 0.03;
        const float c = 2.43;
        const float d = 0.59;
        const float e = 0.14;
        return (x * (a * x + b)) / (x * (c * x + d) + e);
    }

    void material(inout MaterialInputs material) {
        prepareMaterial(material);
        material.baseColor.rgb = filmicTonemap(inverseTonemapSRGB(texture(materialParams_cameraTexture, getUV0()).rgb));
        material.baseColor.a = 1.f;
    }
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ss9326
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant