RenderSettings 渲染设置

在Edit->RenderSettings里设置

wps1

Fog: 激活或不激活

Fog Color:雾的颜色,仅RGB起作用。

Fog Mode:显示方式

Linear线性

Exp指数

Exp2 指数2

Fog Density:雾化的强度

Linear Fog Start:开始距离

Linear Fog End:结束距离

Ambient Light:全局光照

Skybox Material:

Halo Strength:

Flate Strength:

Flare Fade Speed:

Halo Texture:

Spot Cookie:

(2)部分雾化(Shader里面调)

在需要雾化的Shader里加入代码

Fog{Mode Linear Color (0.87,0.87,0.87,1) Density 0.1  Range 0,300} 测试代码:

Shader "Custom/Fog" {  

Properties { 

      _MainTex ("Texture", 2D) = "white" {} 

      _FogColor ("Fog Color", Color) = (0.3, 0.4, 0.7, 1.0)     } 

    SubShader { 

      Tags { "RenderType" = "Opaque" }       CGPROGRAM 

      #pragma surface surf Lambert finalcolor:mycolor vertex:myvert       struct Input {           float2 uv_MainTex;

half fog;       }; 

      void myvert (inout appdata_full v, out Input data)       { 

          float4 hpos = mul (UNITY_MATRIX_MVP, v.vertex);           data.fog = min (1, dot (hpos.xy, hpos.xy) * 0.1);       } 

      fixed4 _FogColor; 

      void mycolor (Input IN, SurfaceOutput o, inout fixed4 color)       { 

          fixed3 fogColor = _FogColor.rgb;           #ifdef UNITY_PASS_FORWARDADD           fogColor = 0;           #endif 

          color.rgb = lerp (color.rgb, fogColor, IN.fog);       } 

      sampler2D _MainTex; 

      void surf (Input IN, inout SurfaceOutput o) { 

           o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;       } 

     ENDCG     }  

    Fallback "Diffuse"   } 

代码看不懂先保存着以后慢慢看

猜你喜欢

转载自www.cnblogs.com/kubll/p/10801217.html