Skip to content

Commit

Permalink
Fix flipped Y UV on quest in AVPro player
Browse files Browse the repository at this point in the history
  • Loading branch information
MerlinVR committed Oct 31, 2022
1 parent 2352068 commit 2b7ae2e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Assets/USharpVideo/Shaders/CRTRenderTextureProcessor.shader
Expand Up @@ -63,7 +63,14 @@
if (any(uv <= 0) || any(uv >= 1))
return float3(0, 0, 0);

float3 texColor = tex2D(_SourceTexture, _IsAVPro ? float2(uv.x, 1 - uv.y) : uv).rgb;
#if UNITY_UV_STARTS_AT_TOP
if (_IsAVPro)
{
uv = float2(uv.x, 1 - uv.y);
}
#endif

float3 texColor = tex2D(_SourceTexture, uv).rgb;

if (_IsAVPro)
texColor = pow(texColor, 2.2f);
Expand Down
11 changes: 10 additions & 1 deletion Assets/USharpVideo/Shaders/StandardVideoCore.cginc
Expand Up @@ -55,10 +55,19 @@ half3 VideoEmission(float2 uv)
// return float3(0, 0, 0);
}

float3 texColor = tex2D(_EmissionMap, _IsAVProInput ? float2(uv.x, 1 - uv.y) : uv).rgb;
#if UNITY_UV_STARTS_AT_TOP
if (_IsAVProInput)
{
uv = float2(uv.x, 1 - uv.y);
}
#endif

float3 texColor = tex2D(_EmissionMap, uv).rgb;

if (_IsAVProInput)
{
texColor = pow(texColor, 2.2f);
}

return texColor * _EmissionColor.rgb * visibility;
#endif
Expand Down

0 comments on commit 2b7ae2e

Please sign in to comment.