[{"data":1,"prerenderedAt":414,"buildId":415},["ShallowReactive",2],{"doc-\u002Fdocs\u002Fprimitives\u002Finputs-passes\u002Fpass":3,"github-stars":322,"guide-nav":324},{"id":4,"title":5,"body":6,"categoryId":306,"categorySlug":307,"categoryTitle":308,"curated":309,"description":310,"editUrl":311,"extension":312,"group":223,"groupTitle":313,"kind":314,"meta":315,"navigation":316,"path":317,"seo":318,"sourceUrl":319,"stem":320,"wordCount":311,"__hash__":321},"primitives\u002Fdocs\u002Fprimitives\u002F39.inputs-passes\u002F3.pass.md","pass",{"type":7,"value":8,"toc":301},"minimark",[9,12,21,79,88,132,150,155,210,214,270,274,297],[10,11,5],"h1",{"id":5},[13,14,15,16,20],"p",{},"Your own WGSL, rendered into a texture every frame before the body runs, read by name: ",[17,18,19],"code",{},"clouds(uv)",".",[22,23,28],"pre",{"className":24,"code":25,"language":26,"meta":27,"style":27},"language-ts shiki shiki-themes github-dark","pass(\n  body: WgslBody | string,\n  opts: {scale?: number; format?: PassFormat} = {},\n): PassInput\n","ts","",[17,29,30,42,55,73],{"__ignoreMap":27},[31,32,35,38],"span",{"class":33,"line":34},"line",1,[31,36,5],{"class":37},"svObZ",[31,39,41],{"class":40},"s95oV","(\n",[31,43,45,48,52],{"class":33,"line":44},2,[31,46,47],{"class":40},"  body: WgslBody ",[31,49,51],{"class":50},"snl16","|",[31,53,54],{"class":40}," string,\n",[31,56,58,61,64,67,70],{"class":33,"line":57},3,[31,59,60],{"class":40},"  opts: {scale?: number; format",[31,62,63],{"class":50},"?:",[31,65,66],{"class":40}," PassFormat} ",[31,68,69],{"class":50},"=",[31,71,72],{"class":40}," {},\n",[31,74,76],{"class":33,"line":75},4,[31,77,78],{"class":40},"): PassInput\n",[13,80,81,82,84,85,20],{},"Import ",[17,83,5],{}," from ",[17,86,87],{},"shaders\u002Fstd",[13,89,90,91,94,95,98,99,102,103,106,107,98,110,113,114,117,118,121,122,125,126,129,130,20],{},"The body is like a ",[17,92,93],{},"paint:"," body (it gets ",[17,96,97],{},"uv",", ",[17,100,101],{},"time",", props, other inputs, library functions, and returns a ",[17,104,105],{},"vec4f","), but it runs in a compute pass: no ",[17,108,109],{},"dpdx",[17,111,112],{},"fwidth"," or ",[17,115,116],{},"discard",", and ",[17,119,120],{},"textureSample"," becomes ",[17,123,124],{},"textureSampleLevel"," for you. Reading ",[17,127,128],{},"child"," gives the layer inside at this ",[17,131,97],{},[13,133,134,137,138,141,142,145,146,149],{},[17,135,136],{},"scale"," renders at a fraction of the canvas (0.5 is a quarter of the pixels). Use it for expensive work that is smooth anyway: volumetric clouds, a soft height field. ",[17,139,140],{},"targetSize"," (vec2f) is this pass's own size in pixels; use it, not ",[17,143,144],{},"viewport",", for anything measured in pixels here (one pixel is ",[17,147,148],{},"1.0 \u002F targetSize.y"," in uv).",[151,152,154],"h2",{"id":153},"parameters","Parameters",[156,157,158,174],"table",{},[159,160,161],"thead",{},[162,163,164,168,171],"tr",{},[165,166,167],"th",{},"Name",[165,169,170],{},"Type",[165,172,173],{},"Notes",[175,176,177,192],"tbody",{},[162,178,179,185,190],{},[180,181,182],"td",{},[17,183,184],{},"body",[180,186,187],{},[17,188,189],{},"WgslBody | string",[180,191],{},[162,193,194,199,204],{},[180,195,196],{},[17,197,198],{},"opts",[180,200,201],{},[17,202,203],{},"{scale?: number; format?: PassFormat}",[180,205,206,207,20],{},"Optional. Default ",[17,208,209],{},"{}",[151,211,213],{"id":212},"example","Example",[22,215,217],{"className":24,"code":216,"language":26,"meta":27,"style":27},"inputs: {clouds: pass(wgsl`return marchClouds(uv, time);`, {scale: 0.5})},\npaint: wgsl`return clouds(uv);`,\n",[17,218,219,255],{"__ignoreMap":27},[31,220,221,224,227,230,233,235,238,241,245,248,252],{"class":33,"line":34},[31,222,223],{"class":37},"inputs",[31,225,226],{"class":40},": {",[31,228,229],{"class":37},"clouds",[31,231,232],{"class":40},": ",[31,234,5],{"class":37},[31,236,237],{"class":40},"(",[31,239,240],{"class":37},"wgsl",[31,242,244],{"class":243},"sU2Wk","`return marchClouds(uv, time);`",[31,246,247],{"class":40},", {scale: ",[31,249,251],{"class":250},"sDLfK","0.5",[31,253,254],{"class":40},"})},\n",[31,256,257,260,262,264,267],{"class":33,"line":44},[31,258,259],{"class":37},"paint",[31,261,232],{"class":40},[31,263,240],{"class":37},[31,265,266],{"class":243},"`return clouds(uv);`",[31,268,269],{"class":40},",\n",[151,271,273],{"id":272},"see-also","See also",[275,276,277,288],"ul",{},[278,279,280,287],"li",{},[281,282,284],"a",{"href":283},"\u002Fdocs\u002Fprimitives\u002Finputs-passes\u002Fdownsample",[17,285,286],{},"downsample"," — A smaller copy of a source, box-filtered so it does not alias.",[278,289,290,296],{},[281,291,293],{"href":292},"\u002Fdocs\u002Fprimitives\u002Finputs-history\u002Fpreviousframe",[17,294,295],{},"previousFrame"," — This layer's own output from an earlier frame.",[298,299,300],"style",{},"html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}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 pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}",{"title":27,"searchDepth":44,"depth":44,"links":302},[303,304,305],{"id":153,"depth":44,"text":154},{"id":212,"depth":44,"text":213},{"id":272,"depth":44,"text":273},"inputs.passes","inputs-passes","Passes",false,"Your own WGSL, rendered into a texture every frame before the body runs, read by name: `clouds(uv)`.",null,"md","Inputs","function",{},true,"\u002Fdocs\u002Fprimitives\u002Finputs-passes\u002Fpass",{"title":5,"description":310},"https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fsrc\u002Fstd\u002Finputs\u002Fpasses.ts#L48","docs\u002Fprimitives\u002F39.inputs-passes\u002F3.pass","TKSpID8kHV-4BxDuVaJjlG-aBTN8gvkBDbgW6BsxftM",{"stars":323},6080,[325,329,333,337,341,345,349,353,357,361,365,369,373,377,381,385,389,394,398,402,406,410],{"path":326,"title":327,"description":328,"category":17},"\u002Fdocs\u002Fguide","Getting started","Shaders is a desktop app where your AI agent designs interactive effects on an infinite canvas, and you shape them by hand.",{"path":330,"title":331,"description":332,"category":17},"\u002Fdocs\u002Fguide\u002Fquickstart","Quickstart","Install Shaders, render your first effect, and drive a prop from state.",{"path":334,"title":335,"description":336,"category":17},"\u002Fdocs\u002Fguide\u002Fcomposing-effects","Composing effects","Stack components as layers and nest them to control which layers an effect touches.",{"path":338,"title":339,"description":340,"category":17},"\u002Fdocs\u002Fguide\u002Fblending-masking","Blending and masking","Control how a layer mixes with the layers below it, and reveal one layer through another.",{"path":342,"title":343,"description":344,"category":17},"\u002Fdocs\u002Fguide\u002Fprops-reactivity","Props and reactivity","Bind props to your framework's state so effects update when it changes, and animate props with an animation library.",{"path":346,"title":347,"description":348,"category":17},"\u002Fdocs\u002Fguide\u002Fanimation","Animating a shader","Tween a shader's props with Motion, GSAP or anything else that animates a number.",{"path":350,"title":351,"description":352,"category":17},"\u002Fdocs\u002Fguide\u002Fdynamic-props","Dynamic props","Drive any numeric or position prop from time, the cursor, or another layer, without writing animation code.",{"path":354,"title":355,"description":356,"category":17},"\u002Fdocs\u002Fguide\u002Flayout-positioning","Layout and positioning","Size and place a shader in your page with CSS, as a background, a fill, or an inline block.",{"path":358,"title":359,"description":360,"category":17},"\u002Fdocs\u002Fguide\u002Fsizing-and-units","Sizing and units","Size and place layers in CSS units (px, %, vw, rem, and canvas units) that stay correct as the canvas and window resize.",{"path":362,"title":363,"description":364,"category":17},"\u002Fdocs\u002Fguide\u002Ftransforms","Transforms","Position, size, and rotate any layer inside the canvas with a bounding box, in any CSS unit.",{"path":366,"title":367,"description":368,"category":17},"\u002Fdocs\u002Fguide\u002Fshape-effects","Shape effects","Pick the 2D, 3D or custom SVG shape that Glass, Neon, Emboss and other shape effects draw inside.",{"path":370,"title":371,"description":372,"category":17},"\u002Fdocs\u002Fguide\u002Fcolor-space","Color space","Match colors to your design tool with the output color space, and keep bright layers from clipping with tone mapping.",{"path":374,"title":375,"description":376,"category":17},"\u002Fdocs\u002Fguide\u002Fhooks-events","Hooks and events","Run code when an effect is ready to show, and show a fallback when the GPU can't run it.",{"path":378,"title":379,"description":380,"category":17},"\u002Fdocs\u002Fguide\u002Fperformance","Performance","Learn what makes an effect expensive on the GPU and how to keep it inside the frame budget.",{"path":382,"title":383,"description":384,"category":17},"\u002Fdocs\u002Fguide\u002Fcustom-shaders","Custom components","Write your own component in TypeScript, use it like any component in the library, and write WGSL by hand when you need to.",{"path":386,"title":387,"description":388,"category":17},"\u002Fdocs\u002Fguide\u002Ftelemetry","Telemetry","The `\u003CShader>` component occasionally sends an anonymous performance report to help us improve the engine over time.",{"path":390,"title":391,"description":392,"category":393},"\u002Fdocs\u002Fguide\u002Fmcp","Working with your agent","The Shaders MCP connects your AI agent to the desktop app, so it can design shaders on your canvas and install them in your project.","workflows",{"path":395,"title":396,"description":397,"category":393},"\u002Fdocs\u002Fguide\u002Fcli","Working with the CLI","The Shaders CLI installs shaders from your projects and the Pro library into your codebase as component files, and keeps them in sync as you keep designing.",{"path":399,"title":400,"description":401,"category":393},"\u002Fdocs\u002Fguide\u002Fframeworks","Supported frameworks","Shaders runs in any web project that renders in a browser with WebGPU, with components for React, Vue, Svelte and Solid and a JavaScript API for everything else.",{"path":403,"title":404,"description":405,"category":17},"\u002Fdocs\u002Fguide\u002Fagent-skill","Agent skill for the engine","Teach your coding agent to write Shaders code with the open-source engine, for when it's working in your codebase instead of on the canvas.",{"path":407,"title":408,"description":409,"category":17},"\u002Fdocs\u002Fguide\u002Fvideo-rendering","Rendering to video","Render a shader effect to video frame by frame, from Remotion, Hyperframes or your own headless Chrome script.",{"path":411,"title":412,"description":413,"category":17},"\u002Fdocs\u002Fguide\u002Fssr","Server rendering","Render Shaders in Next.js, Nuxt, SvelteKit, SolidStart and other SSR apps by keeping each shader on the client.",1796051186025,"06e02370-81a6-4d74-9931-661d71414be1"]