Hi-Rez / Satin

A 3D Graphics Framework built on Apple's Metal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AR too bright on Satin + SceneKit + Metal fix

danmonaghan opened this issue · comments

AR background is way too bright. Sorry, should be a pull request, but not sure it's perfect.

I think you're meant to change the shader in SatinSceneKitARRenderer to:

    // don't return ycbcrToRGBTransform * ycbcr;
    
    float4 color = ycbcrToRGBTransform * ycbcr;
    // Flatten Color Space to rgb?
    return float4(pow(color.rgb, float3(2,2,2)), color.a); 

Very cool project.

thanks for pointing this out, will fix this in my next push :)

Hey @danmonaghan, so I did some research and I believe Metal hands converting from SRGB to linear when you sample a texture. I used Metal Shading Language's guide to converting srgb to linear and then resulting image was too dark, so I decided to keep the old version of the background shader. Please keep in mind that Satin only provides a starting point, so you are welcome to customize the background shader to your liking :)

Ok, so how would you suggest to fix the output mismatch then?

You could always modify the background shader to your liking. The background shader is an example, so its not core to how Satin does things. Just shows how to do it with Satin.