[{"data":1,"prerenderedAt":1412},["ShallowReactive",2],{"navigation_docs":3,"-pipelines-snippets-and-toolbox":271,"-pipelines-snippets-and-toolbox-surround":1407},[4,35,70,120,154,183,217,246,261],{"title":5,"path":6,"stem":7,"children":8,"page":34},"Getting started","\u002Fgetting-started","1.getting-started",[9,14,19,24,29],{"title":10,"path":11,"stem":12,"icon":13},"What is ISF Studio","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction","i-lucide-house",{"title":15,"path":16,"stem":17,"icon":18},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation","i-lucide-download",{"title":20,"path":21,"stem":22,"icon":23},"Your first shader","\u002Fgetting-started\u002Ffirst-shader","1.getting-started\u002F3.first-shader","i-lucide-code-2",{"title":25,"path":26,"stem":27,"icon":28},"Your first pipeline","\u002Fgetting-started\u002Ffirst-pipeline","1.getting-started\u002F4.first-pipeline","i-lucide-workflow",{"title":30,"path":31,"stem":32,"icon":33},"Interface tour","\u002Fgetting-started\u002Finterface-tour","1.getting-started\u002F5.interface-tour","i-lucide-layout-panel-left",false,{"title":36,"path":37,"stem":38,"children":39,"page":34},"Library","\u002Flibrary","2.library",[40,45,50,55,60,65],{"title":41,"path":42,"stem":43,"icon":44},"The explorer","\u002Flibrary\u002Fexplorer","2.library\u002F1.explorer","i-lucide-folder-tree",{"title":46,"path":47,"stem":48,"icon":49},"Organizing files","\u002Flibrary\u002Forganizing-files","2.library\u002F2.organizing-files","i-lucide-files",{"title":51,"path":52,"stem":53,"icon":54},"Images and gallery","\u002Flibrary\u002Fimages-and-gallery","2.library\u002F3.images-and-gallery","i-lucide-image",{"title":56,"path":57,"stem":58,"icon":59},"Sharing","\u002Flibrary\u002Fsharing","2.library\u002F4.sharing","i-lucide-package",{"title":61,"path":62,"stem":63,"icon":64},"Installing in software","\u002Flibrary\u002Finstalling-in-software","2.library\u002F5.installing-in-software","i-lucide-folder-input",{"title":66,"path":67,"stem":68,"icon":69},"OpenFX plug-ins","\u002Flibrary\u002Fopenfx-plugins","2.library\u002F6.openfx-plugins","i-lucide-plug",{"title":71,"path":72,"stem":73,"children":74,"page":34},"Shaders","\u002Fshaders","3.shaders",[75,80,85,90,95,100,105,110,115],{"title":76,"path":77,"stem":78,"icon":79},"The code editor","\u002Fshaders\u002Fcode-editor","3.shaders\u002F1.code-editor","i-lucide-square-code",{"title":81,"path":82,"stem":83,"icon":84},"The ISF header","\u002Fshaders\u002Fisf-header","3.shaders\u002F2.isf-header","i-lucide-braces",{"title":86,"path":87,"stem":88,"icon":89},"The preview","\u002Fshaders\u002Fpreview","3.shaders\u002F3.preview","i-lucide-monitor-play",{"title":91,"path":92,"stem":93,"icon":94},"Input controls","\u002Fshaders\u002Finput-controls","3.shaders\u002F4.input-controls","i-lucide-sliders-horizontal",{"title":96,"path":97,"stem":98,"icon":99},"Presets","\u002Fshaders\u002Fpresets","3.shaders\u002F5.presets","i-lucide-bookmark",{"title":101,"path":102,"stem":103,"icon":104},"Console and fixes","\u002Fshaders\u002Fconsole","3.shaders\u002F6.console","i-lucide-terminal",{"title":106,"path":107,"stem":108,"icon":109},"Shader templates","\u002Fshaders\u002Ftemplates","3.shaders\u002F7.templates","i-lucide-layout-template",{"title":111,"path":112,"stem":113,"icon":114},"Vertex shaders","\u002Fshaders\u002Fvertex-shaders","3.shaders\u002F8.vertex-shaders","i-lucide-shapes",{"title":116,"path":117,"stem":118,"icon":119},"Font images","\u002Fshaders\u002Ffont-images","3.shaders\u002F9.font-images","i-lucide-type",{"title":121,"path":122,"stem":123,"children":124,"page":34},"Pipelines","\u002Fpipelines","4.pipelines",[125,129,134,139,144,149],{"title":126,"path":127,"stem":128,"icon":28},"Concepts","\u002Fpipelines\u002Fconcepts","4.pipelines\u002F1.concepts",{"title":130,"path":131,"stem":132,"icon":133},"Editing a graph","\u002Fpipelines\u002Fediting-graphs","4.pipelines\u002F2.editing-graphs","i-lucide-mouse-pointer-click",{"title":135,"path":136,"stem":137,"icon":138},"Node catalog","\u002Fpipelines\u002Fnode-catalog","4.pipelines\u002F3.node-catalog","i-lucide-boxes",{"title":140,"path":141,"stem":142,"icon":143},"Toolbox and snippets","\u002Fpipelines\u002Fsnippets-and-toolbox","4.pipelines\u002F4.snippets-and-toolbox","i-lucide-toolbox",{"title":145,"path":146,"stem":147,"icon":148},"Composing","\u002Fpipelines\u002Fcomposing","4.pipelines\u002F5.composing","i-lucide-combine",{"title":150,"path":151,"stem":152,"icon":153},"Macros","\u002Fpipelines\u002Fmacros","4.pipelines\u002F6.macros","i-lucide-package-plus",{"title":155,"path":156,"stem":157,"children":158,"page":34},"Media and inputs","\u002Fmedia","5.media",[159,164,168,173,178],{"title":160,"path":161,"stem":162,"icon":163},"Resources","\u002Fmedia\u002Fresources","5.media\u002F1.resources","i-lucide-clapperboard",{"title":165,"path":166,"stem":167,"icon":163},"Export a video","\u002Fmedia\u002Fvideo-export","5.media\u002F2.video-export",{"title":169,"path":170,"stem":171,"icon":172},"Videos and sounds","\u002Fmedia\u002Fvideos-and-sounds","5.media\u002F3.videos-and-sounds","i-lucide-audio-lines",{"title":174,"path":175,"stem":176,"icon":177},"MIDI","\u002Fmedia\u002Fmidi","5.media\u002F4.midi","i-lucide-sliders-vertical",{"title":179,"path":180,"stem":181,"icon":182},"OSC","\u002Fmedia\u002Fosc","5.media\u002F5.osc","i-lucide-radio-tower",{"title":184,"path":185,"stem":186,"children":187,"page":34},"Workspace","\u002Fworkspace","6.workspace",[188,193,198,203,208,213],{"title":189,"path":190,"stem":191,"icon":192},"Tabs and layout","\u002Fworkspace\u002Ftabs-and-layout","6.workspace\u002F1.tabs-and-layout","i-lucide-columns-2",{"title":194,"path":195,"stem":196,"icon":197},"History and clipboard","\u002Fworkspace\u002Fhistory-and-clipboard","6.workspace\u002F2.history-and-clipboard","i-lucide-history",{"title":199,"path":200,"stem":201,"icon":202},"Saving and drafts","\u002Fworkspace\u002Fsaving","6.workspace\u002F3.saving","i-lucide-save",{"title":204,"path":205,"stem":206,"icon":207},"Shortcuts","\u002Fworkspace\u002Fshortcuts","6.workspace\u002F4.shortcuts","i-lucide-keyboard",{"title":209,"path":210,"stem":211,"icon":212},"Preferences","\u002Fworkspace\u002Fpreferences","6.workspace\u002F5.preferences","i-lucide-settings",{"title":56,"path":214,"stem":215,"icon":216},"\u002Fworkspace\u002Fsharing","6.workspace\u002F6.sharing","i-lucide-share-2",{"title":218,"path":219,"stem":220,"children":221,"page":34},"Reference","\u002Freference","7.reference",[222,226,231,236,241],{"title":223,"path":224,"stem":225,"icon":84},"ISF header","\u002Freference\u002Fisf-header-reference","7.reference\u002F1.isf-header-reference",{"title":227,"path":228,"stem":229,"icon":230},"File formats","\u002Freference\u002Ffile-formats","7.reference\u002F2.file-formats","i-lucide-file-archive",{"title":232,"path":233,"stem":234,"icon":235},"Troubleshooting","\u002Freference\u002Ftroubleshooting","7.reference\u002F3.troubleshooting","i-lucide-life-buoy",{"title":237,"path":238,"stem":239,"icon":240},"ISF specifications","\u002Freference\u002Fisf-specifications","7.reference\u002F4.isf-specifications","i-lucide-book-marked",{"title":242,"path":243,"stem":244,"icon":245},"Pipeline text","\u002Freference\u002Fpipeline-text","7.reference\u002F5.pipeline-text","i-lucide-bot-message-square",{"title":247,"path":248,"stem":249,"children":250,"page":34},"For developers","\u002Fruntime","8.runtime",[251,256],{"title":252,"path":253,"stem":254,"icon":255},"Playing pipelines and shaders","\u002Fruntime\u002Fplaying-pipelines","8.runtime\u002F1.playing-pipelines","i-lucide-play",{"title":257,"path":258,"stem":259,"icon":260},"Listening to sound","\u002Fruntime\u002Flistening-to-sound","8.runtime\u002F2.listening-to-sound","i-lucide-audio-waveform",{"title":262,"path":263,"stem":264,"children":265,"page":34},"Licensing","\u002Flicensing","9.licensing",[266],{"title":267,"path":268,"stem":269,"icon":270},"Pricing","\u002Flicensing\u002Fpricing","9.licensing\u002F1.pricing","i-lucide-badge-euro",{"id":272,"title":273,"body":274,"description":1400,"extension":1401,"links":1402,"meta":1403,"navigation":1404,"path":141,"seo":1405,"stem":142,"__hash__":1406},"docs\u002F4.pipelines\u002F4.snippets-and-toolbox.md","Snippets and the Toolbox",{"type":275,"value":276,"toc":1385},"minimark",[277,286,396,404,412,417,420,571,584,588,607,611,618,625,629,647,651,678,743,761,767,774,777,782,834,855,862,866,869,872,875,878,888,910,916,922,926,951,963,999,1011,1025,1046,1050,1079,1205,1211,1216,1240,1371,1381],[278,279,280,281,285],"p",{},"The ",[282,283,284],"strong",{},"Toolbox"," is the second activity in the bar on the left. It holds more than 400 snippets of GLSL, in nine families (a few, such as optical flow, are advanced):",[287,288,289,302],"table",{},[290,291,292],"thead",{},[293,294,295,299],"tr",{},[296,297,298],"th",{},"Family",[296,300,301],{},"What is in it",[303,304,305,316,326,336,346,356,366,376,386],"tbody",{},[293,306,307,313],{},[308,309,310],"td",{},[282,311,312],{},"Shapes",[308,314,315],{},"Signed distance functions in 2D and 3D, the operations that combine them, and what turns a distance into a picture.",[293,317,318,323],{},[308,319,320],{},[282,321,322],{},"Noise & patterns",[308,324,325],{},"Noise of every kind, patterns and terrain.",[293,327,328,333],{},[308,329,330],{},[282,331,332],{},"Color",[308,334,335],{},"Color conversions, the blend modes (by lighten, darken, contrast…) and compositing.",[293,337,338,343],{},[308,339,340],{},[282,341,342],{},"Image & filters",[308,344,345],{},"Sampling, kernels, morphology, edges, anti-aliasing and post-processing.",[293,347,348,353],{},[308,349,350],{},[282,351,352],{},"Space & camera",[308,354,355],{},"Transforms in 2D and 3D, coordinates and camera.",[293,357,358,363],{},[308,359,360],{},[282,361,362],{},"Lighting & 3D",[308,364,365],{},"Lighting, atmosphere, raymarching, and the maps (normal, height, displacement).",[293,367,368,373],{},[308,369,370],{},[282,371,372],{},"Math",[308,374,375],{},"Curves, vectors and the small functions that every shader needs.",[293,377,378,383],{},[308,379,380],{},[282,381,382],{},"Audio & analysis",[308,384,385],{},"Reading sound, optical flow and analysis.",[293,387,388,393],{},[308,389,390],{},[282,391,392],{},"Text & Sprites",[308,394,395],{},"Text rendering and sprite handling.",[278,397,398,399,403],{},"Each family opens into groups, and a pill says how many snippets there are under it. The name of a snippet and the folder it was kept in are both searched: typing ",[400,401,402],"code",{},"sdf"," finds the shapes.",[278,405,406],{},[407,408],"img",{"alt":409,"src":410,"width":411},"The Toolbox","\u002Fscreenshots\u002Ftoolbox.png",236,[413,414,416],"h2",{"id":415},"snippet-or-macro","Snippet or macro?",[278,418,419],{},"The Toolbox keeps two kinds of reusable things, and they are not the same:",[287,421,422,438],{},[290,423,424],{},[293,425,426,428,433],{},[296,427],{},[296,429,430],{},[282,431,432],{},"Snippet",[296,434,435],{},[282,436,437],{},"Macro",[303,439,440,459,479,495,511,533,555],{},[293,441,442,447,453],{},[308,443,444],{},[282,445,446],{},"What it is",[308,448,449,450,452],{},"One GLSL function, with its helpers: ",[282,451,400],{},".",[308,454,455,456,452],{},"A group of nodes of a pipeline: ",[282,457,458],{},"nodes",[293,460,461,466,476],{},[308,462,463],{},[282,464,465],{},"In a pipeline",[308,467,468,469,472,473,452],{},"A node, with the inputs and the output of its function. Its code is shown by ",[282,470,471],{},"Show Code"," and, for one you wrote, changed by ",[282,474,475],{},"Edit Code…",[308,477,478],{},"A group that you open, read and change like any other, with its own inputs and outputs.",[293,480,481,486,492],{},[308,482,483],{},[282,484,485],{},"In a shader",[308,487,488,489,452],{},"Yes: the function is put above ",[400,490,491],{},"main()",[308,493,494],{},"No: a macro is made of nodes, which a shader does not have.",[293,496,497,502,505],{},[308,498,499],{},[282,500,501],{},"Made by",[308,503,504],{},"Nearly 300 come with the app; you write yours (see below).",[308,506,507,508,452],{},"You: select nodes, ",[282,509,510],{},"Create Macro",[293,512,513,518,528],{},[308,514,515],{},[282,516,517],{},"Kept in",[308,519,280,520,523,524,527],{},[282,521,522],{},"Snippets"," and ",[282,525,526],{},"My Snippets"," sections.",[308,529,280,530,532],{},[282,531,150],{}," section.",[293,534,535,540,543],{},[308,536,537],{},[282,538,539],{},"When you change it",[308,541,542],{},"A copy already placed keeps its own code.",[308,544,545,546,549,550,554],{},"The copies ",[282,547,548],{},"follow the macro",": saving it updates them (see ",[551,552,150],"a",{"href":553},"\u002Fpipelines\u002Fmacros#a-macro-and-its-copies",").",[293,556,557,562,565],{},[308,558,559],{},[282,560,561],{},"Shared",[308,563,564],{},"The code is in the pipeline that uses it: nothing else to send.",[308,566,567,568,554],{},"The pipeline carries its copy; to give someone your macros themselves, export a pack (",[400,569,570],{},".istmacro",[278,572,573,574,577,578,581,582,452],{},"A rule of thumb: if you can say it as a ",[282,575,576],{},"formula"," (a noise, a distance, a color conversion), it is a snippet. If it is ",[282,579,580],{},"a way of wiring"," nodes together (a blur with its passes, a correction with its inputs), it is a macro. A macro can hold snippet nodes, so a snippet you wrote can travel inside a macro too. A whole shader or pipeline of your library, used as one node, is something else again: see ",[551,583,145],{"href":146},[413,585,587],{"id":586},"use-one","Use one",[278,589,590,593,594,598,599,602,603,606],{},[282,591,592],{},"Drag"," a snippet from the list onto the shader or the pipeline you have open: while you drag, the editor shows a dashed frame, ",[595,596,597],"em",{},"Drop to add the snippet",". In a shader the snippet is added to the fragment code, as one edit you can undo; in a pipeline it becomes a node. You can also right-click a snippet and choose ",[282,600,601],{},"Add to Shader"," or ",[282,604,605],{},"Add to Pipeline",". The hint at the top of the list says which one the open document takes. A snippet written for a vertex shader is greyed while you edit a fragment one, and the other way round.",[413,608,610],{"id":609},"see-one-at-work","See one at work",[278,612,613,614,617],{},"Right-click a snippet in the list, or its node in a pipeline, and choose ",[282,615,616],{},"Open Example",". The example opens in a tab of its own: a small pipeline that uses the snippet, with notes (comments) beside the nodes that say what each stage is for and what to try. Some snippets that are used together share one example. An example that needs a sound or a moving picture brings one: the audio ones listen to a sample sound, and the ones that follow motion play a sample video, until you plug your own source.",[278,619,620,621,624],{},"An example is a copy to play with: change it, run it, break it. It is not a file, and nothing you do to it changes the example itself. When you close a tab you have changed, ISF Studio asks whether to keep your version, in your library or in any folder (",[282,622,623],{},"Save As","), or to let it go. Opening the example again gives you the original.",[413,626,628],{"id":627},"see-the-code-of-a-node","See the code of a node",[278,630,631,632,634,635,639,640,643,644,646],{},"Right-click the node of a snippet in a pipeline and choose ",[282,633,471],{},". The box is the one a double click on a snippet of the list opens. For a snippet of the library it shows its details too; for a node that has code of its own (the ones you ",[551,636,638],{"href":637},"#write-your-own","write",", or ",[551,641,642],{"href":243},"a pipeline import"," makes), it shows that code, as it is in the pipeline: a snippet you wrote has ",[282,645,475],{}," instead.",[413,648,650],{"id":649},"write-your-own","Write your own",[278,652,653,654,657,658,661,662,665,666,669,670,673,674,677],{},"Right-click the canvas and choose ",[282,655,656],{},"Functions > Snippet…"," (it is in the search field too). A box opens with a function to start from: change it, then press ",[282,659,660],{},"Save"," (",[400,663,664],{},"Cmd+Enter","). The ",[282,667,668],{},"last function"," of the code is the snippet: its parameters are the inputs of the node, its value is the output called ",[400,671,672],{},"result",", and an ",[400,675,676],{},"out"," parameter is one more output. The functions and constants above it are its helpers, and travel with it.",[679,680,685],"pre",{"className":681,"code":682,"language":683,"meta":684,"style":684},"language-glsl shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","float hash12(vec2 p) {\n  return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);\n}\n\nvec4 finishColor(vec3 color, vec2 fragCoord, float grainAmount) {\n  float noise = hash12(fragCoord + fract(TIME) * 61.7) - 0.5;\n  color += noise * 0.05 * grainAmount;\n  return vec4(clamp(color, 0.0, 1.0), 1.0);\n}\n","glsl","",[400,686,687,695,701,707,714,720,726,732,738],{"__ignoreMap":684},[688,689,692],"span",{"class":690,"line":691},"line",1,[688,693,694],{},"float hash12(vec2 p) {\n",[688,696,698],{"class":690,"line":697},2,[688,699,700],{},"  return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);\n",[688,702,704],{"class":690,"line":703},3,[688,705,706],{},"}\n",[688,708,710],{"class":690,"line":709},4,[688,711,713],{"emptyLinePlaceholder":712},true,"\n",[688,715,717],{"class":690,"line":716},5,[688,718,719],{},"vec4 finishColor(vec3 color, vec2 fragCoord, float grainAmount) {\n",[688,721,723],{"class":690,"line":722},6,[688,724,725],{},"  float noise = hash12(fragCoord + fract(TIME) * 61.7) - 0.5;\n",[688,727,729],{"class":690,"line":728},7,[688,730,731],{},"  color += noise * 0.05 * grainAmount;\n",[688,733,735],{"class":690,"line":734},8,[688,736,737],{},"  return vec4(clamp(color, 0.0, 1.0), 1.0);\n",[688,739,741],{"class":690,"line":740},9,[688,742,706],{},[278,744,745,746,749,750,749,753,756,757,760],{},"This one is a node with three inputs (",[400,747,748],{},"color",", ",[400,751,752],{},"fragCoord",[400,754,755],{},"grainAmount",") and one output, and ",[400,758,759],{},"hash12"," is its helper.",[278,762,763,764,766],{},"Right-click the node and choose ",[282,765,475],{}," to change it later. The inputs that are still in the code keep their wires; the ones it no longer has lose them. The box tells you when the code has no function, or when another snippet of the pipeline already has a function of the same name (the helpers too) with other code (a shader has one function of a name). Undo brings the old code back.",[278,768,769,770,773],{},"The code is kept ",[282,771,772],{},"in the pipeline",", so the pipeline works anywhere, with nothing else installed.",[413,775,526],{"id":776},"my-snippets",[278,778,280,779,781],{},[282,780,526],{}," view of the toolbox lists the snippets you kept, the newest first. They belong to your computer, not to a pipeline or a library, and every window sees them. There are three ways to make one:",[783,784,785,819,828],"ul",{},[786,787,788,791,792,795,796,799,800,803,804,807,808,811,812,523,815,818],"li",{},[282,789,790],{},"From a shader."," Select a function (and the helpers above it, if it has some) in the code of a fragment shader, right-click the selection and choose ",[282,793,794],{},"Make a Snippet…",". A box opens with the code and the name of the function; give it a description if you like, and the same details the snippets of ISF Studio have (their sources apart): a ",[282,797,798],{},"Version",", a ",[282,801,802],{},"Credit"," and a ",[282,805,806],{},"License",", all optional, then press ",[282,809,810],{},"Keep",". The credit and the license show under the description in the list, and are written as ",[400,813,814],{},"\u002F\u002F Credit:",[400,816,817],{},"\u002F\u002F License:"," comments above the code when you add the snippet to a shader or a pipeline, as the snippets of ISF Studio do. The entry is greyed out while nothing is selected; if what is selected is not a function, the box says what is wrong and you can put it right there.",[786,820,821,824,825,452],{},[282,822,823],{},"From a pipeline."," Right-click a snippet you wrote and choose ",[282,826,827],{},"Save to My Snippets…",[786,829,830,833],{},[282,831,832],{},"From scratch."," Write one in a pipeline, then save it as above.",[278,835,836,838,839,841,842,602,844,846,847,850,851,854],{},[282,837,592],{}," a snippet of the list onto the code of a shader (the function goes above ",[400,840,491],{},") or onto the canvas of a pipeline (a node with its own code, where you drop it), or right-click it and choose ",[282,843,601],{},[282,845,605],{}," (the node goes in the middle of the canvas). A helper the shader already has, as it is, is not pasted again; adding it to a shader that has a function of the same name with other code is refused with the reason: GLSL has one function of a name. ",[282,848,849],{},"Edit…"," (or a double click) changes it, ",[282,852,853],{},"Delete"," lets it go. Snippets you added to a shader or a pipeline are copies: changing or deleting the kept one does not change them.",[278,856,857,858,861],{},"If a snippet cannot be kept (the code is not a function, the disk cannot be written, you have 500 already), the box stays open and says why. If the file that holds your snippets is damaged, the app puts it aside as ",[400,859,860],{},"my-snippets.v1.json.broken",", next to it in the folder where ISF Studio keeps its data, and starts with an empty list.",[413,863,865],{"id":864},"find-one","Find one",[278,867,868],{},"Type in the search field, or open a category. A snippet shows its code and what it takes and returns.",[413,870,485],{"id":871},"in-a-shader",[278,873,874],{},"Drop a snippet into the code of a shader and it is inserted there.",[413,876,465],{"id":877},"in-a-pipeline",[278,879,880,881,883,884,887],{},"Drop it on the canvas: it becomes a node with a port for each parameter and a ",[400,882,672],{}," port for what it returns. The ",[282,885,886],{},"Usage"," of the node, in the inspector, says how it is used:",[783,889,890,896],{},[786,891,892,895],{},[282,893,894],{},"Call immediately"," (the default): the node calls the function right there, with the values wired into it, and gives the result. This is the direct way.",[786,897,898,901,902,905,906,909],{},[282,899,900],{},"Define a function",": the node only declares the GLSL function, and gives an ",[400,903,904],{},"fn"," port. Wire it to a ",[282,907,908],{},"Call Function"," node, which calls it with its own arguments, wherever and as often as you need. This is the more declarative way: one definition, several calls. The parameters are supplied by the calls, so they cannot be wired on the defined node, and the returned value belongs to the call.",[278,911,912,913,915],{},"Changing the usage removes the connections to the ports that the node no longer has. Inside a function, only ",[282,914,894],{}," is possible, since GLSL has no function inside a function.",[278,917,918],{},[407,919],{"alt":920,"src":921},"The Toolbox open next to a pipeline","\u002Fscreenshots\u002Ftoolbox-pipeline.png",[413,923,925],{"id":924},"shapes-signed-distance-functions","Shapes: signed distance functions",[927,928,929,930,933,934,523,940,945,946,452],"note",{},"A big thank you to ",[282,931,932],{},"Inigo Quilez",". A large part of the SDF snippets comes from his work: for years he has described, derived and shared these distance functions, with clear articles and live examples. To understand how they work, and to find many more, read his articles on ",[551,935,939],{"href":936,"rel":937},"https:\u002F\u002Fiquilezles.org\u002Farticles\u002Fdistfunctions2d\u002F",[938],"nofollow","2D distance functions",[551,941,944],{"href":942,"rel":943},"https:\u002F\u002Fiquilezles.org\u002Farticles\u002Fdistfunctions\u002F",[938],"3D distance functions",", and his other writing at ",[551,947,950],{"href":948,"rel":949},"https:\u002F\u002Fiquilezles.org",[938],"iquilezles.org",[278,952,280,953,955,956,523,959,962],{},[282,954,312],{}," family holds signed distance functions: for a point, they give the distance to a shape, ",[282,957,958],{},"negative inside",[282,960,961],{},"positive outside",". The main groups are:",[783,964,965,974,980,986],{},[786,966,967,970,971,973],{},[282,968,969],{},"2D",": shapes in the plane (circle, boxes, triangles, stars, arcs, heart, ellipse, and more). They take the point ",[400,972,278],{}," of the pixel, centred on the origin, and the size of the shape.",[786,975,976,979],{},[282,977,978],{},"3D",": solids (sphere, box, torus, cones, cylinders, capsules, and more). They take a point in space, for raymarching.",[786,981,982,985],{},[282,983,984],{},"Operations",": combine, round, hollow, blend or displace distances (union, subtraction, intersection and their smooth versions, onion, round, morph, displace, extrude).",[786,987,988,991,992,523,995,998],{},[282,989,990],{},"Rendering",": turn a distance into something visible: ",[282,993,994],{},"Fill Mask",[282,996,997],{},"Stroke Mask",", with anti-aliased edges.",[278,1000,1001,1002,1004,1005,1007,1008,554],{},"Move and scale a shape by changing the point you give it, not the shape itself: subtract a position from ",[400,1003,278],{}," to move it, divide ",[400,1006,278],{}," to scale it (and multiply the distance back, or use ",[282,1009,1010],{},"Scale Distance Correction",[278,1012,1013,1014,1017,1018,523,1021,1024],{},"For a 3D shape from a 2D one, give the 2D distance to ",[282,1015,1016],{},"Shapes > Operations > Extrude",", with ",[400,1019,1020],{},"z",[400,1022,1023],{},"halfDepth",", and raymarch the result. The normals and lighting snippets then shade it.",[278,1026,1027,1028,1030,1031,523,1034,1037,1038,1041,1042,1045],{},"Two other snippets go well with them: ",[282,1029,372],{}," has ",[282,1032,1033],{},"Cubic Bezier Point",[282,1035,1036],{},"Quadratic Bezier Point",", which give the position on a curve at the parameter ",[400,1039,1040],{},"t"," (normally between 0 and 1), and ",[282,1043,1044],{},"Color > Compositing > Depth Over",", which puts the surface with the greater depth in front and gives the nearest depth to the next layer. A transparent sample does not hide what is behind it.",[413,1047,1049],{"id":1048},"maps-normal-height-and-displacement","Maps: normal, height and displacement",[278,1051,280,1052,1055,1056,1058,1059,1062,1063,1066,1067,1070,1071,1074,1075,1078],{},[282,1053,1054],{},"Maps"," group of ",[282,1057,362],{}," holds what a texture artist makes of a surface: a ",[282,1060,1061],{},"height map"," (how high each point is), the ",[282,1064,1065],{},"normal map"," that says which way it faces, a ",[282,1068,1069],{},"displacement"," that moves a picture, and the masks that come from them. They work in ",[282,1072,1073],{},"tangent space",": +Z comes out of the surface, +X goes right and +Y goes up, the OpenGL convention (green up) of Blender, Unity and glTF. ",[282,1076,1077],{},"Flip Normal Green"," turns a map to the DirectX one (Unreal, 3ds Max).",[287,1080,1081,1090],{},[290,1082,1083],{},[293,1084,1085,1088],{},[296,1086,1087],{},"Group",[296,1089,522],{},[303,1091,1092,1117,1150,1175,1188],{},[293,1093,1094,1099],{},[308,1095,1096],{},[282,1097,1098],{},"Height",[308,1100,1101,1104,1105,1108,1109,1112,1113,1116],{},[282,1102,1103],{},"Height From Image"," (the luminance as a height, with contrast and bias), ",[282,1106,1107],{},"Height Gradient"," (the slope, by Sobel), ",[282,1110,1111],{},"Height Ambient Occlusion"," (a hollow is darker) and ",[282,1114,1115],{},"Curvature From Height"," (crests and cavities, signed).",[293,1118,1119,1124],{},[308,1120,1121],{},[282,1122,1123],{},"Normal",[308,1125,1126,1129,1130,1133,1134,523,1137,1140,1141,749,1143,1146,1147,452],{},[282,1127,1128],{},"Normal From Height Map"," (from the red channel of a height texture), ",[282,1131,1132],{},"Tangent Normal From Heights"," (from four heights, when the height is code and not a picture), ",[282,1135,1136],{},"Normal To Color",[282,1138,1139],{},"Color To Normal"," (between -1 to 1 and 0 to 1), ",[282,1142,1077],{},[282,1144,1145],{},"Blend Normals (RNM)"," (the detail of one map on another, reoriented along the base) and ",[282,1148,1149],{},"Normal Strength",[293,1151,1152,1157],{},[308,1153,1154],{},[282,1155,1156],{},"Displacement",[308,1158,1159,1162,1163,1166,1167,1170,1171,1174],{},[282,1160,1161],{},"Displace UV"," (a height moves the coordinates), ",[282,1164,1165],{},"Normal Offset UV"," (a cheap refraction), ",[282,1168,1169],{},"Parallax Offset"," (a flat picture with depth) and ",[282,1172,1173],{},"Parallax Occlusion UV"," (a ray marched through the height field, up to 64 layers).",[293,1176,1177,1182],{},[308,1178,1179],{},[282,1180,1181],{},"Mask",[308,1183,1184,1187],{},[282,1185,1186],{},"Slope Mask"," (steep parts from the normal: rock on slopes, snow on flats).",[293,1189,1190,1195],{},[308,1191,1192],{},[282,1193,1194],{},"Depth",[308,1196,1197,1200,1201,1204],{},[282,1198,1199],{},"Linearize Depth"," (a depth buffer value as a distance) and ",[282,1202,1203],{},"Depth To Unit"," (a distance as a 0 to 1 depth map).",[278,1206,1207,1210],{},[282,1208,1209],{},"Strength"," in the normal snippets is how many pixels tall a height of 1 is: at 1 the relief is gentle, at 32 it is deep, and at 63 on a 64-pixel ramp it is a slope of 45 degrees.",[1212,1213,1215],"h3",{"id":1214},"a-normal-map-from-a-height-as-a-file","A normal map from a height, as a file",[278,1217,1218,1219,1222,1223,1227,1228,1231,1232,1235,1236,1239],{},"A height is drawn in a first pass, kept in a ",[282,1220,1221],{},"float"," target, and a second pass turns it into a normal. The preview shows it as colors (a normal has negative numbers, which the screen draws as black), and the ",[551,1224,1226],{"href":1225},"\u002Fshaders\u002Fpreview#floating-point-pictures","snapshot"," as an ",[282,1229,1230],{},"OpenEXR 32-bit float"," with ",[282,1233,1234],{},"Values"," set to ",[282,1237,1238],{},"As drawn"," keeps the normal as it is, from -1 to 1.",[679,1241,1243],{"className":681,"code":1242,"language":683,"meta":684,"style":684},"\u002F*{\n  \"DESCRIPTION\": \"A normal map of a height\",\n  \"ISFVSN\": \"2.0\",\n  \"CATEGORIES\": [\"Generator\"],\n  \"INPUTS\": [\n    { \"NAME\": \"strength\", \"TYPE\": \"float\", \"DEFAULT\": 24.0, \"MIN\": 0.0, \"MAX\": 64.0 }\n  ],\n  \"PASSES\": [ { \"TARGET\": \"height\", \"FLOAT\": true }, { } ]\n}*\u002F\n\n\u002F\u002F Toolbox: Lighting & 3D > Maps > Height > Height Gradient, Lighting & 3D > Maps > Normal > Normal From Height Map\n\u002F\u002F (drop them above main, or onto the canvas of a pipeline).\n\nvoid main() {\n  if (PASSINDEX == 0) {\n    \u002F\u002F Any height will do: here, a field of bumps. For a picture, use Height From Image.\n    vec2 p = isf_FragNormCoord * 6.0;\n    float h = 0.5 + 0.5 * sin(p.x * 3.14159) * sin(p.y * 3.14159);\n    gl_FragColor = vec4(vec3(h), 1.0);\n  } else {\n    gl_FragColor = vec4(normalFromHeightMap(height, isf_FragNormCoord, RENDERSIZE, strength), 1.0);\n  }\n}\n",[400,1244,1245,1250,1255,1260,1265,1270,1275,1280,1285,1290,1295,1301,1307,1312,1318,1324,1330,1336,1342,1348,1354,1360,1366],{"__ignoreMap":684},[688,1246,1247],{"class":690,"line":691},[688,1248,1249],{},"\u002F*{\n",[688,1251,1252],{"class":690,"line":697},[688,1253,1254],{},"  \"DESCRIPTION\": \"A normal map of a height\",\n",[688,1256,1257],{"class":690,"line":703},[688,1258,1259],{},"  \"ISFVSN\": \"2.0\",\n",[688,1261,1262],{"class":690,"line":709},[688,1263,1264],{},"  \"CATEGORIES\": [\"Generator\"],\n",[688,1266,1267],{"class":690,"line":716},[688,1268,1269],{},"  \"INPUTS\": [\n",[688,1271,1272],{"class":690,"line":722},[688,1273,1274],{},"    { \"NAME\": \"strength\", \"TYPE\": \"float\", \"DEFAULT\": 24.0, \"MIN\": 0.0, \"MAX\": 64.0 }\n",[688,1276,1277],{"class":690,"line":728},[688,1278,1279],{},"  ],\n",[688,1281,1282],{"class":690,"line":734},[688,1283,1284],{},"  \"PASSES\": [ { \"TARGET\": \"height\", \"FLOAT\": true }, { } ]\n",[688,1286,1287],{"class":690,"line":740},[688,1288,1289],{},"}*\u002F\n",[688,1291,1293],{"class":690,"line":1292},10,[688,1294,713],{"emptyLinePlaceholder":712},[688,1296,1298],{"class":690,"line":1297},11,[688,1299,1300],{},"\u002F\u002F Toolbox: Lighting & 3D > Maps > Height > Height Gradient, Lighting & 3D > Maps > Normal > Normal From Height Map\n",[688,1302,1304],{"class":690,"line":1303},12,[688,1305,1306],{},"\u002F\u002F (drop them above main, or onto the canvas of a pipeline).\n",[688,1308,1310],{"class":690,"line":1309},13,[688,1311,713],{"emptyLinePlaceholder":712},[688,1313,1315],{"class":690,"line":1314},14,[688,1316,1317],{},"void main() {\n",[688,1319,1321],{"class":690,"line":1320},15,[688,1322,1323],{},"  if (PASSINDEX == 0) {\n",[688,1325,1327],{"class":690,"line":1326},16,[688,1328,1329],{},"    \u002F\u002F Any height will do: here, a field of bumps. For a picture, use Height From Image.\n",[688,1331,1333],{"class":690,"line":1332},17,[688,1334,1335],{},"    vec2 p = isf_FragNormCoord * 6.0;\n",[688,1337,1339],{"class":690,"line":1338},18,[688,1340,1341],{},"    float h = 0.5 + 0.5 * sin(p.x * 3.14159) * sin(p.y * 3.14159);\n",[688,1343,1345],{"class":690,"line":1344},19,[688,1346,1347],{},"    gl_FragColor = vec4(vec3(h), 1.0);\n",[688,1349,1351],{"class":690,"line":1350},20,[688,1352,1353],{},"  } else {\n",[688,1355,1357],{"class":690,"line":1356},21,[688,1358,1359],{},"    gl_FragColor = vec4(normalFromHeightMap(height, isf_FragNormCoord, RENDERSIZE, strength), 1.0);\n",[688,1361,1363],{"class":690,"line":1362},22,[688,1364,1365],{},"  }\n",[688,1367,1369],{"class":690,"line":1368},23,[688,1370,706],{},[278,1372,1373,1374,1376,1377,1380],{},"The same two passes make a ",[282,1375,1069],{}," or a ",[282,1378,1379],{},"height"," file: write the height in the last pass, and save it as a 32-bit float so that no step shows when the engine reads it.",[1382,1383,1384],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":684,"searchDepth":697,"depth":697,"links":1386},[1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397],{"id":415,"depth":697,"text":416},{"id":586,"depth":697,"text":587},{"id":609,"depth":697,"text":610},{"id":627,"depth":697,"text":628},{"id":649,"depth":697,"text":650},{"id":776,"depth":697,"text":526},{"id":864,"depth":697,"text":865},{"id":871,"depth":697,"text":485},{"id":877,"depth":697,"text":465},{"id":924,"depth":697,"text":925},{"id":1048,"depth":697,"text":1049,"children":1398},[1399],{"id":1214,"depth":703,"text":1215},"Reusable GLSL, as code or as nodes.","md",null,{},{"icon":143,"title":140},{"title":273,"description":1400},"GsJnS7E5IK55hsEYOjk8_ppr0An5_gJ8CE6G9W_t32M",[1408,1410],{"title":135,"path":136,"stem":137,"description":1409,"icon":138,"children":-1},"The categories of nodes that ISF Studio ships with.",{"title":145,"path":146,"stem":147,"description":1411,"icon":148,"children":-1},"Reuse your library inside a graph.",1796047425738]