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 - no1no

Pages: [1]
1
So I guess NGUI will try to change the shader to the version that support clipping regardless of whether I'm using material or not. I don't have enough time to spend on this issue so I have to use other solution and change the design a bit but I will try to fix it later. Thank you for your answer, ArenMook.

2
Quote
Keep your original shader ("Unlit/AlphaMask") and make a copy of it -- "Unlit/AlphaMask 1". Make the same modifications as in the Unlit - Transparent Colored 1, and make sure that your shaders are in the Resources folder where they can be loaded. Note where NGUI's shaders are located -- just place them into the same place.
Sorry I didn't say clearly in the original post. I don't set shader directly to UITexture but use it through a material. The shader require 2 components, the main texture and the alpha mask texture.

3
I compare the two shaders you suggest and I can see the different but when I tried to modify the AlphaMask shader base on that, nothing change. I guess you need to understand shader language to fix this.

I decided to use UIPanel Texture Mask instead and it looks ok but I have one problem: when I tried to scroll the list with the texture using Texture Mask past the clipping border of the scroll view, the texture will only disapear when all of it goes pass the border while other texture (which don't use texture mask) hid the part that goes past the border. Anyway to fix this?

4
I'm using a custom shader to show avatar inside a circle. It was all good until I put it inside a panel with soft clip option and the shader is not working anymore. I search around the forum and it seems the way to fix this is to modify the custom shader to work with NGUI. However, since I don't have knowledge in programming shader (the code looks like Assembly to me) I don't know where to fix at all. Could someone help me with this?

I'm using the shader code from here: http://www.bensilvis.com/unity3d-unlit-alpha-mask-shader/

  1. // Unlit alpha-blended shader.
  2. // - no lighting
  3. // - no lightmap support
  4. // - no per-material color
  5.  
  6. Shader "Unlit/AlphaMask" {
  7. Properties {
  8.     _MainTex ("Base (RGB)", 2D) = "white" {}
  9.     _AlphaTex ("Alpha mask (R)", 2D) = "white" {}
  10. }
  11.  
  12. SubShader {
  13.     Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
  14.     LOD 100
  15.    
  16.     ZWrite Off
  17.     Blend SrcAlpha OneMinusSrcAlpha
  18.    
  19.     Pass {  
  20.         CGPROGRAM
  21.             #pragma vertex vert
  22.             #pragma fragment frag
  23.            
  24.             #include "UnityCG.cginc"
  25.  
  26.             struct appdata_t {
  27.                 float4 vertex : POSITION;
  28.                 float2 texcoord : TEXCOORD0;
  29.             };
  30.  
  31.             struct v2f {
  32.                 float4 vertex : SV_POSITION;
  33.                 half2 texcoord : TEXCOORD0;
  34.             };
  35.  
  36.             sampler2D _MainTex;
  37.             sampler2D _AlphaTex;
  38.            
  39.             float4 _MainTex_ST;
  40.            
  41.             v2f vert (appdata_t v)
  42.             {
  43.                 v2f o;
  44.                 o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
  45.                 o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
  46.                 return o;
  47.             }
  48.            
  49.             fixed4 frag (v2f i) : SV_Target
  50.             {
  51.                 fixed4 col = tex2D(_MainTex, i.texcoord);
  52.                 fixed4 col2 = tex2D(_AlphaTex, i.texcoord);
  53.                
  54.                 return fixed4(col.r, col.g, col.b, col2.r);
  55.             }
  56.         ENDCG
  57.     }
  58. }
  59.  
  60. }

Pages: [1]