71 lines
1.9 KiB
Plaintext
71 lines
1.9 KiB
Plaintext
|
|
Shader "zzwater/testshader"
|
|
{
|
|
Properties
|
|
{
|
|
_MainTex ("Albedo (RGB)", 2D) = "white" {}
|
|
}
|
|
|
|
SubShader
|
|
{
|
|
Tags
|
|
{
|
|
"RenderType" = "Opaque"
|
|
"RenderPipeline" = "UniversalPipeline"
|
|
"UniversalMaterialType" = "Lit"
|
|
"IgnoreProjector" = "True"
|
|
}
|
|
LOD 300
|
|
|
|
Pass
|
|
{
|
|
Name "ForwardLit"
|
|
Tags { "LightMode" = "UniversalForward" }
|
|
ZCLIP On
|
|
|
|
HLSLPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS
|
|
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
|
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
|
|
|
sampler2D _MainTex;
|
|
float4 _MainTex_ST;
|
|
|
|
struct Attributes {
|
|
|
|
float4 positionOS : POSITION;
|
|
float2 uv : TEXCOORD0;
|
|
};
|
|
|
|
struct Varyings
|
|
{
|
|
float4 positionHCS : SV_POSITION;
|
|
float2 uv : TEXCOORD0;
|
|
float3 phase: TEXTCOORD1;
|
|
};
|
|
|
|
Varyings vert (Attributes v)
|
|
{
|
|
Varyings o;
|
|
float4x4 mx = GetObjectToWorldMatrix();
|
|
o.positionHCS = TransformObjectToHClip(v.positionOS);
|
|
float factor = dot(float3(mx[0].w, mx[1].w, mx[2].w), 1);
|
|
o.phase = sin(_Time.y * factor);
|
|
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
|
return o;
|
|
}
|
|
|
|
half4 frag (Varyings i) : SV_Target
|
|
{
|
|
half4 albedo = tex2D(_MainTex, i.uv);
|
|
clip(albedo.a - 0.5);
|
|
return float4(i.phase.xxx, 1);
|
|
}
|
|
ENDHLSL
|
|
}
|
|
}
|
|
}
|