Elaris Studio is a client-side procedural artwork editor built with React, TypeScript, WebGL 2 and Canvas 2D. It has six seeded generators (Midnight, Lunar, Eclipse, Solar, Horizon and Light Leak), curated presets, a parameter inspector, editable layers and typography, local design storage, and PNG, JPEG, WebP and editable JSON export.
npm install
npm run devWebGL 2 is required for artwork previews and exports. Designs and imported image assets stay in the browser's IndexedDB; the app does not call a server or an image-generation service.
src/core/shaders/artwork.tscontains the shared WebGL 2 shader for the generator families;src/core/shaders/eclipse.tscontains Eclipse's shape, tonal and grain passes.src/core/renderer/renderer.tsowns shader compilation, uniform updates, thumbnail rendering and GPU cleanup.src/core/generators/defines the parameter schemas, generator descriptions and curated presets used by the inspector.src/core/random/contains the seeded PRNG and composition-led variation generation.src/core/export/composites layers with Canvas 2D and renders large artwork in consistent-coordinate tiles.src/store/editorStore.tscontains editor state, undo history and deterministic parameter randomisation.src/features/persistence/validates versioned designs and stores them in IndexedDB.src/app/is the thin shell (App.tsx) plus thehooks/for autosave and keyboard shortcuts.src/features/holds the UI by area:topbar/,library/(generators, presets, layers, saved designs),canvas/(viewport, floating toolbar, view state),inspector/(generator, layer, paper and Print Finish controls) anddialogs/.src/ui/is the small design system: Radix UI primitives (dialog, popover, select, slider, switch, tabs, menus, tooltips) andreact-colorful, wrapped as fields (SliderField,ColorField,SelectField,Section…).src/styles/is split intotokens.css(every colour, size and radius),base.css,ui.cssandlayout.css. Restyle the app by editing tokens.
Nothing is reachable only through a preset. Presets, Paper stocks and Print finishes only fill in controls; every value they set is editable (a paper layer stores its overrides on the layer, Print Finish stores them in stockParams). Your own presets are saved locally from the Presets “+” button.
node scripts/verify-tiling.mjs renders 4K both in one pass and through the tiled exporter and diffs them pixel by pixel. node scripts/render-analogue.mjs <generator> [--wide] exports review sheets, detail crops and a 3840 × 2160 render.
To add a generator, add its defaults, parameter definitions and presets to src/core/generators/index.ts, then implement its branch in the shared GLSL shader. Reuse existing parameter kinds so the inspector can render the controls automatically.
Midnight, Lunar and Solar were redesigned. The originals are kept as hidden midnight-v1, lunar-v1 and solar-v1 generators (src/core/generators/legacy.ts, src/core/shaders/legacy.ts), with their original parameters and shader path. Designs saved without a generatorVersion migrate onto them when loaded, so their artwork does not change. New documents are stamped generatorVersion: 2.
Paper (src/core/shaders/paper.ts) is a blank procedural stock: pigment drift, seeded cellulose fibres, a multi-scale height field lit with restrained diffuse light, clustered pulp density, sparse inclusions, optional folds and ageing. Material space is 1/1500 of the canvas height, so preview, export and any aspect ratio show the same sheet. Any Paper stock can also sit beneath another generator via Layers → Paper background (a texture layer with a paper-* source); ink artwork multiplies into it, light-on-dark artwork uses Screen.
Rendering limitations: fibres are limited to a 3×3 neighbour search, so fibres longer than about one cell are clipped; very large exports are slow on software GL (4K takes tens of seconds under SwiftShader); the strong tooth/relief settings drift towards a rough-cast look; Lunar still uses its own paper, which has not been migrated.
Press T (or the timeline button on the canvas toolbar) to open the timeline. It is where motion is authored; the Motion panel keeps the ambient, looping movement (Drift, Flow, grain) that runs underneath.
- Keyframes. Click ◆ beside a value to pin it at the playhead, or double-click a track. Drag a keyframe to retime it (it snaps to frames; hold Alt to move freely). Layers can keyframe position, scale, rotation and opacity; the artwork can also keyframe any slider parameter of its generator (+ Parameter), so the shader's own light, glow or distortion can move on a timeline.
- Auto-keying. Once a value has keyframes, editing it (in the inspector, or dragging the layer on the canvas) keyframes it at the playhead instead of changing its resting value. Fields show the value at the playhead.
- Easing (
src/core/animation/easing.ts). Each keyframe's easing shapes the move into the next keyframe. There are about 40 curves (Linear, Ease, Ease in / out / in out, Slow in slow out, Fast out slow in, then Sine, Quad, Cubic, Quart, Quint, Expo, Circ, Back, Elastic and Bounce in each direction, Anticipate, Smoother step and Hold) plus a draggable custom cubic Bézier. Curves are stored as plain strings (cubic-out,bezier(0.2,0,0.4,1.2)), so they save as JSON. - Animate in / out. The two menus in the timeline header write ordinary keyframes (Fade, Slide ×4, Scale, Pop, Spin, Drop), with a length and delay, onto the selected layers. They can be retimed, re-eased or deleted afterwards; an "in" and an "out" can share a track.
- Loop or play once. The repeat button (or Loop in Motion) chooses between a timeline whose last frame flows into its first, and one that plays once and holds its final state. A GIF made from a play-once timeline does not repeat.
- Export. GIF, MP4 and WebM render each frame at its own time through the same pipeline as stills. A still export shows the frame at the playhead (the first frame when the timeline is closed). Keyframes are saved with the design.
Studio is a static site: npm run build writes everything to dist/, with no server, database or environment variables. Designs, presets and autosave live in the visitor's browser (IndexedDB and local storage); share links carry the design in the URL fragment, so nothing is ever uploaded.
Vercel (studio.elarisbrowser.com). vercel.json sets the framework, the output directory, long-lived caching for hashed assets and fonts, and the security headers.
- In Vercel, Add New → Project, import this repository and keep the detected Vite preset (build
npm run build, outputdist). - Under Settings → Domains, add
studio.elarisbrowser.com. - In the DNS for
elarisbrowser.com, add aCNAMErecord namedstudiopointing tocname.vercel-dns.com. Vercel issues the certificate once it resolves. - Pushes to
maindeploy to production; every pull request gets its own preview URL.
The app loads its fonts from /fonts/…, so it must be served from a domain root, as above. A subpath would need base set in vite.config.ts.
Content-Security-Policy. The policy in vercel.json allows only the app's own files, plus data: / blob: images and media (imported images and exports). Anything that loads a third-party script, font or image, such as analytics, has to be added to it deliberately.
CI. .github/workflows/ci.yml type-checks, builds and runs the unit tests on every push and pull request. The Playwright suite (npm run test:e2e) is run locally: it needs a GPU-backed or software WebGL browser, and its screenshot baseline is per-platform.
Browser support. WebGL 2 is required (any current Chrome, Edge, Safari or Firefox). MP4 and WebM export appear only where the browser can encode them with WebCodecs; PNG, JPEG, WebP and GIF work everywhere.
Any generator except Paper can loop. Open Motion in the inspector (or press play on the canvas toolbar) to preview it; settings live on the design (animation, versioned) and are saved with it.
- What moves. A slow whole-picture movement (Drift, Breathe, Sway or Still) plus a small drift of lights and shapes (
DRIFTINGinsrc/core/animation/motion.ts), and, if you switch on Animate noise, fresh film grain every frame (off by default, so the noise stays still). Amount 100% is still quiet. - The shaders themselves evolve. Inside every analogue-family generator (and Lunar) each noise octave travels its own closed loop through noise space (
flowOffsetinsrc/core/shaders/artwork.ts), so curtains reshape, flares re-form and contours ripple, rather than the finished picture just sliding. Flow sets how much; Amount sets the whole-frame movement and the drift of lights. Grain uses separate noise and stays still unless Animate noise is on.FLOW_SCALEinmotion.tsevens out how sensitive each generator is. - Seamless loops. Every motion term is
sin(2π·phase + offset) − sin(offset): exactly zero at phase 0, so frame 0 is the still design, and periodic, so the last frame flows into the first. - Export. GIF (shared 256-colour palette, ordered dither, LZW) and WebM/VP9 (WebCodecs plus a small Matroska muxer) render frame by frame through the same pipeline as a still, including layers and Print Finish. One
ExportSessionkeeps the GPU contexts across frames. Sizes start capped (GIF 720 px, video 1280 px) because loops are heavy. MP4 (H.264,src/core/export/mp4.ts) is what Instagram, Slack, QuickTime and iOS accept; it is offered only where the browser can encode H.264 (checked withVideoEncoder.isConfigSupported), and the file is a standardftyp/moov/mdatMP4 with the index first so it can start playing while it downloads.
Print Finish (src/core/print/printFinish.ts, src/core/shaders/print.ts, src/features/inspector/PrintFinishPanel.tsx) makes a composition look physically printed on a Paper stock, folded, handled and scanned. It is a non-destructive, versioned (printFinish.version = 1) setting stored on the design; designs without it render exactly as before, and existing Multiply/Screen paper layers are not migrated.
Pipeline. There is one extra framebuffer-free pass inside the existing WebGL 2 program (no recompilation when parameters change):
- The composition (or only the artwork layer, by scope) is flattened with Canvas 2D to a straight-alpha texture, so text, logos and images are treated like artwork. This is the only extra resource and it is uploaded once per export.
- The print shader samples that texture by global uv, so ink spread can read neighbouring pixels across tile boundaries without seams (
scripts/verify-tiling.mjs --printdiffs a 4K tiled export against a single pass). paperEvaluate()supplies the paper's pigment, tooth height, fibres, pulp density, fold/wrinkle height gradient and crease occlusion. The same function lights Paper itself.- Artwork colour becomes pigment: saturation/contrast/absorption muting/limited palette, then ink spread, then per-method screening (stipple, halftone, riso plates, registration).
- Ink thickness varies (pooling in recesses, thin ink on rough stock) as a Beer-Lambert exponent on the ink's reflectance, so blacks stay black; coverage is only lost to dropout, crease wear, cracking and scuffs.
- Light stock uses a transmissive model (
paper x ink), so whites reveal the paper pigment. Dark stock uses an opaque light-ink model with an optional white underbase, blending between the two by paper lightness. - The paper's own normal lights the finished print, so folds and wrinkles read through dark ink, bright ink and type. Ink wear follows the crease centre; artwork is displaced slightly by the fold slope.
- Optional scan: exposure, cast, illumination, edge shading, restrained directional texture and grain.
Decisions and limitations. The interactive preview is capped at 1100 px while Print Finish is on (exports are full resolution). The print texture must fit the GPU's maximum texture size, so very large exports fail with a clear message. Colour is handled in linear light with sRGB at the texture and output boundaries. Riso is a three-plate model (two spot inks plus black), not a full separation. Fold wear and scuffs are procedural and intentionally restrained; Crumpled can read slightly sandy at the strongest settings. Lunar still uses its own paper.
npm run build
npm test
npm run test:e2eThe browser tests use Chromium's SwiftShader WebGL implementation so they can run in CI without a dedicated GPU.
For artwork review, start Vite on port 4173, then run the contact-sheet renderer:
npm run dev -- --host 127.0.0.1 --port 4173
npm run art:reviewIt saves editor-free PNG contact sheets for all built-in presets at square and 16:9 sizes, plus six parameter variations and six same-settings seed studies per generator, under art-review/.
For the Eclipse renderer stages, start Vite on port 4173 and run:
npm run art:eclipseThis writes 1600 × 1600 geometry, smooth-gradient, grain and final composite PNGs, plus two full-pixel detail crops, to art-review/eclipse/.
To render the six art-directed Eclipse compositions and a labeled contact sheet:
npm run art:eclipse:optionsThe editor-free 1600 × 1600 outputs are saved under art-review/eclipse/options/.
For the controlled Near Orbit tonal and texture comparison, run npm run art:eclipse:comparison. It writes six 1600 × 1600 variants, matching detail crops, and a labeled contact sheet to art-review/eclipse/comparison/. The combined treatment is used by the live renderer and image exports.
The built-in Near Orbit Range Study preset preserves the earlier tonal-range experiment. The current Near Orbit composition uses the combined treatment, with independent position, direction, falloff and intensity controls for each disc. Grain is monochromatic and weighted toward tonal transitions; the shared non-Eclipse and analogue finishes use the same black- and highlight-preserving approach. A rendered cross-generator grain check is saved in art-review/grain-refinement/.
- Imported fonts are not yet supported. The bundled local typefaces are Manrope and DM Mono.
- Custom preset management (save, rename, favorite, import and export) is not yet exposed; the built-in preset library and variation browser are available.
- Texture layers are represented in the layer model but do not yet have a dedicated drawing pass. Paper texture and grain are part of the Lunar generator instead.
- Eclipse geometry is adjusted through generator controls; direct manipulation currently applies to regular shape, text and image layers.
- Image layers can be composited as artwork, but image-to-effect conversion is future work.
- Tiled WebGL rendering avoids GPU framebuffer limits, while the final Canvas 2D output still depends on the browser's available memory. Allocation failures are surfaced in the export dialog.
- Performance has not yet been benchmarked across a range of desktop GPUs.