Skip to content

Commit 2b7ae2e

Browse files
committed
Fix flipped Y UV on quest in AVPro player
1 parent 2352068 commit 2b7ae2e

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Assets/USharpVideo/Shaders/CRTRenderTextureProcessor.shader

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,14 @@
6363
if (any(uv <= 0) || any(uv >= 1))
6464
return float3(0, 0, 0);
6565

66-
float3 texColor = tex2D(_SourceTexture, _IsAVPro ? float2(uv.x, 1 - uv.y) : uv).rgb;
66+
#if UNITY_UV_STARTS_AT_TOP
67+
if (_IsAVPro)
68+
{
69+
uv = float2(uv.x, 1 - uv.y);
70+
}
71+
#endif
72+
73+
float3 texColor = tex2D(_SourceTexture, uv).rgb;
6774

6875
if (_IsAVPro)
6976
texColor = pow(texColor, 2.2f);

Assets/USharpVideo/Shaders/StandardVideoCore.cginc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,19 @@ half3 VideoEmission(float2 uv)
5555
// return float3(0, 0, 0);
5656
}
5757

58-
float3 texColor = tex2D(_EmissionMap, _IsAVProInput ? float2(uv.x, 1 - uv.y) : uv).rgb;
58+
#if UNITY_UV_STARTS_AT_TOP
59+
if (_IsAVProInput)
60+
{
61+
uv = float2(uv.x, 1 - uv.y);
62+
}
63+
#endif
64+
65+
float3 texColor = tex2D(_EmissionMap, uv).rgb;
5966

6067
if (_IsAVProInput)
68+
{
6169
texColor = pow(texColor, 2.2f);
70+
}
6271

6372
return texColor * _EmissionColor.rgb * visibility;
6473
#endif

0 commit comments

Comments
 (0)