Complete Projects

Load glTF models (cgltf/tinygltf or Three.js GLTFLoader), PBR shading with IBL, orbit camera, shadow mapping, HDR + tone mapping, MSAA or FXAA, a UI (Dear ImGui) to tweak exposure, light direction, roughness overrides, and debug views (normals, UVs, metalli…

38.1 Shadertoy: animated plasma

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
    float t = iTime * 0.5;
    float v = sin(uv.x * 10.0 + t)
            + sin((uv.y * 10.0 + t) * 0.5)
            + sin((uv.x * 10.0 + uv.y * 10.0 + t) * 0.5)
            + sin(length(uv * 10.0 + vec2(sin(t * 0.3), cos(t * 0.5)) * 3.0) + t);
    vec3 col = 0.5 + 0.5 * cos(3.14159 * v + vec3(0.0, 2.0, 4.0));
    fragColor = vec4(col, 1.0);
}

38.2 Shadertoy: starfield tunnel

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
    float a = atan(uv.y, uv.x) / 6.2831853 + 0.5;    // angle → [0, 1]
    float r = length(uv);
    vec2 tunnelUV = vec2(a * 8.0, 0.3 / r + iTime);  // polar mapping → infinite tunnel
    vec2 cell = floor(tunnelUV * vec2(4.0, 8.0));
    float rnd = fract(sin(dot(cell, vec2(12.9898, 78.233))) * 43758.5453);
    vec2 f = fract(tunnelUV * vec2(4.0, 8.0)) - 0.5;
    float star = smoothstep(0.08, 0.0, length(f)) * step(0.85, rnd);
    vec3 col = vec3(star) + vec3(0.1, 0.05, 0.2) * (1.0 - r);
    col *= smoothstep(0.0, 0.3, r);                  // darken the center
    fragColor = vec4(col, 1.0);
}

38.3 3-D model viewer (OpenGL or WebGL)

Load glTF models (cgltf/tinygltf or Three.js GLTFLoader), PBR shading with IBL, orbit camera, shadow mapping, HDR + tone mapping, MSAA or FXAA, a UI (Dear ImGui) to tweak exposure, light direction, roughness overrides, and debug views (normals, UVs, metallic, roughness, AO).

38.4 Post-processing pipeline

Framebuffer chain: scene (RGBA16F) → bright pass → mip-chain bloom → tone mapping → color grading LUT → FXAA → vignette/film grain → sRGB output. Make each pass a reusable class; hot-reload shaders.

38.5 Procedural planet

Icosphere mesh; vertex displacement with 3-D fBm noise (or compute-generated height maps); biomes by height/latitude (ocean, beach, grass, rock, snow); atmosphere with Rayleigh scattering in a separate shell; animated clouds with noise; tessellation for close-up detail.

38.6 Water scene

Gerstner-wave ocean with tessellation, reflection (planar or SSR), refraction with depth-based absorption, Fresnel, foam, sun specular, skybox, underwater fog.