Shader "Custom/Stream" {
Properties {
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_MainTint ("Diffuse Tint", Color) = (1,1,1,1)
_ScrollXSpeed ("X Scroll Speed", Range(0,10)) = 2
_ScrollYSpeed ("Y Scroll Speed", Range(0,10)) = 2
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
// 将类型转换到CG中的可用类型
sampler2D _MainTex;
fixed4 _MainTint;
fixed _ScrollXSpeed;
fixed _ScrollYSpeed;
// 读取模型数据的结构体,名字有些迷惑人
struct Input {
float2 uv_MainTex;
};
// inout类型是一个输出数据的类型,顶点着色器处理好数据之后传递给片段着色器
// 就是通过inout修饰的参数来传递的,也就是说inout修饰的类型是提供给片段着色
【Shader】使用Unity创建水流岩浆等流动效果
最新推荐文章于 2024-05-21 09:53:57 发布