Open thegladscientist opened 3 years ago
Same issue by me. I am also wondering if it is compatible with DX12 with the HDRP + DXR? Do you know something about it?
Hello, it looks like it's all about gamma color space. Need some adjustments for linear version. I think it should work:
half4 uyvy = tex2D(_MainTex, uv);
uyvy = LinearToGamma(uyvy);
half4 LinearToGamma(half4 col)
{
if (col.r <= 0.0031308)
col.r = col.r * 12.92;
else
col.r = 1.055 * pow(col.r, 0.4166667) - 0.055;
if (col.g <= 0.0031308)
col.g = col.g * 12.92;
else
col.g = 1.055 * pow(col.g, 0.4166667) - 0.055;
if (col.b <= 0.0031308)
col.b = col.b * 12.92;
else
col.b = 1.055 * pow(col.b, 0.4166667) - 0.055;
col.a = col.a;
return col;
}
Just did some testing back and forth with this and the AvPro Decklink plugin, and found that the quality was higher using this code. Unfortunately when using it in 2019.3.7 version of Unity (with HDRP) the video was coming in tinted blue/green. Of course I had to update the way that the RenderPipelineManager was calling beginCameraRendering to work with newer versions of HDRP, but after that I am facing this issue. Any insights would be incredible. 👍
Avpro:![decklink capture 2 (quad scale 1)](https://user-images.githubusercontent.com/2229204/94418054-d6409180-01bb-11eb-95cd-0b88eefd175c.png)
Klinker on Standard Pipeline:![keijiro capture 2](https://user-images.githubusercontent.com/2229204/94418062-d80a5500-01bb-11eb-9d6c-466b0a4aa6c2.png)
Klinker on HDRP in newer Unity editors:![keijiro capture-HDRP](https://user-images.githubusercontent.com/2229204/94417984-be690d80-01bb-11eb-9c6c-a9917a35819c.png)