1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. Unity 2017.1 beta is now available for download.
    Dismiss Notice
  5. Unity 5.6 is now released.
    Dismiss Notice
  6. Get further faster with the Unity Plus Accelerator Pack, free for new Unity Plus subscribers for a limited time. Click here for more details.
    Dismiss Notice
  7. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  8. Learn how you'll soon be able to publish your games to China in four simple steps with Xiaomi. Sign up now for early access.
    Dismiss Notice

5.6.0 Camera Depth/Viewport issues

Discussion in 'Editor & General Support' started by AllanMSmith, Apr 6, 2017.

  1. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    157
    Hey,

    We are developing a project that uses NGUI. We have a UI Camera rendering all UI, and we also have another ortographic camera rendering some 3D UI. They are both in the same position and the UI Camera is set to Depth 2, while 3D UI is set to Depth 0. For some reason, after updating to Unity 5.6.0, the 3D UI Camera started rendering stuff AHEAD of the UI Camera, even though its depth was smaller. Both cameras are "Depth Only" in Clear Flags, and this exact setup was working properly in Unity 5.4.3 (our previous version).

    Whats different here is that the 3D UI camera has its viewport resized... we dont want it to render on the whole screen so we adjust its viewport based on resolution and so on. For even more mysterious reasons, if I get the UI Camera, which has a viewport of 0,0,1,1, and change it to anything that isnt 0,0,1,1, for example "0,0,1,1.01", it is then rendered in front of the 3D UI Camera, as it was supposed to.

    I tried to replicate this in an empty project and another error occurred (and has been reported), but I couldnt replicate this exact error and thats why Im posting here. Since this was working properly in Unity 5.4.3 I can only guess that this is a 5.6.0 bug (camera with lower depth being rendered in front).

    Not sure if there is anything that can be done here aside from waiting for an update, but I wanted to let Unity know that this for some reason is happening.

    Thanks for the attention,
    Best,
    Allan
     
    MrEsquire likes this.
  2. kolmich

    kolmich

    Joined:
    Apr 27, 2009
    Posts:
    144
    HI, we have exactly the same problem here.

    In release notes of 5.6 there is this description:

    Graphics: Refactored camera render ordering code. When a Scene is rendered, it now figures out which cameras can share the same render target. The rules for this are: Cameras must use the same display to share the same render target. Cameras must share the same viewport. All cameras must have a depth buffer, or none of them must have a depth buffer. If the Scene is being viewed in VR, the cameras implicitly share the same render target. These cameras are then split into a stack, which is rendered into a shared Texture based on depth ordering. This Texture has the most common settings found in the cameras in the stack. The following rules also apply: If any camera wants MSAA, the Texture is an MSAA buffer. If any camera wants HDR, the Texture is an HDR buffer. If there are any deferred cameras in the stack, MSAA is disabled (MSAA is not compatible with deferred cameras).

    In our project there is an additional clear camera. Render order should be clear camera, graphics camrea, ui camera. As soon as the cameras have different viewports depth sorting is not working correctly anymore. But depth sorting works if all viewports are 0,0,1,1. I guess this is a unity bug?

    Best wishes,

    Michal
     
  3. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    157
    I reported a bug about this to Unity and they told me that it is indeed a bug. They will be fixing this probably in the next release (but no dates promised). They said that since this is new it might take a bit to fix/test extensively... so I guess that for now we just have to be patient =/. For me, I just made the viewports have different sizes, and making sure that no viewport is the default size... and it worked fine again for me... lets just say its a temporary hack until the real error is fixed.

    Best,
    Allan
     
  4. coshea

    coshea

    Joined:
    Dec 20, 2012
    Posts:
    160
  5. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,577
    I was just about to write a topic to confirm if CameriaViewpoint is broken in Unity 5.6, any news?
     
  6. coshea

    coshea

    Joined:
    Dec 20, 2012
    Posts:
    160
  7. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,577
  8. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,577
    Patch 2 was released no fix, maybe I test beta 2 waiting...need solid confirmation as this is show stopper
     
  9. coshea

    coshea

    Joined:
    Dec 20, 2012
    Posts:
    160
    Yep, it completely breaks a lot of peoples games. Unity need to fix this asap.
     
  10. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,577
    I just checked Beta 2017.b2, not sure if I see fix in changelog, can you confirm?
     
  11. coshea

    coshea

    Joined:
    Dec 20, 2012
    Posts:
    160
    I hope they fix this critical issue in 5.x not just in 2017
     
  12. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,577
    Patch 3 is out, did it fix it for you?
     
  13. coshea

    coshea

    Joined:
    Dec 20, 2012
    Posts:
    160
    Problem still persists in 5.6.0.p3
     
    MrEsquire likes this.
  14. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,577
    Thanks for confirming, wasnt sure if it was just my project, but yeh it didnt seem to fix in p3 for me, like I said when Unity say future patch release could wait for weeks, when do not have such time to wait around, need release games..
     
  15. coshea

    coshea

    Joined:
    Dec 20, 2012
    Posts:
    160
    What I don't understand is, anyone not using 0,0,1,1 view port in their games is going to have a very broken game. Why aren't Unity doing more to fix this, grr
     
  16. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,577
  17. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    18,840
    A potential problem here is that people are assuming that it's their issue being fixed. Do post your *own* bug reports to Unity. A similar issue is often exactly that: it was similar and it got fixed. Make sure when doing a "me too" your issue really IS identical to the OP.

    I've seen people get bitten by this time and time again, waiting forever for a fix that never comes because they assumed they had the same problems.

    5.6 changed a lot more than just those release notes. For example someone might leap from 5.4 and get bitten by 5.5 changes and look at 5.6 release notes. Or someone might be having reverse z buffer issues or their platform has similar but different issues.

    Please post a bug report if you're not 100% sure. Even if your issue is the same, your hardware and OS might not be. So it might not get fixed.
     
  18. Ironmax

    Ironmax

    Joined:
    May 12, 2015
    Posts:
    704
    If Unity slows down the process of new Unity versions, there wont be this issue where ppl fall back on older release bugs, bugs and broken features are not good things. For does who work with large game project can't just jump on new client release every month, and then to find out that there are bugs and failure on it.

    What i am saying is that, its better to spend more time on a release and make it more "compleat" than planning /pushing a "fix" for the next version.. I have project that has gone tru 4 Unity versions before its been compleated, lot of that time has gone in to fix client version adjustment and reprogramming of shaders etc.
     
    MrEsquire likes this.
  19. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,577
    Thank you for your reply,some valid points, but you can write all day long.
    The fact the matter is Unity do not know how to priorities there bug reports on show stopper bugs.
    When a show stopper bug is found it should be treated most urgent and other bugs can wait, does not matter who reports or posts it. This is the issue I have, no priority , and do not try and defend Unity because its been a problem for over a year now.. Mobile developers always suffer, and no I do not wish to install 3-4 versions of Unity and play a game called, which version is ok to use for Android, which one for iOS, which has a feature missing, which has bug and so on. you get my thoughts....
     
    Ironmax likes this.
  20. SaraCecilia

    SaraCecilia

    Product Community Manager Unity Technologies

    Joined:
    Jul 9, 2014
    Posts:
    655
    Hi! This is fixed in 5.6.0p4 and 5.6.1.
     
  21. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,577
    Thanks but when can we expect patch 4?
     
  22. SaraCecilia

    SaraCecilia

    Product Community Manager Unity Technologies

    Joined:
    Jul 9, 2014
    Posts:
    655
    Later this week :)
     
  23. vortexilation

    vortexilation

    Joined:
    Sep 25, 2009
    Posts:
    255
    MrEsquire likes this.
  24. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,577
    When was the last time they didnt say " after a small delay" I think the dates for patches need be changed
     
  25. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,577
    Weekend dont count, they dont release on weekend!
     
  26. vortexilation

    vortexilation

    Joined:
    Sep 25, 2009
    Posts:
    255
    They did :-D, check 5.6.0p2 which was released on 22 april 2017 hehe

    Edit :
    Oops they did it on 21 April but announcement on 22 April, looks like it's on monday afterall.
     
  27. SaraCecilia

    SaraCecilia

    Product Community Manager Unity Technologies

    Joined:
    Jul 9, 2014
    Posts:
    655
    The aim was to release Thur/Fri but testing was still taking place so hopefully I can get a status update today on that.
    No weekend releases, no :p
     
    vortexilation likes this.
  28. SaraCecilia

    SaraCecilia

    Product Community Manager Unity Technologies

    Joined:
    Jul 9, 2014
    Posts:
    655
  29. coshea

    coshea

    Joined:
    Dec 20, 2012
    Posts:
    160
    Tried project on 5.6.0p4 and the viewport problem still exists for me. I'm not seeing any viewport related fixes mentioned in the changelog?
     
    MrEsquire likes this.
  30. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,577
    These Unity patches are driving me crazy! I been trying each patch and even the beta and my problem exists. There no error messages just behaviour is not same as previous Unity version, why cannot Unity team member reply to this topic and explain what is going on??
     
  31. SaraCecilia

    SaraCecilia

    Product Community Manager Unity Technologies

    Joined:
    Jul 9, 2014
    Posts:
    655
    Ugh sorry, this changed last minute before the weekend, they must've run into issues during testing.
    It seems for now it's aimed for 5.6.1p1 instead. Apologies for the false information earlier.
     
    MrEsquire and AcidArrow like this.
  32. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,577
    Okay at least we know once again we need to wait and not going crazy.. But it sounds like this will be released next week, maybe two weeks wait if delays, this is pretty long time to wait, can you please ask if they can add this sooner even to the beta 4 release?
     
  33. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,577
    Seems 5.6.1 is released, so when can we expect patch 1?
     
  34. SaraCecilia

    SaraCecilia

    Product Community Manager Unity Technologies

    Joined:
    Jul 9, 2014
    Posts:
    655
    It's currently aimed to be released next week.
     
  35. SaraCecilia

    SaraCecilia

    Product Community Manager Unity Technologies

    Joined:
    Jul 9, 2014
    Posts:
    655
    Alright, 5.6.1p1 is out with the following fix:

    885051 - Graphics: Fixed rendering of multiple cameras and depth being ignored when setting camera viewports to be different to each other.
     
    vortexilation likes this.
  36. coshea

    coshea

    Joined:
    Dec 20, 2012
    Posts:
    160
    Thanks, I've just downloaded and still not convinced it is fixed. I'll file a separate issue with an example project.
     
  37. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,577
    I agree with you, don't think the build solved my issue also.. very sad about this...
    Something is still not right... maybe if you post your project in the Beta bug section you get a free tshirt and maybe win a prize... seriously Unity have the cheek to run such things yet not fix existing issues..
     
  38. clater

    clater

    Joined:
    May 9, 2017
    Posts:
    1
    5.6.1p not fixed. ㅠㅠ
     
    MrEsquire likes this.
  39. ahn2150

    ahn2150

    Joined:
    Nov 5, 2010
    Posts:
    9
    Thank you. This patch version has been resolved in my case.
     
  40. coshea

    coshea

    Joined:
    Dec 20, 2012
    Posts:
    160
    Weirdly in Editor the viewport stuff doesnt work for me but once I build to iOS on device it is fine. Not so good for development though. I wonder if its a Mac editor issue.

    @clater @MrEsquire what OS are you using?
     
  41. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,577
    UPDATE: So I tried this build and latest beta 6, my issue still exists.
    Tried on Windows and MacOSX, building on iOS still caused issue.
    Therefore Im giving up now, have no more time to waste, I know its a Unity issue
    As Im just updating my game from old version of Unity to new etc

    Last question: What type of camera you using? Perspective or Orthographic, or this should not matter?
     
  42. jarvisjang

    jarvisjang

    Joined:
    Nov 28, 2016
    Posts:
    3
    This issue is not fixed yet.
    OSX / 5.6.1p1(64-bit)

    I cannot change my viewport rect!! Please fix asap!!
     
    Last edited: May 20, 2017
    clater and MrEsquire like this.
  43. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,000
    I still have this bug in 5.6.1f1 on Mac OS Sierra. Bug report sent....

    1. What happened

    Splash Scene: Contains Loading Mng, this manger has a camera and a few sprites. Loading Mng does not destory on load, it will always exists in every scene. It will be used to manage transitions. It camera has the highest depth of all cameras in the project at 100.

    Load Home Scene: At Home Scene Loaded, the HomeMng, contains its own camera, at depth 0. It also contains a few sprites.

    2. The issue:

    All home scene sprites can be seen (all layers of all obects are designated corrcetly to each camera, which is set to render its desiganted layer, only).

    Load Home Scene (scene 1). Home Scene contains 1 camera, with depth 0 + the said manager from splash scene, this camera has a depth of 100.

    On Home Scene Level Loaded, all objects being rendered by the home camera, should not be seen as they are subject to the camera, which has a lower depth value

    Using
    Unity 5.6.1f1 with Mac OS Sierra


    edit:
    Further, even if I turn off all cameras, some images are still rendered. It takes a solid 5-10 seconds for the game view to adjust.
     
    onHead likes this.
  44. onHead

    onHead

    Joined:
    Feb 11, 2016
    Posts:
    3
    I wonder this bug is fixed or not.
    I still have this bug in 5.6.1f1 on Mac OS Sierra too.