forked from Flare [Loopable]
The iLoop uniform will loop from 0-1 every 4 seconds.
Log in to post a comment.
#version 300 es #define ITR 64. precision highp float; // Forked from "Flare [Loopable]" by reinder // https://oneshader.net/shader/4c1a038477 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 uniform float depth; //value=4, min=1, max=64, step=0.001 uniform int opposite; //value=0, min=0, max=1, step=1, (No, Yes) 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; } vec2 vp2(vec2 v){ return vec2(v.x * v.x - v.y * v.y, 2. * v.x * v.y); } float itr(vec2 c){ vec2 z = vec2(0.); float i = 0.; while(i < ITR){ i += 1.; z = vp2(z) + c; if(length(z) > 128.) return i + 1. - (log(log(length(z))) / log(2.)); } return ITR; } void main() { vec2 uv = vScreen; float i = itr(uv * 2.); float r = opposite == 1 ? .5 - i / depth : i / depth; 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); }