NGUI中scrollview中的texture没有被clipped

问:
When scrolling texture ends up behind panel
I'm having a bit of a problem with shaders and textures getting hidden behind panels.  I have textures loaded dynamically and placed into table cells.  When I use a "Unlit - transparent cutout" shader all I have to do is set the Z position for the texture to -1 and it will always appear in front of the panel.  However, that shader doesn't allow textures to be clipped properly when they are scrolled off the panel.  Either all of the texture is displayed or all of it becomes clipped.  So I need to use something like "Unlit - transparent coloured (soft clip)".  This clips the texture beautifully when scrolled, but when Z= -1 it ends up behind the panel as I scroll.  The further I scroll, the more I need to change Z in order for the texture to still appear.  So after I have scrolled I need the Z to be -18 so I can still see the texture.  I can't have Z values that are too extreme because my main panel rotates around the Y-axis (via iPhone swipe).  Anything that juts out too far looks bad when the main panel spins, so this is not a good solution.  I noticed if I have "depth pass" set to TRUE then I only need the Z value of the texture to be -1 and it always appears in front of the panel and clips nicely, but the bit that is clipped becomes grey, not transparent.  I'm sure I'm doing something wrong here.  I've attached screen grabs of the different scenarios to explain it better


回答:
This is because you're using a 3D camera. Clipped views don't mix with 3D UIs very well, especially if you use different atlases.

There is an easy solution though. Modify the Unlit - Transparent Colored (SoftClip) shader to use a +1 render queue, like so:

Before:
Code:  [Select]
"Queue" = "Transparent"

After:
Code:  [Select]
"Queue" = "Transparent+1"

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值