triode and hydra-synth: compatibility + architecture differences
This comparison describes the original GLSL runtime. The current renderer and custom transforms are covered in the TSL guide.
Historical comparison at triode revision 256bc90. For the current API and JSX authoring workflow, see the API reference and Playground guide.
Comparison scope
- hydra-synth scanned:
/Users/kasparsj/Work2/hydra/hydra-synth(up-main,c3ba80b) - triode scanned:
/Users/kasparsj/Work2/hydra/triode(main,256bc90, plus current working tree changes) - Scan date: 2026-02-21
- Method: full file-tree diff (excluding
.git/andnode_modules/) plus manual review of runtime, shader/compiler, packaging, CI, docs, and examples.
Diff size at a glance
- Files added in
triode: 121 - Files removed from upstream: 6
- Files modified from upstream: 22
- Source tree growth:
- src/ files: 25 -> 67 - src/ JS+shader LOC (approx): 3,498 -> 9,604
1) Core architecture shift: regl pipeline -> three.js runtime
- Rendering backend was replaced:
- New 3D render abstractions were added:
- Output model changed:
- hydra-synth: regl-based fullscreen shader ping-pong pipeline. - triode: three.js renderer + EffectComposer pass graph.
- TriodePass, TriodeShaderPass, TriodeMaterialPass, TriodeRenderPass, TriodeFadePass - TriodeUniform registry for shared runtime uniforms (time, resolution, textures, bpm, mouse) - TriodeShader/TriodeFragmentShader/TriodeVertexShader for shader assembly against three.js materials.
- hydra-synth output = regl draw command + framebuffer ping-pong. - triode output = per-output EffectComposer with multi-pass render/material/fx/layer support and render-to-texture helpers.
2) New 3D scene/camera/object API layer
triodeadds a full 3D scene API (src/three/scene.js) on top of shader/source chains:- New object/resource utility modules were added:
- Scene creation and reuse, groups, mesh/line/points primitives, instancing, CSS2D/CSS3D objects. - Camera mixins: perspective(), ortho(), coordinate-space helpers (screenCoords, normalizedCoords, cartesianCoords). - Built-in camera controls via TriodeOrbitControls. - World/lights integration (stage().lights(), stage().world()), helpers (axesHelper, lookup/filter helpers).
- Geometry (geom, alias gm), material (mat, alias mt), texture/FBO (tex, alias tx), composition layout (compose, alias cmp), noise (noiseUtil, alias nse), random (random, alias rnd), math (math), typed array/image tools (arr), global constructors (three/globals), GUI helpers (gui), DOM element helpers (el).
3) Public runtime API changes (TriodeRenderer / triode.synth)
- Constructor options expanded:
triode.synthnow exposes substantially more runtime surface:- Event hooks were added to synth state:
- Script loading behavior changed:
setResolution()behavior changed:
- Added webgl, css2DElement, css3DElement.
- Added canvas, scene, shadowMap, camera helpers, module namespaces (tx, gm, mt, cmp, rnd, nse, gui, arr, el).
- click, mousedown, mouseup, mousemove, keydown, keyup. - canvas.js binds DOM listeners and routes to these hooks.
- loadScript(url, once = true) now supports one-time dedupe by URL.
- Now updates CSS2D/CSS3D renderers in addition to outputs/sources.
4) Shader/generator/compiler system expansion
- Generator factory changed:
- GLSL source pipeline changed:
- GLSL codegen changed:
- Introduced types.js type system (typeLookup, casting, gen-type replacement). - Added utility-function registry support (util transforms). - Added transform categories: vert, genType, glsl.
- GlslSource now compiles to richer pass descriptors (material/camera/viewport/fx/autoclear aware), not just plain fragment pass objects. - Added material helpers on shader chains: .basic(), .lambert(), .phong(), .material(). - Added source-channel swizzle getters (.x, .xy, .xyz, etc.) and .st() transform stitching. - Added render-to-texture helpers through output pipeline (tex, texMat path).
- Now supports vertex-aware paths and mixed source+scene combine flows. - Combine/combineCoord handling can synthesize temporary render passes for mixed pipelines.
5) Hydra transform/function set changes
- Added source/noise/color constructors and generic operators in
glsl-functions: - Utility GLSL library expanded (
utility-functions) with more reusable internal helpers (_twopi,_permute,_mod289,_taylorInvSqrt,_pnoise, etc.). - Behavior-level transform changes include:
- New noise-related generators: snoise, pnoise, wnoise, cnoise, fbm. - New color constructors: solid2, solid3, hex. - New generic operations (genType): map, sin, cos, tan, atan, pow. - Added glsl raw expression transform type.
- rotate() remains degree-based for compatibility, and explicit helpers rotateDeg()/rotateRad() are available. - src() includes glsl300 variant for GLSL3 texture sampling.
6) Source/media/texture pipeline changes
TriodeSourcetexture implementation switched from regl textures to three.js textures:- Source cleanup semantics changed:
- Canvas source resize bug fixed:
- New texture infrastructure via
tx:
- CanvasTexture, VideoTexture, TextureLoader. - Stream/camera/video/screen init paths adapted accordingly.
- clear() disposes texture and nulls it (instead of resetting to 1x1 regl texture).
- width/height mismatch check now uses || (not &&), so one-axis changes trigger resize.
- Data textures, array textures, atlas packing, wrap/repeat/mirror helpers, render targets, texture save/load helpers.
7) Build, packaging, and module-loading changes
- Toolchain replaced:
- Distribution entrypoint changed:
- Package metadata changed:
- Dependency set changed:
- hydra-synth: browserify + budo + esmify. - triode: Vite (vite, vite-plugin-glslify) + ESM-first scripts.
- package.json main now points to dist/triode.js. - ESM import now routes through src/package-entry.js, which explicitly enforces browser runtime and then loads bundle.
- Version line reset to 1.0.0 for triode. - Repo/homepage/issues changed to kasparsj/triode. - files allowlist added for pack contents.
- Removed runtime dependency on regl. - Added three, gl-mat4, glsl-film-grain. - Added dev dependencies for lint/typecheck/format/test/build tooling (eslint, typescript, prettier, playwright, Vite ecosystem).
8) Testing, quality gates, and release engineering added
- New CI workflows:
- New smoke/regression test scripts:
- New quality gates:
- ci.yml: Node matrix build + smoke tests + packaging dry-run. - release-verify.yml: tag-triggered full verification + tarball/checksum artifacts. - pages.yml: automated GitHub Pages build/deploy.
- Canvas smoke. - Module-load/import smoke. - Regression smoke for previously fixed runtime bugs. - Browser smoke in Chromium/Firefox. - Non-global 3D browser smoke.
- lint, typecheck, format:check, release metadata checks, checksum generation.
9) Documentation and developer experience expansion
- Added operational docs:
- Added governance/support docs:
- README was rewritten around triode identity, distribution model, browser-only runtime contract, and 3D quickstart.
- New examples catalog (
examples/) focused on 3D/scene APIs. - Added static docs/examples website generator and checked-in generated output (
site-dist/).
- docs/getting-started.md - docs/production-checklist.md - docs/release.md
- CONTRIBUTING.md - SECURITY.md
10) Repository/process additions
- Added issue templates for bug/performance/creative regression reports.
- Added release and site build scripts under
scripts/. - Added tarball artifacts in repo (
triode-*.tgz) and release checksum workflow support.
11) Components removed or replaced from upstream
- Removed upstream-only files/paths:
- Replaced/obsoleted architecture:
- assets/hydra-webpage.png - dev/examples.js - dev/style.css - src/shader-generator.js - src/shaderManager.js - src/glsl/gaussian.frag (moved to shared shader location)
- regl-centric output/pipeline implementation is superseded by three.js render/composer pass architecture.
12) Practical compatibility impact summary
- Existing 2D Hydra shader patterns still exist, but runtime behavior is now anchored to three.js rendering internals.
- Projects depending on regl internals or upstream package-loading assumptions may require adaptation.
- ESM consumers now must run in browser-like runtime contexts (pure Node/SSR import is explicitly unsupported).
- New 3D APIs are first-class and deeply integrated, not thin add-ons.