PRISM: A Liquid Glass WebGL Carousel for Next.js

An infinite 3D carousel built with three.js, GSAP, and a custom liquid-glass GLSL shader for Next.js projects.

PRISM is a Next.js project showcase rendered with three.js, animated with GSAP, and finished with a custom liquid-glass GLSL shader.

It presents portfolio items as an infinite, scroll and touch-driven 3D carousel with chromatic refraction, six color themes, and sound generated live through the Web Audio API.

Features

  • Renders project images as Three.js plane meshes inside an infinite horizontal loop.
  • Measures each image aspect ratio and calculates panel width from a shared height.
  • Applies chromatic dispersion, glow, shimmer, rim waves, zoom, and shape masking through a GLSL post-processing pass.
  • Adds inertial wheel and pointer movement with center snapping and velocity-based panel scaling.
  • Switches between six liquid-glass presets through animated shader uniform changes.
  • Opens a focused project state with previous, next, exit, and case study controls.
  • Generates interface sounds through Web Audio oscillators and exposes a mute shortcut.
  • Runs an automatic tour that advances to the next project every 4.5 seconds.

Use Cases

  • Creative studio portfolios present visual case studies as a continuous exhibition.
  • Product launch pages place hardware renders, campaign artwork, and technical details inside a full-screen sequence.
  • Digital agencies connect each project card to a drawer with tags, dates, descriptions, metrics, and an external project link.
  • Event installations and kiosk screens use the auto tour, keyboard controls, and large central focus state for unattended presentations.
  • Experimental landing pages reuse the WebGL engine as a base for custom shaders, image archives, fashion lookbooks, or interactive brand stories.

How To Use It

Install and Run the Project

Install the project and its dependencies.

git clone https://github.com/enabled404/prism-liquid-glass.git
cd prism-liquid-glass
npm install
npm run dev

Open http://localhost:3000.

Create a Production Build

The repository defines standard Next.js build and start scripts.

npm run build
npm run start

Replace the Demo Projects

Place each project image in public/, then edit PROJECTS in lib/carousel/config.js. Keep aspect set to null to let the engine read the image dimensions after the texture loads.

export const PROJECTS = [
  {
    id: "aurora-dashboard",
    src: "/projects/aurora-dashboard.jpg",
    aspect: null,
    brand: "Northstar Labs",
    title: "Aurora Analytics",
    desc: "Real-time product intelligence dashboard",
    category: "Data Visualization",
    year: "2026",
    fullDesc:
      "A product analytics interface with cohort views, event funnels, and live operational metrics.",
    tags: ["Next.js", "Three.js", "GSAP", "Analytics"],
    metrics: "Interactive Case Study",
    link: "https://example.com/aurora",
  },
];

The project drawer and overlay read these fields directly.

FieldPurpose
idSupplies a stable project identifier.
srcPoints to an image inside public/.
aspectSets a fixed image ratio. null triggers texture measurement.
brandRenders the small label above the project title.
titleRenders the main project heading.
descAdds the short subtitle in the carousel overlay.
categorySupplies category text and category-chip matching.
yearAdds the project year to the detail view.
fullDescFills the longer case study description.
tagsCreates technology pills and participates in category matching.
metricsAdds the project highlight or result label.
linkSets the external case study link.

Update the Category Chips

The category labels live in Components/CarouselSection.jsx. Each label searches the project category and tags values. A matched chip moves the carousel to the first matching project. It does not remove unrelated projects from the loop.

const CATEGORIES = [
  "All",
  "Data",
  "WebGL",
  "Brand",
  "Editorial",
  "Hardware",
];

Add a Liquid Glass Theme

Add a preset to LENS_PRESETS in lib/carousel/config.js. The navbar passes the selected object to engine.setTheme().

{
  id: "ice",
  name: "Arctic Ice",
  blueColor: "#7dd3fc",
  dispersion: 13,
  glow: 2.1,
  whiteGlow: 0.14,
  novaSize: 11,
}

Press G in the running site to open the lil-gui shader panel. Use the panel to test lens, focus, entry, and motion values before saving them in config.js.

Main Files

The App Router entry, React overlay, renderer, audio engine, and editable data remain separated across a small set of files.

FileRole
app/page.jsMounts CarouselSection at the root route.
app/layout.jsLoads global CSS, Google fonts, and page metadata.
app/globals.cssImports Tailwind CSS 4 and defines global interface styles.
Components/CarouselSection.jsxOwns React state, keyboard shortcuts, auto tour, overlay text, and engine lifecycle.
Components/Navbar.jsxRenders theme, category, audio, GUI, and auto-tour controls.
Components/ProjectModal.jsxRenders the extended case study drawer.
lib/carousel/config.jsStores projects, theme presets, layout values, lens uniforms, focus motion, and entry motion.
lib/carousel/engine.jsCreates the Three.js renderer, mesh pool, scrolling physics, focus animation, and GLSL lens pass.
lib/carousel/audio.jsGenerates tick, pop, click, and sweep sounds with the Web Audio API.
lib/carousel/gui.jsMaps editable values to the lil-gui development panel.
public/Stores the project images loaded as WebGL textures.

Configuration Reference

Most visual and interaction changes stay inside lib/carousel/config.js.

ExportImportant ValuesWhat It Changes
PROJECTSsrc, title, category, tags, linkProject content and media.
LENS_PRESETSblueColor, dispersion, glow, whiteGlow, novaSizeNavbar theme choices.
CONFIGPANEL_H, GAP, EASE, WHEEL, SNAP, SNAP_DELAYPanel dimensions and scroll behavior.
LENSshape, sizeX, sizeY, dispersion, blur, shimmer, samplesShader shape, refraction, color separation, and rim motion.
FOCUScardDuration, focusDuration, stagger, dropDist, centerScaleSelected-card transitions.
ENTRYenabled, delay, startH, riseDuration, growDuration, growDirInitial panel rise and growth sequence.
UI_ANIMduration, topShiftVh, revealDuration, revealStaggerReact overlay movement and reveal timing.

Controls and Shortcuts

InputAction
Mouse wheel or trackpadMoves through the horizontal project row.
Pointer drag or touch swipeApplies direct movement with inertial settling.
Project clickCenters the card and enters focus mode.
Left and right arrowsMoves to the previous or next project.
EscCloses focus mode or the project drawer.
MToggles synthesized interface audio.
GShows or hides the shader tuning panel.
Auto TourAdvances through the project catalog every 4.5 seconds.

Alternatives and Related Resources

Saad Khalid

Saad Khalid

Leave a Reply

Your email address will not be published. Required fields are marked *