- Home /
flickering lines when zooming fov (both GUI and ortho cameras).
I swapped from using planes with an orthographic camera to using OnGUI draw calls, because of flickering that occurred when moving the camera around and zooming out.
Now I notice a similar problem when scaling the GUI.
int px = -Screen.width / 2;
if (zoomX > 0)
{
px = px * -1 ;
}
int py = -Screen.height / 2;
if (zoomY > 0)
{
py = py * -1;
}
GUIUtility.ScaleAroundPivot(new Vector2(zoomX, zoomY), new Vector2(px, py));
//Onto draw textures
Textures larger than 128 * 128 pixels, have lines drawn on them out of nowhere and gaps between them.
Compare this (zoomX=1 zoomY=1)
With this (zoomX=0.75 zoomY=0.75):
The lines keep flickering as the area rendered moves.
Why is this the case? How can I fix it?
This has been driving me mad for the entire day now :( Please help!
Answer by glider521al · Jan 16, 2013 at 12:04 PM
It's okay guys, found a solution.
Simply set the wrap mode of each texture to clamp and used GUI.drawTexture instead of graphics.DrawTexture
and that fixed it. :)
Thanks for co$$anonymous$$g back ;)
I'll accept your answer for you so you get the karma ;)
Such questions are quite rare:
Good question title
Problem well explained (with screenshots)
Simple and straight forward solution
Answer by Imankit · Jan 16, 2013 at 06:36 AM
I think the Camera should always be moved in LateUpdate... As when we move the camera with the position of the object in Update or OnGUI it flickers.. But if we move the camera in LateUpdate first the object takes position in Update then camera sees it in LateUpdate...