Author Topic: all sprites disappear when antialiasing is off  (Read 12016 times)

Arcanor

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 46
    • View Profile
all sprites disappear when antialiasing is off
« on: January 15, 2014, 10:59:00 AM »
I'm running 3.0.8 f7 on Windows 7 64-bit.

When I run in the Unity editor everything looks fine.  When I build for PC standalone, and run the build with any quality setting that has Anti-aliasing set to 2x or better, everything looks fine, but when using the default "Good" quality (or lower) all of my UISprites disappear (Good has Anti-aliasing set to Disabled by default).

Note that I just updated from Unity 4.3.1 to 4.3.3 this morning, but I don't know if this problem was happening before then since I didn't test outside the editor until after I did the Unity update.

Thanks for any help you can offer.
« Last Edit: January 15, 2014, 02:27:47 PM by Arcanor »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: all sprites disappear when antialiasing is off
« Reply #1 on: January 15, 2014, 09:25:49 PM »
Are you sure it's not some other setting? It would seem highly unlikely that turning off anti-aliasing would suddenly make sprites no longer show up, especially considering that NGUI's project defaults to have it off.

Arcanor

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 46
    • View Profile
Re: all sprites disappear when antialiasing is off
« Reply #2 on: January 16, 2014, 02:51:58 AM »
Yes, absolutely sure.  I went to Quality settings and did nothing but change "Good" antialiasing from disabled to 2x, and the sprites showed up in the build.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: all sprites disappear when antialiasing is off
« Reply #3 on: January 17, 2014, 12:11:26 AM »
It all works correctly here, but I am still on 4.3.1. Win7 / x64.

Arcanor

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 46
    • View Profile
Re: all sprites disappear when antialiasing is off
« Reply #4 on: January 17, 2014, 03:27:48 AM »
Do you plan to upgrade to Unity 4.3.3 soon?  :-\

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: all sprites disappear when antialiasing is off
« Reply #5 on: January 17, 2014, 11:11:46 PM »
In the near future, yes.

Arcanor

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 46
    • View Profile
Re: all sprites disappear when antialiasing is off
« Reply #6 on: January 18, 2014, 07:58:05 PM »
More info:

This problem appears to have something to do with realtime resolution scaling.  When I run the "Good" quality build in windowed mode the sprites are fine until I resize the window.  As soon as I resize (using my mouse on the main app window edge and dragging), all sprites disappear.

If I run it in 1920x1080 full screen the sprites are fine too.  But if I choose a non-standard resolution (basically anything besides 1920x1080) the screen flickers a few times and eventually displays in the selected resolution (or the nearest supported one for my monitor), but all the sprites are missing.

Thanks again for any help or insight you can offer. :)

Arcanor

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 46
    • View Profile
Re: all sprites disappear when antialiasing is off
« Reply #7 on: January 19, 2014, 06:21:47 AM »
The sprites also disappear if I change the (windowed) screen resolution via code.

Arcanor

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 46
    • View Profile
Re: all sprites disappear when antialiasing is off
« Reply #8 on: January 19, 2014, 08:39:18 AM »
Narrowing this down further.

When switching resolutions repeatedly via code in windowed mode, if I keep going back to the same resolution at least 3 times, on the 2nd or 3rd time the sprites reappear!  They disappear again if I change resolutions again.

Any ideas? :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: all sprites disappear when antialiasing is off
« Reply #9 on: January 20, 2014, 12:55:46 AM »
So far I am not seeing anyone else reporting this... Just to confirm is it like so in your project, or does it happen in a clean project with just NGUI imported?

Arcanor

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 46
    • View Profile
Re: all sprites disappear when antialiasing is off
« Reply #10 on: January 20, 2014, 06:50:43 AM »
Apparently the original (antialiasing/resizing) problem I reported above was being caused by another package I'm using in my project (Xffect Pro).  When I isolated it down and disabled the effect object the problem went away.  Sorry for the red herring!  This seems to have had nothing to do with NGUI.

However, I think there's still a problem that I discovered while troubleshooting (or maybe a misunderstanding by me about how NGUI is supposed to work).  When I create a new project and import only Starlink and NGUI, all my sprites are invisible if I use Deferred Rendering.  Is Deferred Rendering not supported?  Or maybe there are some other settings that are required to support it properly?

Thanks.



ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: all sprites disappear when antialiasing is off
« Reply #11 on: January 20, 2014, 07:09:01 AM »
UI camera must use Forward Rendering.

Deferred rendering works with depth buffers, and UI has no depth writes. Plus it's not lit. Deferred is quite pointless for UI.

Arcanor

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 46
    • View Profile
Re: all sprites disappear when antialiasing is off
« Reply #12 on: January 20, 2014, 08:55:57 AM »
Thanks for the explanation.  I thought the 3D camera used depth, while the 2D didn't.  If that's not the case then what's the difference between having a 2D UI vs. a 3D UI?  Why does the Starlink sample have (and actively use) both?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: all sprites disappear when antialiasing is off
« Reply #13 on: January 21, 2014, 02:34:52 AM »
Both read depth, but NGUI's shaders don't write to depth.

Starlink uses both 3D and 2D because I wanted fancier looking UIs that were angled and tilted with animations. :)

sybixsus

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: all sprites disappear when antialiasing is off
« Reply #14 on: March 05, 2014, 06:23:52 PM »
Sorry for the bump, but I'm also getting all of my sprites/widgets/etc disappearing when I have antialiasing disabled. The only way I can find to fix the problem is to either force 2x multisampling in every quality mode or to disable post processing on the non-UI camera. My non-UI camera normally has the Vignetting post-processing script on it, although other PP effects may well have the same effect. Any idea why this combination of a PP effect and anti-aliasing would completely disable everything that NGUI is drawing?