Lightnight arc
When applied to a cylindar, creates a randomly generated electric style arc between the top and bottom. The arc has maximum deviation from center at mid-height, and no devation at the caps. Technically it could be applied to other shapes.
Designed using visual shader, with shader code exported here.
Shader code
shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_disabled, diffuse_lambert, specular_schlick_ggx;
instance uniform float LowestY = -5;
instance uniform float HightestY = 5;
uniform float ArcTime : hint_range(0.10000000149012, 1, 0.10000000149012) = 0.10000000149012;
uniform float ArcsPerCycle : hint_range(1, 100, 1) = 10;
uniform sampler2D tex_vtx_3 : source_color;
uniform sampler2D tex_vtx_58;
uniform vec3 MaxShifts = vec3(5.000000, 5.000000, 5.000000);
void vertex() {
// Input:2
vec3 n_out2p0 = VERTEX;
// VectorDecompose:24
float n_out24p0 = n_out2p0.x;
float n_out24p1 = n_out2p0.y;
float n_out24p2 = n_out2p0.z;
// FloatParameter:23
float n_out23p0 = LowestY;
// FloatParameter:22
float n_out22p0 = HightestY;
float n_out57p0;
// Remap:57
float n_in57p3 = 0.00000;
float n_in57p4 = 1.00000;
{
float __input_range = n_out22p0 - n_out23p0;
float __output_range = n_in57p4 - n_in57p3;
n_out57p0 = n_in57p3 + __output_range * ((n_out24p1 - n_out23p0) / __input_range);
}
float n_out54p0;
// Remap:54
float n_in54p1 = 0.00000;
float n_in54p2 = 1.00000;
float n_in54p3 = -1.00000;
float n_in54p4 = 1.00000;
{
float __input_range = n_in54p2 - n_in54p1;
float __output_range = n_in54p4 - n_in54p3;
n_out54p0 = n_in54p3 + __output_range * ((n_out57p0 - n_in54p1) / __input_range);
}
// FloatFunc:29
float n_out29p0 = abs(n_out54p0);
// FloatFunc:30
float n_out30p0 = 1.0 - n_out29p0;
// VectorCompose:28
float n_in28p1 = 1.00000;
vec3 n_out28p0 = vec3(n_out30p0, n_in28p1, n_out30p0);
// Input:59
vec2 n_out59p0 = UV;
// VectorOp:74
vec2 n_in74p1 = vec2(0.00000, 1.00000);
vec2 n_out74p0 = n_out59p0 * n_in74p1;
// Input:64
float n_out64p0 = TIME;
// FloatParameter:72
float n_out72p0 = ArcTime;
// FloatOp:73
float n_out73p0 = n_out64p0 / n_out72p0;
// FloatParameter:71
float n_out71p0 = ArcsPerCycle;
// FloatOp:65
float n_out65p0 = mod(n_out73p0, n_out71p0);
// FloatFunc:68
float n_out68p0 = ceil(n_out65p0);
float n_out69p0;
// Remap:69
float n_in69p1 = 0.00000;
float n_in69p3 = 0.00000;
float n_in69p4 = 1.00000;
{
float __input_range = n_out71p0 - n_in69p1;
float __output_range = n_in69p4 - n_in69p3;
n_out69p0 = n_in69p3 + __output_range * ((n_out68p0 - n_in69p1) / __input_range);
}
// VectorCompose:70
float n_in70p1 = 0.00000;
vec2 n_out70p0 = vec2(n_out69p0, n_in70p1);
// VectorOp:60
vec2 n_out60p0 = n_out74p0 + n_out70p0;
// Texture2D:3
vec4 n_out3p0 = texture(tex_vtx_3, n_out60p0);
float n_out3p1 = n_out3p0.r;
float n_out3p2 = n_out3p0.g;
float n_out3p3 = n_out3p0.b;
// MultiplyAdd:61
float n_in61p1 = 2.00000;
float n_in61p2 = -1.00000;
float n_out61p0 = fma(n_out3p0.x, n_in61p1, n_in61p2);
// Texture2D:58
vec4 n_out58p0 = texture(tex_vtx_58, n_out60p0);
// MultiplyAdd:63
float n_in63p1 = 2.00000;
float n_in63p2 = -1.00000;
float n_out63p0 = fma(n_out58p0.x, n_in63p1, n_in63p2);
// VectorCompose:62
float n_in62p1 = 0.00000;
vec3 n_out62p0 = vec3(n_out61p0, n_in62p1, n_out63p0);
// Vector3Parameter:55
vec3 n_out55p0 = MaxShifts;
// VectorOp:47
vec3 n_out47p0 = n_out62p0 * n_out55p0;
// VectorOp:17
vec3 n_out17p0 = n_out28p0 * n_out47p0;
// VectorOp:8
vec3 n_out8p0 = n_out2p0 + n_out17p0;
// Output:0
VERTEX = n_out8p0;
}
void fragment() {
// Input:3
vec2 n_out3p0 = UV;
// Step:4
vec2 n_in4p0 = vec2(0.01000, 1.00000);
vec2 n_out4p0 = step(n_in4p0, n_out3p0);
float n_out4p1 = n_out4p0.r;
// FloatFunc:9
float n_out9p0 = 1.0 - n_out4p1;
// ColorConstant:2
vec4 n_out2p0 = vec4(0.000000, 1.000000, 1.000000, 1.000000);
// VectorOp:8
vec4 n_out8p0 = n_out2p0 * vec4(n_out9p0);
// Output:0
ALPHA = n_out9p0;
EMISSION = vec3(n_out8p0.xyz);
}