Skip to content

notepad-pp/ARTINDESIGN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

WebGPU Creative Lab

A modern, engine-first web application built with Next.js 15, React Three Fiber, and Three.js WebGPU/TSL. Features a persistent 3D canvas across routes, interactive shader experiments, and a comprehensive content system.

๐Ÿš€ Features

Core Architecture

  • Engine-First Design: Persistent WebGPU canvas across all routes
  • Route-Based Scenes: Automatic scene switching based on URL
  • TSL-First Shading: Three.js Shading Language for all shader logic
  • Zero Config: Components work out-of-the-box with sensible defaults

Content System

  • Contentlayer Integration: MDX-based blog with type-safe content
  • Template System: Reusable article templates with prop validation
  • Dynamic Components: Load templates in MDX with full TypeScript support
  • Scene Props: Pass parameters from frontmatter to 3D scenes

Animation & Motion

  • Motion.dev: Smooth page transitions and layout animations
  • GSAP: Cinematic scroll effects and text reveals
  • Stagger Animations: Coordinated element entrance effects

TSL Library

Organized collection of reusable TSL utilities:

  • Noise: Simplex, Perlin, Curl (3D/4D), FBM, Turbulence
  • Lighting: Ambient, Diffuse, Directional, Fresnel, Hemisphere
  • Math: SDF operations, coordinate transforms, easing functions
  • Post-FX: Grain, Vignette, Bloom, LCD, Canvas Weave
  • Utils: Color palettes, tonemapping, aspect utilities

Admin Dashboard

  • Tweakpane Integration: Auto-generated UI from Zod schemas
  • Live Controls: Real-time scene parameter adjustment
  • Presets: Save/load configuration presets
  • Dev Tools: FPS monitoring, debug visualization

๐Ÿ“ฆ Tech Stack

Framework: Next.js 15 (App Router) + React 19 + TypeScript
3D Engine: React Three Fiber + Three.js r180 (WebGPU)
Animation: Motion.dev + GSAP
Content: Contentlayer (MDX)
State: Zustand
Styling: Tailwind CSS
Admin: Tweakpane + Zod

๐Ÿ—๏ธ Project Structure

src/
โ”œโ”€โ”€ app/                    # Next.js app router
โ”‚   โ”œโ”€โ”€ layout.tsx         # Root layout with persistent canvas
โ”‚   โ”œโ”€โ”€ page.tsx           # Home page
โ”‚   โ”œโ”€โ”€ blog/              # Blog routes
โ”‚   โ”‚   โ”œโ”€โ”€ page.tsx       # Blog listing
โ”‚   โ”‚   โ””โ”€โ”€ [slug]/        # Individual posts
โ”‚   โ”œโ”€โ”€ labs/              # Experiments
โ”‚   โ””โ”€โ”€ admin/             # Admin dashboard
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ canvas/            # WebGPU canvas components
โ”‚   โ”‚   โ”œโ”€โ”€ WebGPUScene.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ WebGPUSketch.tsx
โ”‚   โ”‚   โ””โ”€โ”€ ColorCorrection.tsx
โ”‚   โ”œโ”€โ”€ motion/            # Animation components
โ”‚   โ”‚   โ”œโ”€โ”€ PageTransition.tsx
โ”‚   โ”‚   โ””โ”€โ”€ ScrollEffects.tsx
โ”‚   โ””โ”€โ”€ templates/         # Article templates
โ”‚       โ”œโ”€โ”€ registry.ts
โ”‚       โ”œโ”€โ”€ ShaderHero.tsx
โ”‚       โ”œโ”€โ”€ Floating3D.tsx
โ”‚       โ””โ”€โ”€ TemplateLoader.tsx
โ”œโ”€โ”€ lib/
โ”‚   โ”œโ”€โ”€ tsl/              # TSL utilities library
โ”‚   โ”‚   โ”œโ”€โ”€ noise/
โ”‚   โ”‚   โ”œโ”€โ”€ lighting/
โ”‚   โ”‚   โ”œโ”€โ”€ math/
โ”‚   โ”‚   โ”œโ”€โ”€ postfx/
โ”‚   โ”‚   โ””โ”€โ”€ utils/
โ”‚   โ”œโ”€โ”€ store.ts          # Zustand state
โ”‚   โ”œโ”€โ”€ scenes.ts         # Scene resolver
โ”‚   โ”œโ”€โ”€ utils.ts          # Helper functions
โ”‚   โ””โ”€โ”€ admin/            # Admin utilities
โ”‚       โ”œโ”€โ”€ schemas.ts
โ”‚       โ””โ”€โ”€ pane.ts
โ”œโ”€โ”€ scenes/               # Per-route 3D scenes
โ”‚   โ”œโ”€โ”€ home/
โ”‚   โ””โ”€โ”€ portfolio/
โ””โ”€โ”€ content/              # MDX content
    โ””โ”€โ”€ posts/

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm/pnpm/yarn
  • Browser with WebGPU support (Chrome/Edge 113+)

Installation

# Install dependencies
npm install

# Start development server
npm run dev

# Build for production
npm run build

# Start production server
npm start

Development

Visit http://localhost:3000 to see the site.

  • Home: / - Landing page with features
  • Blog: /blog - Article listing
  • Labs: /labs - Experiments (coming soon)
  • Admin: /admin - Control dashboard

๐Ÿ“ Creating Content

Blog Posts

Create MDX files in content/posts/:

---
title: "My Article"
summary: "Article description"
publishedAt: "2025-01-20"
slug: "my-article"
templateId: "shader-hero"
sceneProps:
  shaderType: "noise"
  intensity: 1.5
tags: ["webgpu", "tsl"]
featured: true
---

Your content here...

Templates

Use templates in MDX:

import { TemplateLoader } from '@/components/templates/TemplateLoader'

<TemplateLoader
  templateId="shader-hero"
  props={{
    title: "Hello WebGPU",
    subtitle: "Subtitle here",
    shaderType: "noise",
    intensity: 1.5
  }}
/>

Creating New Templates

  1. Create component in src/components/templates/
  2. Define Zod schema for props
  3. Register with registerTemplate()
  4. Use in MDX with TemplateLoader

๐ŸŽจ Admin Dashboard

Access at /admin to control:

  • Creative Mode: Colors, effects, motion parameters
  • Dev Mode: Renderer settings, debug tools, performance
  • Presets: Save/load configurations
  • Export: Download config as JSON

๐Ÿงฉ TSL Library Usage

import { simplexNoise3d, cosinePalette } from '@/lib/tsl'
import { Fn, vec3 } from 'three/tsl'

const myShader = Fn(() => {
  const noise = simplexNoise3d(position.mul(scale))
  const color = cosinePalette(noise, colorA, colorB, colorC, colorD)
  return vec3(color)
})

๐ŸŽฏ Scene Integration

Scenes automatically resolve based on route:

// lib/scenes.ts
const sceneMap = {
  '/': HomeScene,
  '/portfolio': PortfolioScene,
  '/blog': HomeScene, // Fallback
}

Create scenes in src/scenes/[name]/Scene.tsx:

export function HomeScene() {
  const params = useStore((state) => state.params)
  
  return (
    <>
      <mesh>
        <boxGeometry />
        <meshStandardMaterial color={params.colorPrimary} />
      </mesh>
    </>
  )
}

๐Ÿ“š Key Patterns

Single-File Modules

Each TSL utility is self-contained with no external config required.

Schema-Driven

Admin controls auto-generate from Zod schemas.

Template Registry

Templates register themselves on import.

Route-Based Scenes

3D content automatically switches with navigation.

๐Ÿ› Known Issues

  • React 19 peer dependency warnings with some packages (safe to ignore)
  • shadcn/ui components need manual installation due to React 19
  • Contentlayer needs rehype/remark plugins installed separately
  • Some TSL files have linter warnings (intentional for generated code)

๐Ÿ”ฎ Roadmap

  • Additional templates (ParticleScroll, CodePlayground, Gallery3D)
  • Lab experiments (GPU particles, fluid simulation, shader playground)
  • OpenAI AgentKit integration (UX Assistant + Builder Agent)
  • Sanity CMS for portfolio content
  • Cloudflare Pages deployment
  • Pagefind search integration
  • Compute shader examples

๐Ÿ“„ License

MIT

๐Ÿ™ Acknowledgments

Built with patterns from:

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors