Well, seems like the problem is in VideoBackground shader (Packages/Vuforia Engine AR/Vuforia/Shaders). To be more particularly with YUVNV21 in VB_YUVNV12_YUVNV21.
Spend couple hours to search info about, found a way to remove image split on 4 images on the screen and used the formulas to calculate conversion from YUVNV21 to RGB, but it doesnt work properly for now(seems like it recognize green color as a blue).
Still, it looks better than pink and green.
Highlighted with green the region, corresponds for removing 4 images(Not sure, but seems like _MainTex corresponds to your AR target image, _UVTex1 - to background camera view, so multiplying it by 1/2 reduces the number of images to 1).
Highlighted with yellow region corresponds to color conversion from YUVNV21 to RGB. Playing with values at higlighted pink region you can find the values, that corresponds to proper display of all colors from camera to your screen. The main problem is 4th value of vector, coz its alpha channel and i didint find specification for conversion, that contains 4 dimensional vector.
So, if you will find proper values - feel free to share, guys)
P.S. IDK, why vuforia couldnt fix this problem for years, maybe its really device connected problem, but you always can create special file for list of problem devices, so people in future will not have such problem.
/*===============================================================================
Copyright 2019 PTC Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
===============================================================================*/
#ifndef VUFORIA_VB_YUVNV12_YUVNV21_INCLUDED
#define VUFORIA_VB_YUVNV12_YUVNV21_INCLUDED
struct v2f {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float2 uv2 : TEXCOORD1;
};
sampler2D _MainTex;
float4 _MainTex_ST;
sampler2D _UVTex1;
float4 _UVTex1_ST;
v2f vuforiaConvertRGBVert(appdata_base v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
#if VUFORIA_YUVNV12
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
o.uv2 = TRANSFORM_TEX(v.texcoord, _UVTex1);
#else
o.uv = TRANSFORM_TEX(mul(v.texcoord, 1), _MainTex);
o.uv2 = TRANSFORM_TEX(mul(v.texcoord, 0.5), _UVTex1);
#endif
return o;
}
half4 vuforiaConvertRGBFrag(v2f i) : COLOR
{
half4 c;
half y = tex2D(_MainTex, i.uv).r;
half2 uv = tex2D(_UVTex1, i.uv2).rg;
#if VUFORIA_YUVNV12
half4 v4yuv1 = half4(y, uv, 1.0);
c.r = dot(half4(1.1640625, 0.000000000, 1.5957031250, -0.87060546875), v4yuv1);
c.g = dot(half4(1.1640625, -0.390625000, -0.8134765625, 0.52929687500), v4yuv1);
c.b = dot(half4(1.1640625, 2.017578125, 0.0000000000, -1.08154296875), v4yuv1);
c.a = 1.0;
#else
half4 v4yuv1 = half4(y, uv, 1.0);
half r = dot(half4(1, 2.03211, 0.000000000, -1.08154296875), v4yuv1);
half g = dot(half4(1, 0.000000000, 1.13983, -0.67060546875), v4yuv1);
half b = dot(half4(1, -0.39465, -0.58060, 0.52929687500), v4yuv1);
if (r < 0) r = 0;
if (g < 0) g = 0;
if (b < 0) b = 0;
if (r > 255) r = 255;
if (g > 255) g = 255;
if (b > 255) b = 255;
c.r = r;
c.g = g;
c.b = b;
c.a = 1.0;
#endif
return c;
}
#endif //VUFORIA_VB_YUVNV12_YUVNV21_INCLUDED
Where this code should be placed?