Reference

Pipeline text

A pipeline written as text, to ask an assistant about it: how to copy it, and the format it is written in.

A pipeline can be shown as text: one line per node and one per link. You can paste it in an AI assistant (ChatGPT, Claude, Copilot…) so that it reads your pipeline, and the assistant can answer in the same format. It is a Pro feature, trial included.

Ask an assistant

  1. Open a pipeline and click View pipeline as text in its toolbar.
  2. Write what you want in the field under the text: explain this pipeline, find what is wrong, add a vignette…
  3. Click Copy for AI and paste in the assistant.

The copied prompt has everything the assistant needs to start: what ISF Studio is, the format below with recipes and an example of feedback, your pipeline and your request. It also gives the address of the node catalog and of the snippet catalog, which an assistant that can read web pages fetches by itself. If yours cannot, tick Include the list of the node types under the text: the prompt then holds every node type, with its ports (a few thousand words). Tick Include the list of the snippets for the same reason: the prompt then holds the id and the signature of every snippet of the Toolbox (about 35 KB), and With what each snippet does adds the first sentence of each description (about twice that). Copy gives the text alone.

Ask about one group

When a group, a loop, a branch or a function is open in the editor, the dialog offers Ask only about the group (ticked by default). Copy for AI then gives the assistant what is inside that block, with its ports, and not the rest of the pipeline: a shorter prompt, on the part you are looking at. The text shown in the dialog, and Copy, stay the whole pipeline.

The assistant answers with the inside of the block, in a pipeline-text-inside block. ISF Studio only imports whole pipelines, so you apply that answer by hand. Untick the option to ask about the whole pipeline, which can be imported back.

Bring a pipeline in

When an assistant or a web page gives you a pipeline in this format, copy it and choose File > Import > Pipeline from Clipboard. ISF Studio creates a new pipeline in your library, lays it out, and opens it. It is a Pro feature, trial included.

To make the pipeline in a folder of the library, right-click the folder and choose Import… > Pipeline from Clipboard….

The files a pipeline points at (a shader, another pipeline, an image) do not have to be where the text says: if no file has that path, ISF Studio looks from the folder you import into, then for a path that ends the same way, then for a file of the same name, the closest one first. The notice that follows the import says which file was taken for which.

You can copy the text as it is: a code block from a chat, with sentences around it, or a quoted reply. If it cannot be read, or the graph does not work (a port that does not exist, two types that do not match), a dialog tells you what is wrong and on which line, with a suggestion when there is one. Copy errors for AI copies the errors and the text, so that the assistant can fix them.

You can import nodes, values, links, groups, loops, branches, functions, Toolbox snippets, the vertex graph, and the shaders, pipelines and images of your library, given by their path from the library root ({"shaderId": "Shaders/Plasma.fs"}). ISF Studio reads those files as when you drop them on the canvas, and keeps the images in the new pipeline. A snippet that was renamed or moved in an earlier version is still found under its old id. A path that is not in the library is an error, with the nearest names.

Copy for AI also lists the shaders, pipelines and images of your library, so that the assistant knows which files exist. Only the paths are listed. If the assistant gets a shader's inputs wrong, the errors list the right ones.

Shaders too

A shader is already text. Click Copy the shader for an AI assistant in the toolbar of its editor, write your request, and click Copy for AI. The prompt has what an ISF shader is, your shader and the console errors. It is a Pro feature too.

Turn a shader into a pipeline

Tick Ask for a pipeline of this shader in the same dialog. The prompt then also has the format of the pipeline text, the files of your library and the path of the shader, and asks the assistant to cut the shader so that the graph can be read: its inputs become input nodes, each function becomes a snippet node written with its own code, a short main() becomes nodes of the catalog, and its passes become pass nodes. A buffer a function reads (a persistent pass, for example) is a sampler2D parameter that a read-pass node feeds. By default the assistant is asked to cut all of it, even if it has to rewrite some code, and to say what it could not do. Tick Allow the shader itself where it cannot be cut to let it plug the shader in with a shader-isf node for that part. Copy its answer and choose File > Import > Pipeline from Clipboard.

The result is an attempt, not a conversion: compare the picture with the shader's. A snippet written with its own code is a function of the pipeline: its code is in the text, so View pipeline as text shows it, and an assistant can change it. As with a pipeline, tick Include the list of the node types and Include the list of the snippets if your assistant cannot read web pages.

For assistants

The nodes and snippets are listed in files made for machines: the node catalog (every type, its ports and values), the snippet catalog, and llms.txt and llms-full.txt, which hold the docs and both catalogs in one text.

The format

A pipeline is a graph of nodes. In ISF Studio it is drawn on a canvas; this text is the same graph, one line per node and per link. The coordinates are not in it: the editor lays the graph out.

Shape of the text

pipeline-text 1
title "Mixing colors"
metadata {"CREDIT": "Me", "CATEGORIES": ["Color"]}
values {"mixAmount": 0.5}

graph fragment
  node n1 input-color {"input": {"NAME": "colorOne", "TYPE": "color", "DEFAULT": [1, 0, 0, 1]}}
  node n2 input-color {"input": {"NAME": "colorTwo", "TYPE": "color", "DEFAULT": [0, 0, 1, 1]}}
  node n3 math-add-vec4  # a: vec4, b: vec4 -> result: vec4
  node n4 output-color  # fragmentValue: vec4 -> (nothing)
  link n1.value -> n3.a
  link n2.value -> n3.b
  link n3.result -> n4.fragmentValue

graph vertex
  ...
  • The first line is pipeline-text 1. title, metadata (the words of the ISF header) and values (what the inputs are set to, by input name) are optional.
  • graph fragment holds the fragment graph, and is always there. graph vertex holds the vertex graph, when the pipeline has one.
  • A line is a keyword, then its words. Blanks at the start are free. A line that starts with # is a comment, and so is the end of a line after # (the app writes the ports of a node there: read them, they are not needed to write one).
  • Strings and objects are JSON, on one line.

Nodes

node <id> <type> ["label"] [{data}] [begin]

  • id: a name you choose (letters, digits, _), unique in the whole graph. The app writes n1, n2…
  • type: the exact name of the node's definition (value-float, math-multiply-vec3-float, glsl-common-mix-vec3-vec3-float, input-float, output-color, snippet…). It is not a label: there is one type for each combination of types a node works with, so math-add-vec4 and math-add-float are different nodes. Use the types that appear in the pipeline you are given or in the node catalog (https://isf-studio.app/node-catalog.json, one line for each in https://isf-studio.app/llms-full.txt); do not invent one.
  • "label": only when the node was renamed.
  • {data}: what the node holds. Examples: {"value": 0.5} for value-float, {"value": [1, 0.5, 0]} for value-vec3, {"input": {"NAME": "speed", "TYPE": "float", "DEFAULT": 0.5, "MIN": 0, "MAX": 2}} for an input (NAME, TYPE, DEFAULT, MIN, MAX, LABEL are those of an ISF input; an input's NAME is what the shader and the controls know it by), {"snippetId": "noise-and-patterns/noise/value-noise-2d"} for a snippet of the library (its code comes from the library: its inputs are the parameters of its function and its output is result; the snippet catalog, https://isf-studio.app/snippets-catalog.json, gives the id and the signature of each, e.g. float noise2d(vec2 p): use the ids it gives, nothing else). A function of your own is a snippet written with its code, and no id: {"snippetName": "Twice", "code": "float twice(float x) {\n return x * 2.0;\n}"} (one GLSL function: the parameters of its signature are the inputs of the node, and its value is result; an out parameter is one more output; the code holds the helpers the function calls, written before it, and the constants it uses: two snippets that need the same helper both hold it, and it is declared once; give each function its own name, and write the same code again to use it in two places). With "mode": "define" the node only declares the function, and a function-call node uses it: link the snippet's fn to the call's fn, then give the call the arguments. A snippet's code may read the built-ins (TIME, RENDERSIZE…) but not the inputs of the pipeline: pass them as parameters. A shader, a pipeline or an image of the user's own library is told by its path from the root of the library: {"shaderId": "Shaders/Plasma.fs"} for shader-isf (a .fs or a .istshader), {"pipelineId": "Pipelines/Glow.istpipe"} for pipeline-isf, {"path": "Images/city.jpg"} for imported-image. Their ports come from the file (a shader's inputs, for example), and only the files the user lists exist.
  • A comment, text or todo note can be put on a node of the same graph, and the compiler writes it above that node in the shader (as // lines). Write it as {"text": "What it does", "attachTo": "n3", "side": "top", "width": 220, "height": 60} (side is top by default, or bottom, left, right: where the note is drawn; the notes of one side are stacked), or with a link, link c1.text -> n3.note (the app writes it so). A node takes any number of notes; a note is on one node. It goes on a node that computes, or on a container, a group, a function, a loop or a branch (the compiler writes it above what the container holds, or above its declaration for a function): not on a node at the edge of a container (a loop-input, a function-parameter…), or on another note.
  • Draw Text and Typewriter are not node types of their own: they are snippet nodes with no id, "textInput": true and a snippetName, fragment graphs only. The string they draw comes from a text node linked to their text input (link t1.text -> d1.text, with t1 a text node, {"text": "Hello"}), and the app writes their real code from it when the pipeline is compiled: write only a stub of the function, with the right signature and a body that returns 0. Draw Text, {"snippetName": "Draw Text", "textInput": true, "code": "float drawText(sampler2D font, vec2 p, float size, float spacing, float lineSpacing, out float sdf, out vec2 aabbMin, out vec2 aabbMax) {\n sdf = 0.0;\n aabbMin = vec2(0.0);\n aabbMax = vec2(0.0);\n return 0.0;\n}"}: inputs text (string), font (the image of a font), p (the pixel, in pixels from the start of the first line), size (the em, in pixels), spacing and lineSpacing (added to each character and each line, as a fraction of size); outputs result (the coverage, 0 to 1), sdf (the distance in pixels, above 0 inside) and aabbMin, aabbMax (the box of the text, in pixels as p is). Typewriter writes how much of the same text is typed, to mask what Draw Text draws: its function must be named typewriter… (the name is what tells it from Draw Text), {"snippetName": "Typewriter", "textInput": true, "code": "float typewriterText(sampler2D font, vec2 p, float size, float spacing, float lineSpacing, float time, float speed, out float characters, out vec2 penEnd, out float index, out vec2 cell) {\n characters = 0.0;\n penEnd = vec2(0.0);\n index = -1.0;\n cell = vec2(0.0);\n return 0.0;\n}"}: the same inputs, plus time (seconds since the typing starts) and speed (characters a second); outputs result (1 where the text is written, 0 elsewhere), characters (its length), penEnd (where the pen is after it), index (the number of the character under the pixel, -1 where there is none) and cell (where the pixel lies in its cell). Both read the same text and the same font and p.
  • A send and its receive nodes share a channel by its name: a receive reads the send of its graph that has the same channelName ({"channelName": "baseColor"} on both); the channels of a graph have different names. No id ties them, and no link: the receive has no input.
  • begin: the node holds a graph of its own (a group, a loop, a function). Its nodes and links follow, until a line that is only end.

link <id>.<port> -> <id>.<port>: from an output port (src) of a node to an input port (sink) of another.

  • A port is written by its name, as in the comment of its node (n3.result). If a node has two ports of one name, the first is name and the next name~2, name~3. Any character that is not a letter, a digit, _ or - in a name is written %XX.
  • A link joins two nodes of the same graph (the same block). A link to a group, a loop or a function goes to its own ports, outside; the nodes inside are linked inside.
  • The types of the two ports must be the same: to join a vec3 to a vec4 insert a conversion node (convert-vec3-vec4). A few types are the same under another name and join with no node: color is a vec4, point2D a vec2, event a bool (an input-event feeds a bool parameter of a snippet), and audio and audioFFT are images, that is sampler2D (an input-audio or input-audiofft feeds a sampler2D parameter of a snippet, and is read with IMG_NORM_PIXEL there). An input port takes one link, unless it is marked as taking several.
  • Some ports take the type of what is linked to them, so the type in a comment can change once a link is made.

Groups, loops and functions

The node has begin, and its inside holds boundary nodes: group-input and group-output for a group (function-input, function-parameter, function-return, function-output for a function; branch-input and branch-output, which share a "pairId", for a loop). The data of a boundary node gives the name of the port it makes on the outside: {"portName": "offset"}. The ports of the container are made from them, so write the inside first and link the container after. For a function's parameters and returns and the channels of a loop, "portType" gives the type of the port ({"portName": "x", "portType": "float"}), and the loop-input and loop-output of one channel share a "pairId", which is unique in the whole text, as an id of a node is (two loops never use the same one: give each loop its own, "marchT" and "shadowT"). A loop comes with its iterator, its bound and its test: write what the loop of the pipeline you are given holds, and link the nodes the same way. The text of a function call names the function it calls by the link into its fn port.

The ends of a pipeline

A fragment graph ends in an output-color node (gl_FragColor, a vec4): link what the pipeline draws to it. The inputs of the pipeline are the input-* nodes: they become the controls of the window.

Passes, feedback and sizes

A pass node draws what is linked to its color port (a vec4) into an image of its own, and gives that image at texture. Its data names it and sets it, everything optional: {"target": "trail", "persistent": true, "float": true, "width": "$WIDTH/2", "height": "$HEIGHT/2"}. target is its name, persistent keeps the image from one frame to the next, float makes it 32-bit, width and height are ISF expressions ($WIDTH and $HEIGHT are the size of the output).

A read-pass node, {"target": "trail"}, gives at texture the image of the pass of that name, wherever it is in the graph. For a persistent pass it is the image drawn at the previous frame: that is how trails and feedback are made. An image is read as a color with img-this-norm-pixel (the pixel being drawn: image -> color) or img-norm-pixel (a coordinate from 0 to 1 at coordinate). What is linked to output-color is drawn last. A trail, the brightest of the image and of the faded previous frame:

graph fragment
  node img input-image {"input": {"NAME": "inputImage", "TYPE": "image"}}
  node fade input-float {"input": {"NAME": "fade", "TYPE": "float", "DEFAULT": 0.95, "MIN": 0, "MAX": 1}}
  node cur img-this-norm-pixel
  node prev read-pass {"target": "trail"}
  node prevPx img-this-norm-pixel
  node faded math-multiply-vec4-float
  node keep glsl-common-max-vec4-vec4
  node trail pass {"target": "trail", "persistent": true}
  node show img-this-norm-pixel
  node out output-color
  link img.value -> cur.image
  link prev.texture -> prevPx.image
  link prevPx.color -> faded.a
  link fade.value -> faded.b
  link cur.color -> keep.a
  link faded.result -> keep.b
  link keep.result -> trail.color
  link trail.texture -> show.image
  link show.color -> out.fragmentValue

Recipes

  • What a pipeline is. ISF Studio files a pipeline by its image inputs: with none it is a generator, with an input-image named inputImage a filter, with startImage and endImage (and a progress float from 0 to 1) a transition. Name the inputs so.
  • Time. isf-time is the seconds since the start (a float). Multiply it by a speed input (math-multiply-float) before a glsl-trigonometry-sin-float or a glsl-common-fract-float, so that the user can change the speed.
  • Coordinates. isf-frag-norm-coord is the position of the pixel from 0 to 1 (a vec2, the origin at the bottom left). Centered: math-subtract-vec2-float with 0.5. With the right aspect: isf-rendersize (the size in pixels, a vec2) -> split-vec2, math-divide-float for x / y, multiply the centered x by it (math-multiply-float), and compose-vec2 the two back. The distance to the center is glsl-vector-length-vec2. The snippet space-and-camera/coordinates/centered-aspect-uv (uv and viewportSize, the isf-rendersize) does all of that in one node: use it, and multiply by 2 for coordinates from -1 to 1 in height.
  • A soft edge. glsl-common-smoothstep-float-float-float takes the two edges at a and b and the value at c. Its result is the amount of a glsl-common-mix-vec4-vec4-float between two colors.
  • Colors are vec4 (input-color, output-color). To make one from a vec3 use convert-vec3-vec4 (w is the alpha, 1 for opaque).
  • Few nodes. Look in the snippets before writing a chain of arithmetic nodes: there is one for centered coordinates, for repeating or tiling a space, for a palette, a hash, a rotation, a glow. A formula of more than four or five operations is one snippet written with its own code (one GLSL function, see the data of a snippet node), not a chain of math-* nodes: a pipeline of a hundred nodes is hard to read and to change.
  • Inside a loop. A snippet node and the constant nodes (value-float, value-vec3…) sit in the body of the loop and are called there: do not pass a function in through a loop-input to call it. Only what comes from outside the loop (an input of the pipeline, the result of another node) goes in through a loop-input; what changes from one turn to the next goes out through the loop-output of the same "pairId".
  • Controls. Every input-* is a control of the window: give it a NAME in camelCase, a DEFAULT, and a MIN and MAX for a float. A long input is a menu: it needs VALUES (the whole numbers) and LABELS (their names, same count), or it shows nothing. A pipeline with no input has nothing to adjust.
  • Check the types. A float and a vec2 are not joined directly: take the node whose name says both (math-multiply-vec2-float), or convert. When a link is refused the error says why: write the pipeline again with it fixed.

What the text does not tell

Coordinates, internal ids, the code of a snippet of the library, a shader or a sub-pipeline (only where to find it), the bytes of an image. The code of a snippet of your own is in the text. A node that does not appear in the text does not exist.