Get Dasca

Docs

Learn Dasca, from your first project to node graphs.

Modes / Code

Code

Write GLSL shaders in DASCA, tune them with live sliders, animate uniforms with keyframes and record the result as video.

Note

These docs cover Dasca 2.3.

Code mode is a live GLSL shader editor. You write a fragment shader (and optionally a vertex shader), DASCA compiles it as you type, and the canvas shows the result in real time on an image, a video or no media at all.

Opening Code mode

Click Code in the mode tabs at the top of the window, or press Ctrl+Tab (Control+Tab on macOS) to switch to Code mode and back. Code mode keeps its state while you work in other modes, and your shader, uniform values, keyframes and loaded media are saved in your project file (see Project Files).

The workspace has three areas:

  • Canvas in the middle, with the texture strip and the timeline dock below it.
  • Code panel on the right, with the editor sections and the Uniforms list. Drag its left edge to make it wider or narrower.
  • Toolbar at the top: New shader, Example shaders, Save frame, Record clip, Performance info and Fullscreen preview.

The code panel

The code panel has three collapsible sections:

SectionWhat it holds
VertexThe vertex shader. Closed by default. The default one passes vUv to the fragment shader and draws a full-screen quad.
FragmentThe fragment shader. Open by default. This is where most of your work happens.
UniformsControls for your own uniforms. Appears only when the shader declares at least one custom uniform. The header shows how many there are.

The buttons at the top of the panel:

ButtonWhat it does
Play (auto compile)Compiles automatically after about 1 second without typing. The status text reads Auto compile. This is the default.
Stop (syntax only)Only checks your code for errors. The canvas keeps running the last compiled shader until you compile again. The status text reads Syntax only.
Reset to last compiledPuts the last shader that compiled successfully back into the editor and recompiles it. Use it when an edit broke something and you want to go back.
Code handbookOpens the handbook panel (see Code handbook).

Press Ctrl+Enter at any time to compile immediately, in either mode.

Editor features

  • Drag numbers. Hover a number in the code and drag it left or right to change it. The shader recompiles quickly while you drag. Hold Shift for steps 10 times larger and Alt for finer steps. Dragged values do not go below 0.
  • Suggestions. The editor suggests GLSL types, keywords, built-in functions and the uniforms DASCA provides. Tab accepts a suggestion.
  • Closing brackets. A missing ), ] or } is shown in gray. Tab inserts it.
  • Indent. Tab indents the selection and Shift+Tab outdents it.

Errors

Error messages are hidden while you type. When a compile or syntax check fails:

  • The error appears directly under the line it refers to, and the line number is highlighted.
  • The section header shows the first error line (for example L12) in red, and a closed section opens on its own.
  • Up to four errors are listed per shader.
  • Bracket problems are reported before the shader is sent to the GPU, so the message points to the line you wrote.
  • Common messages are rewritten in plain language, such as "Unknown name" for an undeclared identifier.

The canvas keeps showing the last shader that compiled, so a typo never leaves you with a blank screen.

Custom uniforms

Every uniform of type float, int, bool, vec2, vec3 or vec4 that is not a system uniform gets a control in the Uniforms section after the shader compiles. The label is made from the name: u_tintColor becomes "Tint color".

Setting defaults and ranges

Add a comment on the same line as the declaration:

uniform float u_intensity; // 1.5
uniform float u_angle;     // 45 [0, 360]
uniform vec3  u_tintColor; // color picker
uniform bool  u_invert;    // 1
  • The first number after // sets the default value.
  • [min, max] sets the slider range.
  • For bool, any non-zero number makes the toggle start on.

Controls by type

TypeControl
float, intSlider with an editable value. int sliders move in whole steps.
boolToggle.
vec3, vec4 with "color" or "colour" in the nameColor picker. Starts at white. For vec4 the fourth component is kept.
Other vec2, vec3, vec4One number field per component (x, y, z, w). Each starts at 0.5.

Automatic ranges

When there is no [min, max] comment, the slider range comes from the uniform name:

Name containsRangeDefault
scale0.1 to 81
levels2 to 164
bias, brightness-1 to 10
intensity, strength0 to 21
mode, invert, enabled0 to 1 (whole steps)0
count, size1 to 512 (int: 1 to 64)64 (int: 4)
decay, smoothness0 to 10.5
anything else (float)0 to 10.5
anything else (int)0 to 100

Working with the controls

  • Click a value to type it. Hold Shift while dragging a slider for fine adjustment.
  • Double-click a slider or its name to reset it to the default.
  • The reset button in the Uniforms header resets all uniforms to their defaults.
  • Values you set are kept when you recompile, as long as the uniform still exists.
  • When the focus is not in the code editor, Ctrl+Z undoes and Ctrl+Y (or Ctrl+Shift+Z) redoes uniform and keyframe changes. Inside the editor these keys undo and redo text.

Textures and media

The texture strip under the canvas holds your inputs. Click a tile to load an image or video into it.

TileUniformNotes
tDiffusetDiffuseMain input. Without media it shows a built-in sample image. A video gets play/pause, a scrubber and a time readout on the canvas.
tCustom1 to tCustom8tCustom1 ... tCustom8Eight extra slots for images or videos. Drag a filled tile onto another slot to swap them.
AudiotAudioFFT and the audio uniformsLoad an audio file to drive the audio uniforms.

Hover a filled tile and click its small X to clear it. Videos loop and play muted. If a project refers to a video that is not on this computer, its tile is outlined in red; click it to choose the file again.

The default shader and the example shaders read tCustom1 when it holds media and fall back to tDiffuse otherwise.

Output size

The size of the rendered image comes from the first of these that applies:

  1. The media in tDiffuse.
  2. The media in tCustom1.
  3. The resolution picker on the canvas, shown only when neither slot holds media: 1920 × 1080, 1280 × 720, 1080 × 1080 (default), 1080 × 1920, 854 × 480, 512 × 512.

The canvas is letterboxed to keep this aspect ratio.

Audio input

After you load an audio file, the Audio tile shows Play audio/Pause audio, Mute speakers, a seek bar, the current time and Remove audio. The file loops. Muting only silences the speakers; the shader still receives the audio data.

System uniforms

Declare any of these in your shader and DASCA fills them in every frame. Uniforms you do not declare are not bound.

UniformTypeValue
tDiffusesampler2DCurrent input frame (image or video).
tPrevFramesampler2DThe previous rendered frame. Use it for feedback and trails.
tNoisesampler2D256 x 256 random RGBA noise. Static, repeat wrap, nearest filtering.
tBlueNoisesampler2D64 x 64 grayscale ordered pattern (an 8 x 8 Bayer matrix, tiled). Static, repeat wrap, nearest filtering.
tCustom1 ... tCustom8sampler2DMedia from the custom texture slots.
u_resolutionvec2Canvas size in pixels.
u_mediaResolutionvec2Natural size of the media in pixels.
u_timefloatElapsed seconds.
u_deltaTimefloatSeconds since the last frame.
u_frameintFrame counter, starts at 0.
u_mousevec2Mouse position on the canvas in pixels, origin at the bottom left.
u_mouseNormvec2Mouse position normalized to 0-1.
u_mouseDownfloat1.0 while the left mouse button is held on the canvas, otherwise 0.0.

The feedback buffers use floating-point textures, so long trails stay smooth.

Audio uniforms

These work after you load a file in the Audio tile.

UniformTypeValue
tAudioFFTsampler2D256 x 1 texture. The red channel holds the magnitude of each frequency bin, 0-1, from low (left) to high (right).
u_audioBassfloatAverage of the lowest 10% of the bins.
u_audioMidfloatAverage of the bins from 10% to 60%.
u_audioHighfloatAverage of the bins from 60% to 100%.
u_audioAmplitudefloatAverage of all bins.

The analysis uses a 512-sample FFT with smoothing. To read one frequency, sample the texture at a normalized position (0 = bass, 1 = treble):

uniform sampler2D tAudioFFT;

float audioFreq(float f) {
  return texture2D(tAudioFFT, vec2(clamp(f, 0.0, 1.0), 0.5)).r;
}

Preprocessor

You can write WebGL 1 style GLSL. When the GPU supports WebGL 2, DASCA converts it automatically:

  • texture2D( becomes texture(.
  • varying becomes out in the vertex shader and in in the fragment shader.
  • gl_FragColor becomes an output named fragColor.

#version and precision lines in your code are removed; DASCA adds the right ones. Line numbers in error messages still match the editor.

Defines

DASCA adds #define NAME 1 for every feature your shader mentions, so you can write code that adapts with #ifdef:

DefineAdded when the shader uses
HAS_PREV_FRAMEtPrevFrame
HAS_NOISEtNoise
HAS_BLUE_NOISEtBlueNoise
HAS_MOUSEany u_mouse uniform
HAS_TIMEu_time
HAS_FRAMEu_frame
HAS_AUDIOtAudioFFT, u_audioBass, u_audioMid, u_audioHigh or u_audioAmplitude

WEBGL_VERSION is always defined, as 1 or 2.

Loop unrolling

Put #pragma unroll on the line before a for loop to unroll it:

#pragma unroll
for (int i = 0; i < 8; i++) {
  // ...
}

The loop must use an int counter with constant start and end values and i++. Loops with more than 256 iterations are left as they are.

Example shaders

Click Example shaders in the toolbar to load a ready-made shader. Each one starts with a comment that explains how to use it. All of them react to audio and still animate without it.

ExampleWhat it does
Spectrum HaloA glowing ring driven by music: bass shapes the bottom, treble the top, and kicks make it pulse. Needs no image.
Pulse HalftoneTurns your image or video into a print-style dot pattern. Dots swell on the bass.
Bass ShockwaveHits your image with a zoom punch, color split and ring wave on every kick. Pulses on a steady beat without audio.
Liquid EchoBright areas leave flowing trails that fade into one color. Bass speeds up the zoom and mids stir the flow.

Loading an example replaces the code in both editors, clears the undo history and removes keyframes for uniforms the example does not have. New shader does the same with the default shader, which simply shows the input.

Code handbook

Click Code handbook (the question mark in the code panel) to open a floating reference. It covers the compile modes, editor tips, system and audio uniforms, custom uniform syntax, the preprocessor and the keyboard shortcuts, shown with your current key bindings. Drag its header to move it. It stays open until you click its close button.

Timeline and keyframes

Any custom uniform can be animated. The timeline works the same way as in the other modes; see Keyframes and Timeline for the full guide.

  • Click the diamond next to a uniform to add a keyframe at the playhead. Click it again on that frame to remove the keyframe. The timeline opens when you add a keyframe.
  • Use Open timeline / Close timeline in the dock under the canvas to show or hide the timeline. The dock also has Play / Pause.
  • The Code timeline starts with a duration of 10 seconds. Click the duration next to the time readout to type a new one.
  • Auto key (Alt+K): when on, changing an animated uniform adds a keyframe at the playhead. When off, changes only update existing keyframes.
  • Snap (Alt+S): snaps keyframes while you drag them. Hold Shift while dragging to bypass it.
  • Click a keyframe's curve to change its easing: Linear, Ease In, Ease Out, Ease In Out (the default) or Hold. Drag the curve handles to make a Custom curve.
  • J and K jump to the previous and next keyframe. Home and End go to the start and end. The arrow keys step one frame; Shift plus an arrow steps ten.
  • Toggle (bool) uniforms always change in steps, without easing.

Recording video

Click Record clip in the toolbar, or press Ctrl+Shift+R, to open the recording panel. Choose a mode first:

ModeHow it works
Real-timeRecords the canvas as it plays. If any uniform has keyframes, recording starts the timeline from the beginning and stops at its end. Otherwise you stop it yourself. You can pause and resume.
OffscreenRenders the timeline frame by frame at the output size, then encodes the video. u_time, u_deltaTime and u_frame follow the exact frame time, so the result is smooth even if the shader is too heavy to play in real time. The length is the timeline duration. It cannot be paused.

Settings:

ControlOptionsMode
Frame rate24 fps, 30 fps (default), 60 fpsBoth
BitrateLow, Balanced, High (default)Real-time
FormatWebM, MP4 (default)Real-time
FormatMKV (lossless, default), MP4 (H.264)Offscreen

The panel also shows the frame count, the content size and the output format. Real-time recordings are scaled down so neither side is larger than 1920 pixels.

During a Real-time recording you can use Pause, Resume, Stop and review and Discard. Ctrl+Shift+R stops the recording and Ctrl+Shift+P pauses or resumes it. After you stop, a Preview of the clip plays in the panel. Click Save video to choose where to save it, or Clear to throw it away.

An Offscreen export shows its progress and a Cancel export button. When all frames are captured, choose a destination and DASCA encodes the file. Your recording settings are remembered between sessions.

Saving a frame

Click Save frame in the toolbar to save the current frame as a PNG at the output size. A save dialog opens in your default save location. Ctrl+Shift+E does the same.

Performance info and fullscreen

  • Performance info (G) shows an overlay with FPS, CPU frame time, WebGL version, GPU name, maximum texture size, texture units and maximum uniforms.
  • Fullscreen preview (F11) hides the code panel and toolbar and shows only the canvas. Click Exit fullscreen or press F11 again to return.

Keyboard shortcuts

You can change these in Preferences > Shortcuts.

ShortcutAction
Ctrl+EnterCompile shader
Ctrl+TabSwitch to or from Code mode
Ctrl+Shift+ESave current frame as image
Ctrl+Shift+RStart / stop recording
Ctrl+Shift+PPause / resume recording
F11Toggle fullscreen preview
GToggle performance info
Ctrl+ZUndo
Ctrl+Y or Ctrl+Shift+ZRedo
SpaceTimeline play / pause
J / KPrevious / next keyframe
Home / EndGo to start / end
Left / RightStep one frame
Shift+Left / Shift+RightStep ten frames
Alt+KToggle auto key
Alt+SToggle snap
Tab / Shift+TabIndent / outdent in the editor
Ctrl+SSave project
Ctrl+OOpen project