“Twinkling”: Background #4 from Numbers 0 to Absolute Infinity! [Full HD 60fps]
Vložit
- čas přidán 12. 09. 2024
- The fourth and final background to appear in my version of Numbers 0 to Absolute Infinity ( • Numbers 0 to Absolute ... ), created using Shadertoy by @InigoQuilez.
Note: the code will move forward at different speeds depending on your computer's framerate, so it was important for me to capture this at 60fps but I failed to do so since I couldn't change my computer's framerate from 165fps and screen recording at 165fps and re-encoding to 60fps resulted in the video jumping back for 1 frame every few frames giving the illusion of a lower framerate
Shadertoy link: www.shadertoy....
Shadertoy.com code:
Set iChannel0 to Buffer A on both the image and Buffer A.
IMAGE:
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
// Retrieve image from buffer
fragColor = texture(iChannel0, fragCoord/iResolution.xy);
}
BUFFER A:
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
// Generate pseudorandom number
uint rand =
(uint(fragCoord.x)*uint(iResolution.x)
+ uint(fragCoord.y))*uint(iResolution.y)
+ uint(iFrame);
rand *= 372041901u;
rand ^= 3902734059u;
rand *= 592012393u;
rand ^= 1234385959u;
rand *= 2348503421u;
// Calculate pixel brightness
float b = rand % 2500000u == 0u ? 1. : max(max(max(max(
texture(iChannel0, fragCoord / iResolution.xy).r,
texture(iChannel0, (fragCoord + vec2( 0., 1.)) / iResolution.xy).r),
texture(iChannel0, (fragCoord + vec2( 1., 0.)) / iResolution.xy).r),
texture(iChannel0, (fragCoord + vec2( 0., -1.)) / iResolution.xy).r),
texture(iChannel0, (fragCoord + vec2(-1., 0.)) / iResolution.xy).r
) - 0.02;
// Output to screen
fragColor = vec4(vec3(b),1.0);
}