lygia Shader Library — Reusable GLSL Functions
lygia (patriciogonzalezvivo/lygia) is a GLSL function library — noise, color, lighting, math, all reusable across projects.
lygia (by Patricio Gonzalez Vivo, author of "The Book of Shaders") is a library of GLSL functions that you can include in your own shaders. Categories: noise (Perlin, simplex, value noise), color (HSL/HSV conversion, color blending), lighting (PBR helpers, shadow functions), math (smoothstep variants, matrix operations). Drop-in include via vite-plugin-glsl: `#include "lygia/generative/snoise.glsl"`. Saves rewriting common functions on every project. Free, MIT licensed, actively maintained. Essential tooling for shader-heavy 3D web work — I include lygia on every project that involves custom shaders.
How I work with it
On a typical project, lygia shader library ships as a self-contained module: one entry-point JS file, one CSS file, asset bundle below 1.5MB total. I keep the integration sandboxed so the rest of the site stays SEO-friendly classical HTML. Frame budget targets 60 FPS on a mid-range Android, with a measurable fallback below.
Performance budget
Lighthouse mobile target: 85+ across all categories. Before launch I run a mobile Lighthouse test and send you the result. Asset compression: glTF + Draco for meshes, KTX2 for textures, Brotli for shaders. Lazy-load any lygia shader library scene that isn't above the fold, with a first-paint target under 1.5s.
When this is overkill
If the goal is a simple e-commerce listing or content blog, a full lygia shader library setup is overkill — a CSS-driven hero plus static images does the job with far less work. lygia shader library earns its keep when the brand needs a memorable visual moment or when 3D actually clarifies the product (configurators, tours, demos).
What you get hands-off
After delivery: the complete source handed over, commented code, and the asset pipeline documented. Hosting, SSL, nightly backups and maintenance can be part of the written offer if you need them.
Frequently asked questions
Why pick this technology over alternatives?
What if a newer tool comes out next year?
How long does this take?
What does it cost?
What if my visitors are on weak phones?
Ready to ship a 3D experience?
Tell me what you need — clear written scope, no surprises.