Author Topic: Using a shader with ZTest Always  (Read 7421 times)

Dover8

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 20
    • View Profile
Using a shader with ZTest Always
« on: March 20, 2013, 04:26:32 AM »
I've set up a NGUI Atlas that uses The Unlit-Transparent Colored shader, to which I have added the line
  1. ZTest Always
in order to make it appear on top of objects in the scene, without it having to be 2D. The only issue is with Labels that I add to a table at run time, the font doesn't seem to be getting Z tested. There is a title bar on the Panel which IS getting Z tested, so I'm a bit lost as to why the other panels aren't.

Execution order is:
  1. user clicks object
  2. Panel prefab instantiated

  1. Data panels added to the Table and fed with data from external source

Result:
Any help?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Using a shader with ZTest Always
« Reply #1 on: March 20, 2013, 11:25:51 AM »
Different atlases/fonts = different draw calls. Different draw calls = Z determines what's drawn first. Check the FAQ.

Dover8

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 20
    • View Profile
Re: Using a shader with ZTest Always
« Reply #2 on: March 20, 2013, 11:41:38 AM »
It's all the same atlas and fonts. I've got around it by creating a new font with a slightly modified shader:

  1. "Queue" = "Transparent+1"