Shader1.0-纹理设置

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/coolbeliever/article/details/81939888

Shader1.0的纹理设置极为简单,我就直接上代码了,代码里注释写的很详细

Shader "Hidden/TestTexture"
{
	Properties
	{
		_MainTex ("Texture", 2D) = "white" {}
		_NextTex("NextTexture",2D) = "whitr"{}
		_ConstantColor("Constant Color",Color)=(0,1,0,1)
	}
	SubShader
	{
		Pass
		{
			SetTexture[_NextTex]//设置纹理
			SetTexture[_MainTex]
			{
				//Texture:等于SetTexture当前的纹理变量
				//Primary:表示定点计算出来的颜色
				combine Primary * Texture

				//Previous:表示前面一个SetTexture出来以后的像素
				combine Previous * Texture

				//Constant:表示一个固定的颜色
				constantColor[_ConstantColor]
				combine Constant * Texture//这个Constant就表示前面定义的constantColor

				//combine src1 lerp(src2)src3:让src1和src3进行混合,混合的方式取决于src2的a
				combine Previous lerp(Previous) Texture
			}
		}
	}
}

猜你喜欢

转载自blog.csdn.net/coolbeliever/article/details/81939888