LoginSignup
5
2

More than 5 years have passed since last update.

Unity5.xでuGUIのImageを白くする

Posted at

このへん
http://tsubakit1.hateblo.jp/entry/2014/09/17/015251
http://elix-jp.sakura.ne.jp/wordpress/?p=953
を参考にしながら実装してみたメモ。
1. Unity5.x用のbuilt-in shaderをリンク先のDowunloadsからダウンロード
  (http://unity3d.com/jp/get-unity/download/archive)
2. アーカイブ内のSprits-Default.shaderを開く
3. 1行目の
Shader "Sprites/Default"
 を
Shader "Sprites/Custom"
 とかに変更
4. fixed4 frag(v2f IN) : SV_Target の中身を

            fixed4 frag(v2f IN) : SV_Target
            {
                fixed4 c = SampleSpriteTexture (IN.texcoord) * IN.color;
                c.rgb = c.rgb*2+max(fixed3(0,0,0),IN.color.rgb-0.5)*2;
                c.rgb *= c.a;
                return c;
            }

 の様に修正
5. ファイル名をSprits-Custom.shaderなどとして保存し、Projectに持ってくる
6. Unity上でシェーダを右クリックCreate→Material
7. 生成されたMaterialを該当ImageのMaterialにセット
8. ColorのRGB値0〜128〜255で、黒〜原色〜白と変色可能になります

5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2