🎨 💄 Created art template for farm plants and reworked existing plant prefabs and inventory resources
This commit is contained in:
@@ -35,9 +35,21 @@ float getWind(vec2 vertex, vec2 uv, float time){
|
||||
return wind;
|
||||
}
|
||||
|
||||
float hash(vec2 p) {
|
||||
return fract(sin(dot(p, vec2(12.9898,78.233))) * 43758.5453123);
|
||||
}
|
||||
|
||||
float noise(vec2 x) {
|
||||
vec2 p = floor(x);
|
||||
vec2 f = fract(x);
|
||||
f = f * f * (3.0 - 2.0 * f);
|
||||
vec2 a = vec2(1.0, 0.0);
|
||||
return mix(mix(hash(p + a.yy), hash(p + a.xy), f.x), mix(hash(p + a.yx), hash(p + a.xx), f.x), f.y);
|
||||
}
|
||||
|
||||
void vertex() {
|
||||
vec4 pos = MODEL_MATRIX * vec4(0.0, 0.0, 0.0, 1.0);
|
||||
float time = TIME * speed + sin(float(INSTANCE_ID) * offset);
|
||||
//float time = TIME * speed + pos.x * pos.y ; not working when moving...
|
||||
//float time = TIME * speed + sin(VERTEX.x * noise(VERTEX.xy) * offset);
|
||||
float time = TIME * speed + sin(pos.x * offset) * cos( pos.x * offset) ;
|
||||
VERTEX.x += getWind(VERTEX.xy, UV, time);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user