shader实现积雪效果
Shader "Custom/Snow" {
Properties {
_MainTex("Base",2D)="white"{}
_Bump("Bump",2D)="bump"{}
_Snow("Snow Level",Range(0,1))=0
_SnowColor("Snow Color",Color)=(1.0,1.0,1.0,1.0)
_SnowDirection("Snow Direction",Vector)=(0,1,0)
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Lambert
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
float2 uv_Bump;
float3 worldNormal;//Unity内置数据,如果表面shader为SurfaceOutput结构中的Normal赋值了,它会包含世界空间坐标中法线的向量。
//通过调用WorldNormalVector(IN,o.Normal)得到此值。如果没有为Normal赋值,直接调用IN.worldNormal得到此值
//这个方法把