Shader(3)_相机屏幕特效

C#脚本:

public Material material;//需要渲染相机的材质球

//unity自带方法,在unity方法调用周期里面可以查看到
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
	Graphics.Blit(source, destination,material);//unity的封装函方法,用material渲染source到destination上
}

Shader:

float4 frag(v2f i) : SV_Target
{
	fixed4 col = tex2D(_MainTex, i.uv);
	
	//注意,颜色相乘就好比光照在上面
	col *= fixed4(i.uv.xy,0.5f,1);//关键计算,纹理与渐变色相乘
	
	return col;
}

你可能感兴趣的:(Shader)