Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - tehr0b

Pages: [1]
1
NGUI 3 Support / Problem with Texture Masking within Clipped Panels
« on: October 28, 2014, 06:52:03 PM »
I'm using NGUI 3.7.5, and trying to use the new Texture Masking panel feature to mask something that moves in and out of a clipped panel. The problem that I'm having is that these seem to be mutually exclusive: The texture masked sprites won't be clipped by the panel's clipping region.

Digging through the code, this seems to be because the TextureClip shader doesn't contain alternates for more levels of clipping. Is my best bet on getting this functionality to hack in some shaders like "Transparent Colored (TextureClip) 1" that apply both the texture mask and parent panels' clipping regions, and make UIDrawCall take clipping count into account when looking at texture masked panels?

2
NGUI 3 Support / Problem with Greyscale Shader on UI2DSprites
« on: July 22, 2014, 04:32:42 PM »
I recently needed a greyscale shader, so I took the NGUI Premultiplied Colored shader, and changed the fragment shader to be this

  1. half4 frag (v2f IN) : COLOR  
  2. {  
  3.     half4 col;
  4.     half4 colt;
  5.     col = tex2D(_MainTex, IN.texcoord);
  6.     colt = col * IN.color;
  7.     float grey = dot(col.rgb, float3(0.299, 0.587, 0.114));
  8.     col.rgb = (IN.color.r==0) * float3(grey, grey, grey) + (IN.color.r!=0) * colt.rgb;
  9.     col.a = colt.a;
  10.     return col;
  11. }


Everything works great on UISprites, however it's been causing weird alpha issues with UI2DSprites. I did a quick side-by-side comparison, with the top images being UISprites in an atlas and the bottom sprites being UI2DSprites.

Even though I know it's not efficient for draw-calls' sake, my game uses a good amount of UI2DSprites due to loading a lot of character assets from assetbundles, and the individual bundles are small enough that it doesn't make much sense to atlas them.

Is there something I'm doing wrong with the shader? Or is there something else I'm doing wrong?

Pages: [1]