generated from raccoon/vrchat-project-template
Added scrolling texture shader
This commit is contained in:
@@ -2,9 +2,15 @@ Shader "Custom/CloudsShader"
|
|||||||
{
|
{
|
||||||
Properties
|
Properties
|
||||||
{
|
{
|
||||||
_MainTex("Texture", 2D) = "white" {}
|
_MainTex("Main Texture", 2D) = "white" {}
|
||||||
_ScrollSpeed("Scroll Speed", Vector) = (0.1, 0.1, 0, 0)
|
_MainTexScrollX("Main Texture Scroll X", Float) = 0.001
|
||||||
_Color("Tint Color", Color) = (1,1,1,1)
|
_MainTexScrollY("Main Texture Scroll Y", Float) = 0.001
|
||||||
|
|
||||||
|
_NoiseTex("Noise Texture", 2D) = "white" {}
|
||||||
|
_NoiseTexScrollX("Noise Texture Scroll X", Float) = 0.001
|
||||||
|
_NoiseTexScrollY("Noise Texture Scroll Y", Float) = 0.001
|
||||||
|
|
||||||
|
_Color("Tint Color", Color) = (0.37, 0.37, 0.37, 1.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
SubShader
|
SubShader
|
||||||
@@ -21,8 +27,13 @@ Shader "Custom/CloudsShader"
|
|||||||
#pragma fragment frag
|
#pragma fragment frag
|
||||||
|
|
||||||
sampler2D _MainTex;
|
sampler2D _MainTex;
|
||||||
float4 _MainTex_ST;
|
half _MainTexScrollX;
|
||||||
float4 _ScrollSpeed;
|
half _MainTexScrollY;
|
||||||
|
|
||||||
|
sampler2D _NoiseTex;
|
||||||
|
half _NoiseTexScrollX;
|
||||||
|
half _NoiseTexScrollY;
|
||||||
|
|
||||||
float4 _Color;
|
float4 _Color;
|
||||||
|
|
||||||
struct appdata
|
struct appdata
|
||||||
@@ -33,7 +44,8 @@ Shader "Custom/CloudsShader"
|
|||||||
|
|
||||||
struct v2f
|
struct v2f
|
||||||
{
|
{
|
||||||
float2 uv : TEXCOORD0;
|
float2 uv1 : TEXCOORD0;
|
||||||
|
float2 uv2 : TEXCOORD1;
|
||||||
float4 vertex : SV_POSITION;
|
float4 vertex : SV_POSITION;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -41,21 +53,21 @@ Shader "Custom/CloudsShader"
|
|||||||
{
|
{
|
||||||
v2f o;
|
v2f o;
|
||||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||||
|
// Textures scrolling
|
||||||
// Scroll UVs over time
|
o.uv1 = v.uv + float2(_MainTexScrollX, _MainTexScrollY) * _Time.y;
|
||||||
float2 scroll = _ScrollSpeed.xy * _Time.y;
|
o.uv2 = v.uv + float2(_NoiseTexScrollX, _NoiseTexScrollY) * _Time.y;
|
||||||
o.uv = v.uv + scroll;
|
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed4 frag(v2f i) : SV_Target
|
fixed4 frag(v2f i) : SV_Target
|
||||||
{
|
{
|
||||||
fixed4 tex = tex2D(_MainTex, i.uv) * _Color;
|
fixed4 tex1 = tex2D(_MainTex, i.uv1);
|
||||||
return tex;
|
fixed4 tex2 = tex2D(_NoiseTex, i.uv2);
|
||||||
|
return tex1 * tex2 * _Color;
|
||||||
}
|
}
|
||||||
ENDCG
|
ENDCG
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FallBack "Unlit/Transparent"
|
FallBack "Unlit/Transparent"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user