Skip to content

Instantly share code, notes, and snippets.

@Bradshaw
Last active November 16, 2018 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bradshaw/c4352d526df401a755d1917ec9925c22 to your computer and use it in GitHub Desktop.
Save Bradshaw/c4352d526df401a755d1917ec9925c22 to your computer and use it in GitHub Desktop.
Unity move vertex shader thing
Shader "Custom/Blob" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_PushTex ("Thing", 2D) = "white" {}
_Push ("Push", Range(-1,1)) = 0.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Lambert vertex:vert
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
sampler2D _PushTex;
struct appdata {
float4 vertex : POSITION;
float4 texcoord : TEXCOORD0;
float3 normal : NORMAL;
};
struct Input {
float2 uv_MainTex;
};
fixed4 _Color;
float _Push;
void vert (inout appdata_full v) {
float pushy = tex2Dlod (_PushTex, v.texcoord + float4(0,_Time.y,0,0)).r;
v.vertex.xyz += v.normal * _Push * pushy;
}
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
}
ENDCG
}
FallBack "Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment