# alit > Paint with light. AI-generated PBR maps you relight in real time in your browser. alit takes a text prompt, asks OpenAI's gpt-image-2 to paint a 3×3 grid of PBR texture maps for the scene (albedo, tangent-space normal, depth, roughness, reflectiveness, ambient occlusion, emissive, specular intensity, clearcoat), slices the grid client-side, and feeds the nine textures into a custom GLSL shader. The user moves their cursor to position a virtual light source and "paint" the flat scene into a lit, parallax-shifted, atmospheric render — like running a director-of-photography lighting session against an AI-generated still. ## What it is - A web app at https://alit.dev - Free to use under a BYOK (bring-your-own-OpenAI-key) model - Source-available PBR experimentation playground ## How it works 1. User pastes their OpenAI API key once (stored in browser localStorage, never logged server-side) 2. User types a scene prompt in the gallery panel 3. The Cloudflare Worker forwards the request to gpt-image-2 with a strict 3×3 grid prompt that demands one specific PBR map per cell 4. gpt-image-2 returns a 2048×2048 composite, the worker stores it in R2 5. Browser slices the grid into nine cells, repacks AO/Roughness/Metalness into a single ORM texture, optionally aligns cells via Sobel-edge SSD shift correlation 6. A custom Three.js ShaderMaterial renders a 192×192 vertex-displaced plane through GGX BRDF, parallax occlusion mapping, depth-shadow raymarch, env reflection (faked from albedo), bloom, ACES tone-mapping, film grain, and SMAA — at 60fps in the browser ## Stack - Vite + React 18 + TypeScript - Zustand for state - Three.js + custom GLSL fragment shader (GGX/Smith/Disney remap) - pmndrs/postprocessing (BloomEffect, ToneMappingEffect, NoiseEffect, SMAAEffect) - Cloudflare Workers + Pages + R2 (storage + delivery) - OpenAI gpt-image-2 (textures), Replicate google/upscaler (optional) ## Pricing - Free. Users provide their own OpenAI API key for generation. - Each generation costs ~$0.20 on the user's OpenAI account. ## Features - AI-generated 3×3 PBR map grid from a single prompt - Auto-place virtual point lights at bright emissive blobs - Auto-tune exposure, ambient, bloom threshold, and cursor light intensity from albedo brightness - Cursor-driven cinematic relighting with smooth lerp on movement - Mobile gyroscope controls camera tilt - Public gallery — share scenes via slug, browse community submissions - Drag-and-drop upload of pre-existing 3×3 PBR grids - Per-map debug isolation (toggle each map on/off, fullscreen-preview any map) - Random shader-parameter scramble for visual exploration ## Use cases - Game artists prototyping lighting on AI-generated environments - Photographers / cinematographers exploring chiaroscuro composition - Educators teaching PBR concepts (each map's contribution is toggleable) - Generative-art creators sharing relit scenes ## Links - App: https://alit.dev - Public gallery: https://alit.dev (default tab) - OpenAI key signup: https://platform.openai.com/api-keys