Loopable variant of Flare by using the iLoop uniform vs iTime.
The iLoop uniform will loop from 0-1 every 4 seconds.
Log in to post a comment.
#version 300 es precision highp float; // Forked from "Flare" by reinder // https://oneshader.net/shader/77061bc5ed uniform float iLoop; uniform vec2 iResolution; uniform float angleDensity; // value=3, min=1, max=20, step=0.01 uniform float distanceDensity; // value=1, min=0, max=20, step=0.01 uniform float spotBrightness; // value=.3, min=0, max=2, step=0.01 uniform float brightness; // value=.3, min=0, max=2, step=0.01 uniform float contrast; // value=1, min=0, max=2, step=0.01 uniform vec3 color; // value=1,.1,.2 in vec2 vScreen; out vec4 fragColor; // Hash without Sine // MIT License... // Copyright (c)2014 David Hoskins. // https://www.shadertoy.com/view/4djSRW float hash13(vec3 p3) { p3 = fract(p3 * .1031); p3 += dot(p3, p3.yzx + 33.33); return fract((p3.x + p3.y) * p3.z); } float noise(vec3 x) { vec3 p = floor(x); vec3 f = smoothstep(0., 1., fract(x)); return mix( mix( mix( hash13(p + vec3(0,0,0)), hash13(p + vec3(1,0,0)), f.x), mix( hash13(p + vec3(0,1,0)), hash13(p + vec3(1,1,0)), f.x), f.y), mix( mix( hash13(p + vec3(0,0,1)), hash13(p + vec3(1,0,1)), f.x), mix( hash13(p + vec3(0,1,1)), hash13(p + vec3(1,1,1)), f.x), f.y), f.z); } const mat3 m3 = mat3(-0.7373, 0.4562, 0.4980, 0, -0.7373, 0.6754, 0.6754, 0.4980, 0.5437) * 2.; float fbm(vec3 p) { float a = 1.; float n = 0.; for (int i= 0; i < 5; i++) { n += abs(noise(p)*2. - 1.) * a; a *= 0.5; p *= m3; } return n; } void main() { vec2 uv = vScreen; float r = length(uv); float f0 = fbm(vec3(normalize(uv) * angleDensity, r * distanceDensity - iLoop)); float f1 = fbm(vec3(normalize(uv) * angleDensity, r * distanceDensity - iLoop + 1.)); float f = mix(f0, f1, smoothstep(0., 1., iLoop)); f = f * f / (r * r); f += spotBrightness / (r * r); f *= brightness; vec3 col = 1. - exp(-color * pow(f, contrast)); col = clamp(col, vec3(0), vec3(1)); fragColor = vec4(col,1.0); }