Skip to content

Instantly share code, notes, and snippets.

@patriciogonzalezvivo
Created February 17, 2026 18:21
Show Gist options
  • Select an option

  • Save patriciogonzalezvivo/fa317712f3bff43e5308e6a1922d59cd to your computer and use it in GitHub Desktop.

Select an option

Save patriciogonzalezvivo/fa317712f3bff43e5308e6a1922d59cd to your computer and use it in GitHub Desktop.
Wavelength
{
"frag": "#ifdef GL_ES\nprecision mediump float;\n#endif\n\nuniform vec2 u_resolution;\nuniform vec2 u_mouse;\nuniform float u_time;\n\n#define W2RGB_FNC spectral_zucconi6\n#define W2RGB_ITERATIONS 20.\n\n#include \"lygia/math/map.glsl\"\n#include \"lygia/color/space.glsl\"\n#include \"lygia/color/palette/spectral.glsl\"\n\n#include \"lygia/draw/digits.glsl\"\n\nvoid main(void) {\n vec4 color = vec4(vec3(0.0), 1.0);\n vec2 pixel = 1.0/u_resolution.xy;\n vec2 st = gl_FragCoord.xy * pixel;\n\n float x = st.x;\n float w = mix(400., 700., st.x);\n\n if (st.y > 0.8)\n color.rgb = spectral( x );\n else if (st.y > 0.7)\n color.rgb = spectral( x, map(st.y, 0.8, 0.7, 0.0, 1.0) );\n else if (st.y > 0.6)\n color.rgb = spectral_geoffrey( x );\n else if (st.y > 0.5)\n color.rgb = spectral_zucconi( x );\n else if (st.y > 0.4)\n color.rgb = spectral_zucconi6( x );\n else if (st.y > 0.3)\n color.rgb = spectral_gems( x );\n else if (st.y > 0.2)\n color.rgb = spectral_soft( x );\n else\n color.rgb = w2rgb( w );\n\n vec2 uv = vec2(st.y, 1.0-st.x);\n uv.x = fract( uv.x * 3.) * 0.25 - 0.01;\n color += digits(uv - vec2(0.06, 0.97), 300., 0.);\n color += digits(uv - vec2(0.06, 0.), 700., 0.);\n \n gl_FragColor = color;\n}\n",
"vert": "#ifdef GL_ES\nprecision mediump float;\n#endif\n\nattribute vec4 a_position;\nvarying vec4 v_position;\n\nvoid main() {\n v_position = a_position;\n gl_Position = a_position;\n}\n",
"commands": [
"plot,off",
"textures,off",
"buffers,off",
"cubemap,off",
"camera_position,-0,-0,-2",
"camera_look_at,0,0,0",
"camera,default"
],
"assets": {},
"history": [
{
"gistId": "26dc8382ba4139c78b6011a80255a553",
"owner": {
"login": "patriciogonzalezvivo",
"id": 346914,
"avatar_url": "https://avatars.githubusercontent.com/u/346914?v=4"
},
"loadedAt": "2026-02-17T18:21:02.664Z"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment