ShaderToMP4

HomeAccueil / ExamplesExemples

Trails (GLSL 3.30, Buffer A)Traînées (GLSL 3.30, Buffer A)

Native GLSL with two passes: glsl330_traces.bufferA.frag keeps and fades the previous image, this file shows it.GLSL natif en deux passes : glsl330_traces.bufferA.frag garde et atténue l'image précédente, ce fichier l'affiche.

Trails (GLSL 3.30, Buffer A) / Traînées (GLSL 3.30, Buffer A)

CategoryCatégorie: Other languagesAutres langages - glsl330_traces.frag - 16 lineslignes - File on GitHubFichier sur GitHub

In the program: Examples, choose it, Add to the list. Or copy the code into a file next to the program and drop it on the window.Dans le programme : Exemples, choisissez-le, Ajouter à la liste. Ou copiez le code dans un fichier et glissez-le sur la fenêtre.

This example uses several passes: the files below go together.Cet exemple utilise plusieurs passes : les fichiers ci-dessous vont ensemble.

CodeCode

glsl330_traces.frag

// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (C) 2026 Patrick JAILLET

// en: Trails (GLSL 3.30, Buffer A) — Native GLSL with two passes: glsl330_traces.bufferA.frag keeps and fades the previous image, this file shows it.
// fr: Traînées (GLSL 3.30, Buffer A) — GLSL natif en deux passes : glsl330_traces.bufferA.frag garde et atténue l'image précédente, ce fichier l'affiche.
#version 330 core
// iChannel0=bufferA
uniform vec3 iResolution;
uniform sampler2D iChannel0;
out vec4 fragColor;

void main() {
    vec2 uv = gl_FragCoord.xy / iResolution.xy;
    fragColor = vec4(texture(iChannel0, uv).rgb * 1.15, 1.0);
}

glsl330_traces.bufferA.frag

// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (C) 2026 Patrick JAILLET

#version 330 core
// iChannel0=bufferA
uniform vec3 iResolution;
uniform float iTime;
uniform sampler2D iChannel0;
out vec4 fragColor;

void main() {
    vec2 uv = gl_FragCoord.xy / iResolution.xy;
    vec2 c = 0.5 + 0.35 * vec2(cos(iTime * 1.7), sin(iTime * 1.1));
    float d = length((uv - c) * vec2(iResolution.x / iResolution.y, 1.0));
    vec3 dotColor = (1.0 - smoothstep(0.02, 0.04, d)) * (0.5 + 0.5 * cos(iTime + vec3(0.0, 2.0, 4.0)));
    vec3 prev = texture(iChannel0, uv).rgb * 0.96;
    fragColor = vec4(max(prev, dotColor), 1.0);
}