科幻風(fēng)格shader

今天分享幾個(gè)科幻風(fēng)格的shader

Paste_Image.png
  Shader "Character/Hologram" {
    Properties {
      _MainTex ("Texture", 2D) = "white" {}
      _BumpMap ("Bumpmap", 2D) = "bump" {}
      _RimColor ("Rim Color", Color) = (0.26,0.7,1.0,0.0)
      _RimPower ("Rim Power", Range(0.1,8.0)) = 3.0
      _ClipPower("Clip Power", Range(0.0,301.0)) = 200.0
      _Brightness ("Brightness",Range(0.0,3.0)) = 1.5   
      _DiffuseAmount("Diffuse Amount", Range(0.0,1.0)) = 0.0   
    }
    SubShader {
      Tags { "RenderType" = "Transparent"  "Queue"="Transparent" "IgnoreProjector"="True"}
      
    // extra pass that renders to depth buffer only
     Pass {
        ZWrite On
        ColorMask 0
       }
          
      CGPROGRAM
      #pragma surface surf Lambert alpha noambient nolightmap nodirlightmap  novertexlights
      struct Input {
          float2 uv_MainTex;
          float2 uv_BumpMap;
          float3 viewDir;
          float3 worldPos;    
          float4 screenPos;      
      };
      sampler2D _MainTex;
      sampler2D _BumpMap;
      float4 _RimColor;
      float _RimPower;
      float _ClipPower;
      float _Brightness;
      float _DiffuseAmount;

      void surf (Input IN, inout SurfaceOutput o) {
          float2 screenUV = IN.screenPos.xy / IN.screenPos.w;
          
          if (_ClipPower <= 300.0f)
             clip (frac(screenUV.y * _ClipPower) - 0.5);
          half4 basecol = tex2D (_MainTex, IN.uv_MainTex);
          half3 graycol = dot(basecol.rgb,float3(0.3,0.59,0.11));
          o.Albedo = basecol;//lerp(graycol,basecol,_DiffuseAmount);
          o.Normal = UnpackNormal (tex2D (_BumpMap, IN.uv_BumpMap));
          half rim = 1.0 - saturate(dot (normalize(IN.viewDir), o.Normal));
          o.Emission = lerp(_RimColor.rgb * pow (rim, _RimPower) * _Brightness,basecol,_DiffuseAmount);
          o.Alpha = o.Emission;
      }
      ENDCG
    } 
    Fallback "Diffuse"
  }

透明的

Paste_Image.png
  Shader "Character/Ghost Shader" {
    Properties {
      _MainTex ("Texture", 2D) = "white" {}
      _BumpMap ("Bumpmap", 2D) = "bump" {}
      _RimColor ("Rim Color", Color) = (0.46,0.0,1.0,0.0)
      _RimPower ("Rim Power", Range(0.2,2.0)) = 0.5
      _Brightness ("Brightness",Range(0.0,3.0)) = 1.0
    }
    SubShader {
      Tags { "RenderType" = "Transparent" "Queue"="Transparent" "IgnoreProjector"="True"}
      
    // extra pass that renders to depth buffer only
     Pass {
        ZWrite On
        ColorMask 0
       }
          
      CGPROGRAM
      #pragma surface surf Lambert alpha noambient nolightmap nodirlightmap  novertexlights
      struct Input {
          float2 uv_MainTex;
          float2 uv_BumpMap;
          float3 viewDir;
      };
      sampler2D _MainTex;
      sampler2D _BumpMap;
      float4 _RimColor;
      float _RimPower;
      float _Brightness;

      void surf (Input IN, inout SurfaceOutput o) {
        half4 basecol = tex2D (_MainTex, IN.uv_MainTex);
            half3 graycol = dot(basecol.rgb,float3(0.3,0.59,0.11));
          o.Albedo = graycol;
          o.Normal = UnpackNormal (tex2D (_BumpMap, IN.uv_BumpMap));
          half rim = 1.0 - saturate(dot (normalize(IN.viewDir), o.Normal));
          o.Emission = _RimColor.rgb * pow (rim, _RimPower) * _Brightness;
          o.Alpha = (o.Emission.r+o.Emission.g+o.Emission.b) / 3.0;
      }
      ENDCG
    } 
    Fallback "Diffuse"
  }

溶解

Paste_Image.png
  Shader "Character/Disintegrate Bumped Diffuse" {
    Properties {
      _MainTex ("Texture (RGB)", 2D) = "white" {}
      _BumpMap ("Texture (RGB)", 2D) = "bump" {}
      _NoiseTex ("Effect Map (RGB)", 2D) = "white" {}
      _DisintegrateAmount ("Effect Amount", Range(0.0, 1.01)) = 0.0
      _DissolveColor("Edge Color", Color) = (1.0,0.5,0.2,0.0)
      _EdgeEmission ("Edge Emission", Color) = (0,0,0,0)
      _DissolveEdge("Edge Range",Range(0.0,0.1)) = 0.01
      _TileFactor ("Tile Factor", Range(0.0,4.0)) = 1.0
    }
    SubShader {
      Tags { "RenderType" = "Opaque" }
      CGPROGRAM
      #pragma target 3.0
      #pragma surface surf Lambert addshadow nolightmap
      struct Input {
          float2 uv_MainTex;
          float2 uv_BumpMap;
      };
      sampler2D _MainTex;
      sampler2D _BumpMap;
      sampler2D _NoiseTex;
      float  _DisintegrateAmount;
      float4 _DissolveColor;
      float  _DissolveEdge;
      float  _TileFactor;
      float4 _EdgeEmission;  
      
      void surf (Input IN, inout SurfaceOutput o) 
      {
          float clipval = tex2D (_NoiseTex, IN.uv_MainTex * _TileFactor).rgb - _DisintegrateAmount; 
          
          clip(clipval);
          

          if (clipval < _DissolveEdge && _DisintegrateAmount > 0)
          {
              o.Emission = _EdgeEmission;
              o.Albedo = _DissolveColor;          
          }
          else
          {
              o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
          }     
          float4 nrm =  tex2D (_BumpMap,IN.uv_BumpMap);    
          o.Normal = UnpackNormal(nrm);       
      }
      ENDCG
    }
    Fallback "Disintegrate"
  }

石化效果

Paste_Image.png
Shader "Character/StatueBmp" {
    Properties {
        _Color ("Main Color", Color) = (1,1,1,1)
        _MainTex("Diffuse (RGB)", 2D) = "white" {}
        _GrungeTex ("Grunge (RGB)", 2D) = "white" {}
        _BumpMap ("Bump (RGB) Illumin (A)", 2D) = "bump" {}
        _BaseTex ("Base (RGB)", 2D) = "white" {}
        _Scale("Scale", Float) = 1
        _Tighten("Tighten",Range(0.1,0.45))=0.3     
        _DiffuseAmount("Diffuse Amount", Range(0,1)) = 0.2
        _GrungeAmount("Grunge Amount", Range(0,2)) = 1
    }
    
    SubShader
    {  
            Tags { "RenderType"="Opaque" }
            LOD 200
 
        CGPROGRAM
        #pragma debug
        #pragma surface surf Lambert nolightmap
        #pragma target 3.0
        
        sampler2D _MainTex; 
        sampler2D _GrungeTex;
        sampler2D _BumpMap;
        sampler2D _BaseTex;
        fixed4 _Color;
        fixed _GrungeAmount;
        fixed _DiffuseAmount;
        half  _Scale;
        half _Tighten;
 
        struct Input
        {
            float2 uv_MainTex;
            float2 uv_BumpMap;
            half3 worldPos;
            fixed3 worldNormal; INTERNAL_DATA       
        };
 
        void surf (Input IN, inout SurfaceOutput o)
        {
            // tighten the blending zone
            float4 nrm =  tex2D (_BumpMap,IN.uv_BumpMap); 
            o.Normal = UnpackNormal(nrm); 
            float3 realNormal = WorldNormalVector(IN,o.Normal);
            
            float3 blend_weights = abs(realNormal)- _Tighten;
            blend_weights = max(blend_weights, 0);
            blend_weights /= (blend_weights.x + blend_weights.y + blend_weights.z).xxx;

            float4 d = tex2D(_MainTex, IN.uv_MainTex);
            float4 grunge = tex2D(_GrungeTex, IN.worldPos.xz/_Scale);
            float4 cy =  lerp(tex2D(_BaseTex, IN.worldPos.xz/_Scale),grunge,_GrungeAmount);
            float4 cz = tex2D(_BaseTex, IN.worldPos.xy/_Scale);
            float4 cx = tex2D(_BaseTex, IN.worldPos.zy/_Scale);
            float4 result = cx.xyzw * blend_weights.xxxx +  
                            cy.xyzw * blend_weights.yyyy +  
                            cz.xyzw * blend_weights.zzzz;

            result = lerp(result,d,_DiffuseAmount); 
            
            o.Albedo = result.rgb * _Color.rgb;
            o.Alpha = result.a * _Color.a;

        }
        ENDCG
    }
 
    Fallback "VertexLit"
}

本文資源下載鏈接

鏈接:http://pan.baidu.com/s/1qY8nKIC 密碼:grhz

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末鲤竹,一起剝皮案震驚了整個(gè)濱河市按脚,隨后出現(xiàn)的幾起案子两踏,更是在濱河造成了極大的恐慌,老刑警劉巖没陡,帶你破解...
    沈念sama閱讀 206,723評(píng)論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異索赏,居然都是意外死亡盼玄,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,485評(píng)論 2 382
  • 文/潘曉璐 我一進(jìn)店門潜腻,熙熙樓的掌柜王于貴愁眉苦臉地迎上來埃儿,“玉大人,你說我怎么就攤上這事融涣◎蚬浚” “怎么了青灼?”我有些...
    開封第一講書人閱讀 152,998評(píng)論 0 344
  • 文/不壞的土叔 我叫張陵,是天一觀的道長妓盲。 經(jīng)常有香客問我杂拨,道長,這世上最難降的妖魔是什么悯衬? 我笑而不...
    開封第一講書人閱讀 55,323評(píng)論 1 279
  • 正文 為了忘掉前任弹沽,我火速辦了婚禮,結(jié)果婚禮上筋粗,老公的妹妹穿的比我還像新娘策橘。我一直安慰自己,他們只是感情好娜亿,可當(dāng)我...
    茶點(diǎn)故事閱讀 64,355評(píng)論 5 374
  • 文/花漫 我一把揭開白布丽已。 她就那樣靜靜地躺著,像睡著了一般买决。 火紅的嫁衣襯著肌膚如雪沛婴。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 49,079評(píng)論 1 285
  • 那天督赤,我揣著相機(jī)與錄音嘁灯,去河邊找鬼。 笑死躲舌,一個(gè)胖子當(dāng)著我的面吹牛丑婿,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播没卸,決...
    沈念sama閱讀 38,389評(píng)論 3 400
  • 文/蒼蘭香墨 我猛地睜開眼羹奉,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了约计?” 一聲冷哼從身側(cè)響起尘奏,我...
    開封第一講書人閱讀 37,019評(píng)論 0 259
  • 序言:老撾萬榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎病蛉,沒想到半個(gè)月后炫加,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 43,519評(píng)論 1 300
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡铺然,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 35,971評(píng)論 2 325
  • 正文 我和宋清朗相戀三年俗孝,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片魄健。...
    茶點(diǎn)故事閱讀 38,100評(píng)論 1 333
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡赋铝,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出沽瘦,到底是詐尸還是另有隱情革骨,我是刑警寧澤农尖,帶...
    沈念sama閱讀 33,738評(píng)論 4 324
  • 正文 年R本政府宣布,位于F島的核電站良哲,受9級(jí)特大地震影響盛卡,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜筑凫,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,293評(píng)論 3 307
  • 文/蒙蒙 一滑沧、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧巍实,春花似錦滓技、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,289評(píng)論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至丸边,卻和暖如春叠必,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背原环。 一陣腳步聲響...
    開封第一講書人閱讀 31,517評(píng)論 1 262
  • 我被黑心中介騙來泰國打工挠唆, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留处窥,地道東北人嘱吗。 一個(gè)月前我還...
    沈念sama閱讀 45,547評(píng)論 2 354
  • 正文 我出身青樓,卻偏偏與公主長得像滔驾,于是被迫代替她去往敵國和親谒麦。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 42,834評(píng)論 2 345

推薦閱讀更多精彩內(nèi)容