Image Target is not properly showing centered/scaled the image marker representation

0 votes
asked Jun 18 by juvelez (910 points)

When using the Image Target to track an image, the Image Target Component is not showing properly centered or properly scaled the representation of the image marker while editing, making very hard to distribute the content within due to the bad position/scale reference, take a look to the following screenshot, where the representation of the image target appears off center and smaller than it should be, I've placed a transparent area that shows the correct position and scaling. If you observe the scaling and position of the content(cube) is placed at the center, but it appears off center according to the current marker representation, but with the suggested(corrected) position and scaling it appears correctly centered.

I'm using EasyAR 3.1.0, I am missing something?, the scene is quite simple.

none

1 Answer

0 votes
answered Jul 9 by kenn (7,570 points)

We have reproduced this issue. It is caused by Gizmos.DrawGUITexture on high dpi displays when display scale factor is not 1. We have made a fix in the coming release this month.

If you need a fix in an older version, just replace vertex shader in ImageTargetGizmo.shader to use below code

v2f vert (appdata v)
{
    v2f o;

    o.uv = TRANSFORM_TEX(v.uv, _MainTex);
    v.vertex.xy = lerp(lerp(float2(0, 1), float2(1, 1), o.uv.x), lerp(float2(0, 0), float2(1, 0), o.uv.x), o.uv.y);
    v.vertex.x = (v.vertex.x - 0.5);
    v.vertex.y = (v.vertex.y - 0.5) * _Ratio;
    v.vertex.z = 0.001;
    v.vertex = mul(_Transform, v.vertex);
    o.vertex = UnityObjectToClipPos(v.vertex);

    return o;
}

commented Jul 9 by juvelez (910 points)
edited Jul 9 by juvelez
Thanks a lot for your answer, your solution fixed the problem immediately.
The reason is exactly that, the problem occurred on a 4k monitor that is not 72dpi but 96dpi, what is exactly the difference in the proportion. Sorry for not pointed the problem on that direction.
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...