模型透明度调整Shader

Shader "Custom/AlphaTransparency" {
	Properties{
		_MainTex("Base (RGB)", 2D) = "white" {}
	_TransVal("Transparency Value",Range(0.01,1)) = 0.5
	}
		SubShader{
		Tags{ "RenderType" = "Opaque" }
		LOD 200


		//alpha参数;
		CGPROGRAM
#pragma surface surf Lambert alpha


		sampler2D _MainTex;
	float _TransVal;
	struct Input {
		float2 uv_MainTex;
	};


	void surf(Input IN, inout SurfaceOutput o) {
		half4 c = tex2D(_MainTex, IN.uv_MainTex);


		o.Albedo = c.rgb;
		o.Alpha = c.r*_TransVal;//c.g || c.b
	}
	ENDCG
	}
		FallBack "Diffuse"
}

猜你喜欢

转载自blog.csdn.net/qq_37310110/article/details/80576777