explaingit

vercel-labs/nextjs-nights-shader

17TypeScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

A drop-in Next.js component that renders an animated interactive Milky Way starfield background using WebGPU, 146,000 twinkling stars, cursor-reactive brightness ripples, bloom glow, and an optional SVG logo reveal that brightens stars into your logo shape.

Mindmap

mindmap
  root((Nights Shader))
    What It Does
      Galaxy background
      Interactive starfield
      Logo shape reveal
    Visual Effects
      Star twinkling
      Cursor brightness ripple
      Bloom filter
    Tech Stack
      WebGPU renderer
      Three.js node shaders
      Next.js component
    Requirements
      Chrome 113 plus
      Safari 18 plus
      No older browser fallback
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add a visually striking animated galaxy background to a Next.js conference or product landing page.

USE CASE 2

Create a branded starfield that reveals your company logo as a bright cluster of stars using an SVG mask texture.

USE CASE 3

Build an interactive page background where the starfield reacts to cursor movement with a spreading brightness ripple.

Tech stack

TypeScriptNext.jsWebGPUThree.js

Getting it running

Difficulty · easy Time to first run · 30min

Only works in Chrome 113+, Edge 113+, or Safari 18+, no fallback renderer for Firefox or older browsers.

In plain English

This is a visual effects component for Next.js websites, originally made as the background for a Next.js conference landing page and released as a standalone piece you can drop into any Next.js project. It renders an animated, interactive Milky Way galaxy scene in the background of a web page. The effect renders roughly 146,000 stars in a simulated sky, with two concentrated bands forming a Milky Way streak and a sparse field filling the rest. Each star twinkles at its own rhythm. When you move your cursor across the page, a ripple of brightness spreads through the nearby stars, reacting fluidly to movement. A bloom filter makes bright regions glow softly into their surroundings, and a dithering step gives the starfield a deliberately granular look. The component can also mask in a logo: you provide an SVG, the component converts it to a texture, and the galaxy brightens in the shape of the logo with an outline highlight. The logo position is read from a placeholder element in your page layout, so moving the placeholder moves the reveal in the shader automatically. The underlying technology is WebGPU, a newer browser graphics API that gives web pages direct access to the GPU. Rendering is handled through Three.js using its node-based shader language, which avoids the need to write raw shader code. Because WebGPU is required, the component only works in Chrome or Edge version 113 and later, or Safari 18 and later. There is no fallback for older browsers. A debug panel is available by adding ?debug to the URL, exposing live controls for every visual parameter including bloom intensity, dithering, star density, hover fluid behavior, and camera settings.

Copy-paste prompts

Prompt 1
I'm adding nextjs-nights-shader to my Next.js app. How do I install it and render the starfield component as a full-page background behind my content?
Prompt 2
Using nextjs-nights-shader, how do I configure the logo reveal feature with my own SVG file and position it using a placeholder element in the layout?
Prompt 3
How do I open the debug panel in nextjs-nights-shader by appending ?debug to the URL, and what parameters can I tune, bloom, star density, hover fluid behavior?
Prompt 4
What browsers support nextjs-nights-shader's WebGPU renderer? Is there a canvas or WebGL fallback for Firefox or older browsers?
Open on GitHub → Explain another repo

← vercel-labs on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.