Hello everyone,
I just try to make a hexagonal shield like in this video:
I can randomly move the hexagons of the shield but I want to do it from top to bottom like in the video. I tried it a lot but i couldn’t do it.
Hello everyone,
I just try to make a hexagonal shield like in this video:
I can randomly move the hexagons of the shield but I want to do it from top to bottom like in the video. I tried it a lot but i couldn’t do it.
I whipped up a shader in Shadertoy to showcase how I would go about it. Feel free to play around with the values to see how it behaves. If you have a hard time understanding the different steps, you can disable some by commenting them out with //, but I don’t know if that’s necessary for you.
In the end
I’ll put down a version of how I would write it in a Unity shader. I haven’t tested it, but the general principles should still apply.
// Parameters for the "ripple"
float _Frequency;
float _ScrollingSpeed;
float _Thickness;
float _MaxDisplacement;
v2f vert (appdata v)
{
v2f o;
float ripple = v.vertex.y; // Might want to use world position here
ripple = frac( (ripple + _Time.y * _ScrollingSpeed) * _Frequency / abs(_ScrollingSpeed) );
ripple = abs(ripple * 2 - 1);
ripple = smoothstep(1.0 - _Thickness * _Frequency / abs(_ScrollingSpeed), 1.0, ripple);
float3 rippleDisplacement = v.normal * ripple * _MaxDisplacement;
float4 newVert = v.vertex + float4(rippleDisplacement, 0);
o.vertex = UnityObjectToClipPos(newVert);
o.uv = v.uv;
o.color = v.col;
return o;
}