44 lines
1.2 KiB
Plaintext
44 lines
1.2 KiB
Plaintext
shader_type spatial;
|
|
render_mode unshaded, cull_disabled;
|
|
|
|
// uniforms: detail_strength, scroll_speed, fire_height, fire_shape,
|
|
// fire_thickness, fire_sharpness, intensity
|
|
// noise parameters: noise_octaves, noise_lacunarity, noise_gain,
|
|
// noise_amplitude, noise_frequency
|
|
|
|
//float hash(vec2 p) { /* ... */ }
|
|
//float noise(vec2 x) { /* ... */ }
|
|
//float fbm(vec2 p) { /* ...mix octaves...*/ }
|
|
|
|
void fragment() {
|
|
vec2 uv = UV;
|
|
vec2 muv = -uv;
|
|
muv.x = mod(muv.x, 1.0) - 0.5;
|
|
muv.y += 0.84;
|
|
|
|
float scroll = scroll_speed * detail_strength * TIME;
|
|
float n = fbm(detail_strength * muv - vec2(0.0, scroll));
|
|
|
|
float fire_intensity = intensity - 16.0 * fire_sharpness * pow(
|
|
max(0.0,
|
|
length(
|
|
muv * vec2((1.0/fire_thickness) + muv.y * fire_shape, 1.0/fire_height)
|
|
) - n * max(0.0, muv.y + 0.25)
|
|
), 1.2
|
|
);
|
|
|
|
float fi1 = clamp(n * fire_intensity * (1.5 - pow(uv.y, 14.0)), 0.0, 1.0);
|
|
|
|
vec3 col = vec3(
|
|
1.5 * fi1,
|
|
1.5 * pow(fi1, 3.0),
|
|
pow(fi1, 6.0)
|
|
);
|
|
|
|
float alpha = fire_intensity * (1.0 - pow(uv.y, 3.0));
|
|
vec4 final = vec4(mix(vec3(0.0), col, alpha), alpha);
|
|
|
|
ALBEDO = final.rgb;
|
|
ALPHA = final.a;
|
|
}
|