Shader export
Take a look you built with an Expression and hand it to another engine as ready-to-run shader code.
When you build a procedural look in DNA — a noise field, a gradient, a colour formula, a Distance Field pattern — that look is really a little piece of GPU maths. Shader export writes that maths out as standalone shader source so you can paste it into another tool and keep using it there.
What you get
DNA converts the formula in an Expression into a self-contained shader in the language you pick:
WGSL — the native form, exactly what DNA runs.
GLSL and GLSL ES — for OpenGL and WebGL pipelines.
HLSL — for DirectX engines.
Metal — for Apple platforms.
ShaderToy — GLSL wrapped in a
mainImagefunction, ready to paste straight into shadertoy.com.Unity — an HLSL
.shaderfile wrapped in a ShaderLab template with vertex/fragment boilerplate already filled in.
Everything except WGSL is produced by cross-compiling from the WGSL form, so the same formula comes out consistent across every target.
How the context maps across
Your Expression can read the usual live values — time, frame, the canvas size, the surface coordinate. On export these are wired to each engine's own equivalents so the shader animates the moment you drop it in:
In ShaderToy,
timebecomesiTime, the frame counter becomesiFrame, and the canvas size becomesiResolution. The surface coordinate is computed asfragCoord / iResolution.In Unity,
timemaps to_Time.yand the canvas size to_ScreenParams.
Tempo values (BPM, beat, bar) exist in DNA but have no standard equivalent in a plain shader. In the ShaderToy output they are written out as fixed placeholders (BPM 120, beat 0) — if your look reacts to tempo, you'll need to feed those values in yourself on the other side. For live tempo-reactive work, keep it in DNA and see Tempo sync.
Textures and references
If your Expression samples an image or other texture, the export lists the texture slots it expects (named like expr_texture_0). The shader code references them by those names — you connect your own textures to those slots in the destination engine.
Scope and limits
Shader export is deliberately narrow: it captures one Expression's formula, not your whole graph.
This is single-formula export, not a scene exporter. It does not carry across geometry, simulation, multi-pass rendering, lights, cameras, materials, or anything that isn't pure maths inside one Expression. To take a full 3D scene elsewhere, use 3D & splat export; to render frames, use Video & image export.
A few more things to know:
The export treats the formula as if it runs once per pixel across a full-screen quad. Per-element values (an element index, the number of elements in a Collection) are flattened to a single element, so an Expression written to vary across many points won't carry that variation.
Formulas that return something a pixel shader can't hand back — a matrix, or a multi-field record — export as a valid but placeholder shader. Reduce your Expression to a colour or a number first.
If a particular piece of maths can't be translated to the chosen language, DNA leaves an error comment in the output rather than failing silently. Skim the generated source for any
//error lines before you rely on it.
Shader export is a young capability and is not yet a one-click button in the export panel — a richer export experience (Export panel v2) is planned. For now, treat the generated code as a strong starting point you may need to tidy by hand in the destination engine.
See also
The Expression language — where these formulas are authored
Built-in functions — the building blocks that survive the round-trip