Search Unity

Screen space - camera canvas has 'choppy' UI when camera moves.

Discussion in 'UGUI & TextMesh Pro' started by notgrantcawood, Aug 22, 2014.

  1. notgrantcawood

    notgrantcawood

    Joined:
    Feb 1, 2014
    Posts:
    13
    I tried to upload a video of what is happening, but the file is too small so vimeo won't accept it.

    I have a canvas set to Screen Space - Camera. In the canvas is just one image at the moment.

    The camera needs to move in the game, I've tried using both these methods:

    Code (CSharp):
    1.  
    2.             cameraTrans.position = Vector3.MoveTowards(cameraTrans.position, cameraStartPos, 5 * Time.deltaTime);
    Code (CSharp):
    1.  
    2.             cameraTrans.position = Vector3.Lerp(cameraTrans.position, cameraStartPos, 5 * Time.deltaTime);
    When the camera moves, the image shakes a bit, like it's reacting to drag or being held back somehow.

    Sorry I don't have a video to show.

    I'm not sure if it's a bug or if there's another way it can be done.

    Thanks!
     
  2. Likvidniy

    Likvidniy

    Joined:
    Dec 24, 2012
    Posts:
    4
    canvas must not be a child of camera .
     
    nmanaigre likes this.
  3. notgrantcawood

    notgrantcawood

    Joined:
    Feb 1, 2014
    Posts:
    13
    I never said it was a child of the camera...
     
  4. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    It looks like it depends on when the camera movement is updated.
    Sadly, for my current game, the camera is updated in FixedUpdate to follow properly the player.
    It's a fast pace game, so the UI is just about showing a few flickering pixels at the bottom of the screen. Currently, Screen Space is out of question for me.
     
  5. notgrantcawood

    notgrantcawood

    Joined:
    Feb 1, 2014
    Posts:
    13
    Interesting. I've got mine running in Update.

    It's only for a short time that my camera needs to move in the game, I might have to end up moving the background instead, just to keep the UI clean.
     
  6. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    Sorry for the ignorance, but why not?
    How else do you rig a GUI that you want to follow the camera? Or does the overlay mode automatically ensure that the content is rendered in the active camera..?
     
  7. Likvidniy

    Likvidniy

    Joined:
    Dec 24, 2012
    Posts:
    4
    dont know why , just know what it will cause jerky behaviour , and ye overlay mode automaticly follows camera .
     
  8. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    If you can make a repro project for this we will investigate.
     
  9. Cherami

    Cherami

    Joined:
    Jul 3, 2014
    Posts:
    4
    Hi everyone!

    I have a similar issue. I have a basic project that exposes the problem (see the zip file). In my case, i make a uGUI button, with canvas set to "Screen Space - Camera". The camera that displays the GUI come from to the FPS character controller standard package.
     

    Attached Files:

  10. andsee

    andsee

    Joined:
    Mar 20, 2012
    Posts:
    88
    I had issues like this in a scrolling list which may be similar. When scrolling the list the frame rate dropped to 8fps on a device. I tracked this down to unity rebuilding the meshes used for the gui, well in fact I think it's down to it's layout calculations possibly being called too many times.

    Anyway a quick fix for me was to switch OFF pixel perfect. Although ideally it should not need to recalculate the contents of the scrollview but instead offset the scrollview by an amount that keeps everything inside it pixel perfect.
     
    Prosto_Lyubo likes this.
  11. inkipinki

    inkipinki

    Joined:
    Jun 19, 2013
    Posts:
    22
    Hello,

    I've found the same (orig post) problem, but i was forced to use the world or screen space version of the canvas, with a attached renderer, because i want post proccess effects on the gui.

    Long story short, unity messes up the scaling of the UI and i think the very low size of the canvas and it's children makes it "choppy".

    I think its a problem in unity, but there are some ways around it. The most important things are the:
    -scaling
    -position
    -event camera attaching

    Also, attached a file with 3 "solutions/fixes" for this problem, i hope it helps.
     

    Attached Files:

    JoanMM likes this.
  12. Cherami

    Cherami

    Joined:
    Jul 3, 2014
    Posts:
    4
    Yes, like you, I think its a problem in unity. But your tricks works fine. I had not thought to include the canvas as child camera's. Thanks inkipinki.
     
  13. notgrantcawood

    notgrantcawood

    Joined:
    Feb 1, 2014
    Posts:
    13
    Thanks inkipinki. I haven't had a chance to spend some time and sort out my problem, your files will help though, thanks!
     
  14. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    580
    Thanks inkipinki, the solution for me was to have the canvas as child of camera, in Screen Space, and with the Render Camera linked properly. In your package I found it unlinked, so I don't know if is an import problem or you resolved differently. The method I used seem the only one behaving correctly also with the Reference Resolution component to scale the GUI based on the proportion of the device.
     
    SirGhoul and sGlorz like this.
  15. inkipinki

    inkipinki

    Joined:
    Jun 19, 2013
    Posts:
    22
    Welcome, the unlinked camera was One of the solutions! try attaching it in that project.
     
  16. sGlorz

    sGlorz

    Joined:
    Dec 4, 2013
    Posts:
    20
    Having the canvas child of camera works for me also as I update camera location in FixedUpdate. Thanks inkinpi.
     
  17. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Can you please post case numbers of submitted bug reports, please?

    We're interested in fixing this issue in Unity, not just require everyone to implement workarounds.

    Thanks.
     
  18. Jason71

    Jason71

    Joined:
    Oct 16, 2014
    Posts:
    2
    i have the same problem. jerky camera.
    i think if you add UI elements and use the "Camera Follow" script that unity created you will get the jerky motion. I do.
     
  19. Gizmoi

    Gizmoi

    Joined:
    Jan 9, 2013
    Posts:
    327
    I reported this bug 10th September. 4 versions ago.
    http://fogbugz.unity3d.com/default.asp?632332_cfm5impdrq2vb2st
     
  20. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Gizmoi likes this.
  21. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    This is still an issue. We use a canvas for a display in a vehicle. It is a world space canvas and is a child of the vehicle rig. The GUI does not move in sync with the vehicle. When the vehicle is at speed, there is significant perceived judder of the display - even to the point of it clipping below the dash. (And no, this is not a precision issue - it happens very close to origo).
    Any news on the progress of fixing this or will we have to scrap the use of the UI system for this purpose? Thanks in advance!
     
  22. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    BTW - this is marked as fixed in the issue tracker...? Is it? If so, will the fix appear in b22? (It is still present in 21).
     
  23. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Well, no new betas has been released since a I posted the comment "Thanks for pointing us towards it.".

    A fix to this issue will be in the next beta.
     
  24. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    I only considered that the thread was old and so was the bug report, but fair enough. Thank you for looking into / fixing the issue!
     
  25. Arainami

    Arainami

    Joined:
    Dec 2, 2014
    Posts:
    11
    I found the problem. When I turn on the 'Screen Space - Camera' and the camera changes the fov, there is 'choppy' effect. Bug found in version 4.6.0 f3
     
    Last edited: Dec 2, 2014
  26. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Do you have a case number?
     
  27. Arainami

    Arainami

    Joined:
    Dec 2, 2014
    Posts:
    11
    Probably not. This is my first time on this forum... I googled the problem description, and stumbled on this topic. The problem arises when I gradually change the FoV of the camera in any cycle (Update, LateUpdate etc.). Through lerp function
     
  28. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    All right, see this message for how to file bug reports:
    http://forum.unity3d.com/threads/reminder-how-to-get-bugs-fixed-quickly.266818/
     
  29. ml1985

    ml1985

    Joined:
    Dec 29, 2013
    Posts:
    22
    Hi Guys

    Any updates on this issue as I seem to be experiences the same judder with the canvas.
     
  30. Gizmoi

    Gizmoi

    Joined:
    Jan 9, 2013
    Posts:
    327
    The original bug (the one I had anyway) has been fixed.
    But I noticed a similar issue when moving the camera through space, and I believe it's simply by design, as each point in the canvas tried to snap to a pixel it jumps around because it's actually flying through space.

    I mitigated the issue by having a separate static camera that renders my UI.
     
  31. Blitzkriegmlg

    Blitzkriegmlg

    Joined:
    May 1, 2013
    Posts:
    8
    I am using the built-in assets for a first person camera controller and my game is a split screen first person shooter. I have two UI canvases because I have two cameras and those canvases are set to render per camera. When my players move the UI images sort of flash in and out constantly. I'm not sure if this is a different problem than what is described here but I would really like to know the solution.
     
  32. Wenamun

    Wenamun

    Joined:
    Jan 9, 2015
    Posts:
    14
    I can add my voice to this thread and confirm this issue is still a very present problem in v. 5.1. I need to use screen space canvases and whenever I move them or their parent objects the UI stutters and shakes terribly. Elements will randomly appear and disappear and as the camera rotates some elements lose their ability to be interacted with.
    It seems the stutter gets worse the closer the canvas is rendered to the camera's minimum frustum plane. This issue is making my UI completely unusable, so I'm starting on a workaround now.
     
  33. malyna

    malyna

    Joined:
    Jul 9, 2010
    Posts:
    105
    Hello,
    I've the same issues,
    When moving camera (Update, LateUpdate), UI (Screen Space - Camera) can't catchup and offsets itself in oposite direction to the camera moving direction (looks like UI position is updated less fraquent then camera position).
    Setting UI as child of the camera is not helping.
    Is there some solution for that problem?
    Thanks in advance!

    Quick Update:
    My problem occurs only if my Screen Image Effect is on and only in Editor, on device everything is runnig perfectly fine.
     
    Last edited: Jun 19, 2015
  34. blizzy

    blizzy

    Joined:
    Apr 27, 2014
    Posts:
    775
    Use a different camera for UI only (set to clear depth only), and don't move that camera.
     
    Lylezz likes this.
  35. yjr310_17ss

    yjr310_17ss

    Joined:
    Jul 4, 2015
    Posts:
    1
    I have similar problem in Unity 5.0.2f1. In my case:
    I'm developing cockpit-view space shooter. As the transform.position of the spaceship (and following camera which is a child of spaceship) gets greater, the objects near the camera (not only Canvas objects, such as cockpit frame) start jittering. The position of the camera gets close to the default position (0,0,0), the jittering stops.
    Render mode of the Canvas is 'World Space'.

    I've tried the solutions mentioned above, but they don't work. I think this problem is not only about new GUI.
     
  36. blizzy

    blizzy

    Joined:
    Apr 27, 2014
    Posts:
    775
    This is an entirely different problem. You are experiencing floating point precision issues. Don't get too far away from the origin (0,0,0).
     
  37. CGDever

    CGDever

    Joined:
    Dec 17, 2014
    Posts:
    156
    I found this bug too, unreal....
     
  38. lexacutable

    lexacutable

    Joined:
    Jan 24, 2014
    Posts:
    8
    Yep, I'm also getting this problem when altering the FOV of a camera that a screen-space canvas is connected to. I've tried updating in both Update and LateUpdate (as well as in a coroutine), to no avail. I know I can use separate cameras for the UI overlay; it's just a bit tedious when I already have several cameras doing different things.
     
  39. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    I'll reiterate: If you believe you are seeing bugs, we need bug reports. Just discussing issues here without reporting them in our bug tracker will not get anything fixed.

    See this message for how to file bug reports:
    http://forum.unity3d.com/threads/reminder-how-to-get-bugs-fixed-quickly.266818/

    If you have already filed a bug report, you can post the case number here, then UI Team or others who look in this thread can see that it has already been reported. Thanks!
     
  40. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    Hi @runevision

    I've known about this bug for about a year, but always found a way around it. Recently I didn't want to so I found this thread ;)

    The bug still exists.

    Any uGUI that is in screen space - camera, on a moving camera, using a render camera, gets tremendous amounts of lag.

    Reported with scene file.

    Case no: 763883
     
    MihaPro likes this.
  41. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Thanks!

    I'm not on UI Team myself anymore but I've forwarded to them.

    Edit: Unfortunately this case had no repro project attached and could not be reproduced by QA.
     
    Last edited: May 15, 2017
  42. centaurianmudpig

    centaurianmudpig

    Joined:
    Dec 16, 2011
    Posts:
    92
    I have the same problem with ScreenSpace Overlay and in World Space. Submitted a bug report: 791841
     
  43. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    I found out that putting the camera in overlay at a long distance (ex.: 250) removes a lot of the flickering. For some reason, putting the canvas too close (<1) to the camera make the issue a lot more visible.
     
    W4rf4c3 likes this.
  44. Skyboard_Studios

    Skyboard_Studios

    Joined:
    Jul 20, 2013
    Posts:
    51
    check this out. You can see the choppy UI Text when attached to the camera. Something that is hard not to notice is how smooth the other text while using a non out of the box component.

     
    Last edited: Nov 1, 2016
  45. ethem

    ethem

    Joined:
    Jul 25, 2016
    Posts:
    1
    i have exactly the same problem, did you find a solution?
     
  46. W4rf4c3

    W4rf4c3

    Joined:
    Jan 22, 2016
    Posts:
    13
    Setting the plane distance in the Canvas fixed it too for me. Its was at 1 and setting it to 10 fixed it!! Thanks
     
  47. dyuldashev

    dyuldashev

    Joined:
    Mar 3, 2016
    Posts:
    76
    I am seeing this issue. I cannot seem to get any solution. I have a Camera and no UI. I have a few objects, and when I try to move the Camera at a constant speed, everything else jitters. Actually, the Camera jitters, hence seeming like the whole screen space is shaky. I tried lerping, changing the position manually, interpolations, PPU and Sprite import settings, setting VSync.count to 0, lowering the quality, even buffering Physics updates and reading the values in the Update() function. However, the Camera is shaky, and I don't really know what else can be done here. Any ideas?
     
  48. Skeledurr

    Skeledurr

    Joined:
    Jan 5, 2015
    Posts:
    23
    I couldn't find any solution. We ended up redesigning the interface to work in the world space.
     
  49. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    If you are seeing issues, please file a bug report. The one above did not have a repro project attached and could not be reproduced by QA.
     
  50. dakiesse

    dakiesse

    Joined:
    Jan 11, 2018
    Posts:
    2
    Hi there! I have been the same problem and found a solution (accidentally). I'm having:

    The main camera and UI (Canvas) on the same level:
    upload_2018-2-22_20-3-7.png

    Camera component settings:
    upload_2018-2-22_20-4-37.png

    Canvas component settings:
    upload_2018-2-22_20-5-24.png

    Previously The canvas' property of "Plane Distance" was 100 and I had UI (canvas) flicker while camera moving. Now I set 1 unit and the problem was solved in my case.
     
    Last edited: Feb 22, 2018