|
1 | 1 | Shader "Mobile/Diffuse (Mesh Animation)" {
|
2 | 2 | Properties {
|
3 | 3 | _MainTex ("Base (RGB)", 2D) = "white" {}
|
4 |
| - _AnimTex ("Animation (RGB)", 2D) = "white" {} |
| 4 | + |
| 5 | + [Header(Mesh Animation)] |
| 6 | + _AnimTex ("Animation", 2D) = "white" {} |
5 | 7 | _AnimMul ("Animation Bounds Size", Vector) = (1, 1, 1, 0)
|
6 | 8 | _AnimAdd ("Animation Bounds Offset", Vector) = (0, 0, 0, 0)
|
7 | 9 | [PerRendererData] _AnimTime ("Animation Time", Vector) = (0, 1, 1, 0) /* (x: start, y: length, z: speed, w: startTime) */
|
@@ -51,15 +53,10 @@ Shader "Mobile/Diffuse (Mesh Animation)" {
|
51 | 53 |
|
52 | 54 | float progress = (_Time.y - t.w) * t.z;
|
53 | 55 | float progress01 = lerp(saturate(progress), frac(progress), looping);
|
54 |
| - float4 coords = float4( |
55 |
| - 0.5 + v.vertexId, |
56 |
| - 0.5 + t.x + progress01 * t.y, |
57 |
| - 0, |
58 |
| - 0 |
59 |
| - ); |
60 |
| - float4 position = tex2Dlod(_AnimTex, coords * _AnimTex_TexelSize) * _AnimMul + _AnimAdd; |
| 56 | + float2 coords = float2(0.5 + v.vertexId, 0.5 + t.x + progress01 * t.y) * _AnimTex_TexelSize.xy; |
| 57 | + float4 position = tex2Dlod(_AnimTex, float4(coords, 0, 0)) * _AnimMul + _AnimAdd; |
61 | 58 |
|
62 |
| - v.vertex = position; |
| 59 | + v.vertex = float4(position.xyz, 1.0); |
63 | 60 | }
|
64 | 61 |
|
65 | 62 | void surf (Input IN, inout SurfaceOutput o) {
|
|
0 commit comments