[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"github-stars":3,"guide-nav":5,"doc-\u002Fdocs\u002Fprimitives\u002Fmaterials\u002Fshapedsurface":129},{"stars":4},5507,[6,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,72,76,80,84,88,93,97,101,105,109,113,117,121,125],{"path":7,"title":8,"description":9,"category":10},"\u002Fdocs\u002Fguide","Getting started","Shaders is a library of GPU effect components for Vue, React, Svelte, Solid, JavaScript and Framer, with a design editor for building with them.","code",{"path":12,"title":13,"description":14,"category":10},"\u002Fdocs\u002Fguide\u002Fquickstart","Quickstart","Install Shaders, render your first effect, and drive a prop from state.",{"path":16,"title":17,"description":18,"category":10},"\u002Fdocs\u002Fguide\u002Fcomposing-effects","Composing effects","Stack components as layers and nest them to control which layers an effect touches.",{"path":20,"title":21,"description":22,"category":10},"\u002Fdocs\u002Fguide\u002Fblending-masking","Blending and masking","Control how a layer mixes with the layers below it, and reveal one layer through another.",{"path":24,"title":25,"description":26,"category":10},"\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":28,"title":29,"description":30,"category":10},"\u002Fdocs\u002Fguide\u002Fdynamic-props","Dynamic props","Drive any numeric or position prop from time, the cursor, or another layer, without writing animation code.",{"path":32,"title":33,"description":34,"category":10},"\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":36,"title":37,"description":38,"category":10},"\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":40,"title":41,"description":42,"category":10},"\u002Fdocs\u002Fguide\u002Ftransforms","Transforms","Position, size, and rotate any layer inside the canvas with a bounding box, in any CSS unit.",{"path":44,"title":45,"description":46,"category":10},"\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":48,"title":49,"description":50,"category":10},"\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":52,"title":53,"description":54,"category":10},"\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":56,"title":57,"description":58,"category":10},"\u002Fdocs\u002Fguide\u002Fperformance","Performance","Learn what makes an effect expensive on the GPU and how to keep it inside the frame budget.",{"path":60,"title":61,"description":62,"category":10},"\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":64,"title":65,"description":66,"category":10},"\u002Fdocs\u002Fguide\u002Ftelemetry","Telemetry","The `\u003CShader>` component occasionally sends an anonymous performance report to help us improve the engine over time.",{"path":68,"title":69,"description":70,"category":71},"\u002Fdocs\u002Fguide\u002Fmcp","Shaders MCP","Connect your AI coding agent to Shaders so it can find, install and edit effects in your codebase.","workflows",{"path":73,"title":74,"description":75,"category":71},"\u002Fdocs\u002Fguide\u002Fcli","Shaders CLI","Install your own shaders and Pro shaders into your codebase as component files, and keep them in sync with the design editor.",{"path":77,"title":78,"description":79,"category":71},"\u002Fdocs\u002Fguide\u002Fagent-skill","Agent skill","Give your coding agent a skill that teaches it to build with Shaders components, the CLI and Pro shaders.",{"path":81,"title":82,"description":83,"category":10},"\u002Fdocs\u002Fguide\u002Fvideo-rendering","Rendering to video","Turn a shader effect into a video file, from the design editor or from a frame-by-frame pipeline such as Remotion, Hyperframes or Puppeteer.",{"path":85,"title":86,"description":87,"category":10},"\u002Fdocs\u002Fguide\u002Fssr","Server rendering","Render Shaders in Next.js, Nuxt, SvelteKit, SolidStart and other SSR apps by keeping each shader on the client.",{"path":89,"title":90,"description":91,"category":92},"\u002Fdocs\u002Fguide\u002Fquick-tour-of-the-design-editor","Quick tour of the design editor","A short walkthrough of the full Shaders workflow, from designing on the infinite canvas to exporting code.","editor",{"path":94,"title":95,"description":96,"category":92},"\u002Fdocs\u002Fguide\u002Fintro-to-the-interface","Intro to the interface","A tour of the design editor interface: the canvas, layers, the Properties panel, and the ways to share and export.",{"path":98,"title":99,"description":100,"category":92},"\u002Fdocs\u002Fguide\u002Fcomposing-your-first-shader-effect","Composing your first shader effect","Building a first shader effect in the design editor by stacking and nesting components as layers.",{"path":102,"title":103,"description":104,"category":92},"\u002Fdocs\u002Fguide\u002Fmasking-and-blending","Masking and blending","How blend modes and masks combine components in the design editor.",{"path":106,"title":107,"description":108,"category":92},"\u002Fdocs\u002Fguide\u002Fdynamic-prop-mapping","Dynamic prop mapping","Turning static props into dynamic ones in the design editor: mapping one layer's output into another's prop, following the cursor, or animating automatically.",{"path":110,"title":111,"description":112,"category":92},"\u002Fdocs\u002Fguide\u002Fcustom-media-and-transformations","Custom media and transformations","Uploading images, videos, and SVG files to the media gallery, adding them to a composition, and placing them with transformations.",{"path":114,"title":115,"description":116,"category":92},"\u002Fdocs\u002Fguide\u002Finstalling-a-shader-via-mcp","Installing a shader via MCP","Installing a shader from the design editor into a hero section with the Shaders MCP.",{"path":118,"title":119,"description":120,"category":92},"\u002Fdocs\u002Fguide\u002Fexploring-shape-effects","Exploring shape effects","Applying shape effects such as liquid glass, liquid metal, and glowing edges to built-in shapes and your own SVG.",{"path":122,"title":123,"description":124,"category":92},"\u002Fdocs\u002Fguide\u002Fglass-component-spotlight","Component spotlight: Glass","A short look at the Glass component and the liquid-glass look it creates.",{"path":126,"title":127,"description":128,"category":92},"\u002Fdocs\u002Fguide\u002Fdigital-looks-component-spotlight","Component spotlight: Digital looks","A look at the digital stylization components for glitchy, futuristic, or technical effects.",{"id":130,"title":131,"body":132,"categoryId":169,"categorySlug":169,"categoryTitle":657,"curated":658,"description":142,"editUrl":659,"extension":660,"group":661,"groupTitle":662,"kind":663,"meta":664,"navigation":665,"path":666,"seo":667,"sourceUrl":668,"stem":669,"wordCount":659,"__hash__":670},"primitives\u002Fdocs\u002Fprimitives\u002F14.materials\u002F1.shapedsurface.md","shapedSurface",{"type":133,"value":134,"toc":651},"minimark",[135,139,143,164,179,205,210,247,251,498,519,523,561,565,647],[136,137,131],"h1",{"id":138},"shapedsurface",[140,141,142],"p",{},"Turns a shape prop into a surface your material shades.",[144,145,150],"pre",{"className":146,"code":147,"language":148,"meta":149,"style":149},"language-ts shiki shiki-themes github-dark","shapedSurface(spec: ShapedSurfaceSpec): ShapedSurfaceEffect\n","ts","",[10,151,152],{"__ignoreMap":149},[153,154,157,160],"span",{"class":155,"line":156},"line",1,[153,158,131],{"class":159},"svObZ",[153,161,163],{"class":162},"s95oV","(spec: ShapedSurfaceSpec): ShapedSurfaceEffect\n",[140,165,166,167,170,171,174,175,178],{},"Import ",[10,168,169],{},"materials"," from ",[10,172,173],{},"shaders\u002Fstd"," and use ",[10,176,177],{},"materials.shapedSurface",".",[140,180,181,182,185,186,185,189,192,193,196,197,200,201,204],{},"Spread the result into a definition that declares the ",[10,183,184],{},"center",", ",[10,187,188],{},"scale",[10,190,191],{},"rotation"," and ",[10,194,195],{},"shape"," props (copy them from any shape effect). Your ",[10,198,199],{},"surface"," function receives a ",[10,202,203],{},"SurfaceFrame"," and returns the color at this pixel. Flat shapes, SVG shapes and 3D shapes all arrive through the same frame.",[206,207,209],"h2",{"id":208},"parameters","Parameters",[211,212,213,229],"table",{},[214,215,216],"thead",{},[217,218,219,223,226],"tr",{},[220,221,222],"th",{},"Name",[220,224,225],{},"Type",[220,227,228],{},"Notes",[230,231,232],"tbody",{},[217,233,234,240,245],{},[235,236,237],"td",{},[10,238,239],{},"spec",[235,241,242],{},[10,243,244],{},"ShapedSurfaceSpec",[235,246],{},[206,248,250],{"id":249},"example","Example",[144,252,254],{"className":146,"code":253,"language":148,"meta":149,"style":149},"...shapedSurface({\n  pattern: 'raw',\n  surface: (frame, params) => {\n    const u = params.uniforms\n    const field = surfaceField(frame, params, {scale: u.scale})\n    const n = geometricNormal(frame, field, {bevelWidth: u.bevelWidth, bevelShape: u.bevelShape})\n    const key = keyLightAt(direction(u.lightAngle), -0.7)\n    const rgb = mul(u.color.member('rgb'), lambert(n, key.member('L'), {wrap: 0.3}))\n    return guarded(insideShape(field.sdf, field.pxH), vec4(rgb, silhouette(field, u.edgeSoftness)), vec4(0, 0, 0, 0))\n  },\n}),\n",[10,255,256,267,280,307,323,339,355,386,435,486,492],{"__ignoreMap":149},[153,257,258,262,264],{"class":155,"line":156},[153,259,261],{"class":260},"snl16","...",[153,263,131],{"class":159},[153,265,266],{"class":162},"({\n",[153,268,270,273,277],{"class":155,"line":269},2,[153,271,272],{"class":162},"  pattern: ",[153,274,276],{"class":275},"sU2Wk","'raw'",[153,278,279],{"class":162},",\n",[153,281,283,286,289,293,295,298,301,304],{"class":155,"line":282},3,[153,284,285],{"class":159},"  surface",[153,287,288],{"class":162},": (",[153,290,292],{"class":291},"s9osk","frame",[153,294,185],{"class":162},[153,296,297],{"class":291},"params",[153,299,300],{"class":162},") ",[153,302,303],{"class":260},"=>",[153,305,306],{"class":162}," {\n",[153,308,310,313,317,320],{"class":155,"line":309},4,[153,311,312],{"class":260},"    const",[153,314,316],{"class":315},"sDLfK"," u",[153,318,319],{"class":260}," =",[153,321,322],{"class":162}," params.uniforms\n",[153,324,326,328,331,333,336],{"class":155,"line":325},5,[153,327,312],{"class":260},[153,329,330],{"class":315}," field",[153,332,319],{"class":260},[153,334,335],{"class":159}," surfaceField",[153,337,338],{"class":162},"(frame, params, {scale: u.scale})\n",[153,340,342,344,347,349,352],{"class":155,"line":341},6,[153,343,312],{"class":260},[153,345,346],{"class":315}," n",[153,348,319],{"class":260},[153,350,351],{"class":159}," geometricNormal",[153,353,354],{"class":162},"(frame, field, {bevelWidth: u.bevelWidth, bevelShape: u.bevelShape})\n",[153,356,358,360,363,365,368,371,374,377,380,383],{"class":155,"line":357},7,[153,359,312],{"class":260},[153,361,362],{"class":315}," key",[153,364,319],{"class":260},[153,366,367],{"class":159}," keyLightAt",[153,369,370],{"class":162},"(",[153,372,373],{"class":159},"direction",[153,375,376],{"class":162},"(u.lightAngle), ",[153,378,379],{"class":260},"-",[153,381,382],{"class":315},"0.7",[153,384,385],{"class":162},")\n",[153,387,389,391,394,396,399,402,405,407,410,413,416,419,421,423,426,429,432],{"class":155,"line":388},8,[153,390,312],{"class":260},[153,392,393],{"class":315}," rgb",[153,395,319],{"class":260},[153,397,398],{"class":159}," mul",[153,400,401],{"class":162},"(u.color.",[153,403,404],{"class":159},"member",[153,406,370],{"class":162},[153,408,409],{"class":275},"'rgb'",[153,411,412],{"class":162},"), ",[153,414,415],{"class":159},"lambert",[153,417,418],{"class":162},"(n, key.",[153,420,404],{"class":159},[153,422,370],{"class":162},[153,424,425],{"class":275},"'L'",[153,427,428],{"class":162},"), {wrap: ",[153,430,431],{"class":315},"0.3",[153,433,434],{"class":162},"}))\n",[153,436,438,441,444,446,449,452,455,458,461,464,466,468,471,473,475,477,479,481,483],{"class":155,"line":437},9,[153,439,440],{"class":260},"    return",[153,442,443],{"class":159}," guarded",[153,445,370],{"class":162},[153,447,448],{"class":159},"insideShape",[153,450,451],{"class":162},"(field.sdf, field.pxH), ",[153,453,454],{"class":159},"vec4",[153,456,457],{"class":162},"(rgb, ",[153,459,460],{"class":159},"silhouette",[153,462,463],{"class":162},"(field, u.edgeSoftness)), ",[153,465,454],{"class":159},[153,467,370],{"class":162},[153,469,470],{"class":315},"0",[153,472,185],{"class":162},[153,474,470],{"class":315},[153,476,185],{"class":162},[153,478,470],{"class":315},[153,480,185],{"class":162},[153,482,470],{"class":315},[153,484,485],{"class":162},"))\n",[153,487,489],{"class":155,"line":488},10,[153,490,491],{"class":162},"  },\n",[153,493,495],{"class":155,"line":494},11,[153,496,497],{"class":162},"}),\n",[499,500,501],"blockquote",{},[140,502,503,507,508,511,512,515,516,518],{},[504,505,506],"strong",{},"Tip."," Start from ",[10,509,510],{},"surfaceField",", end with ",[10,513,514],{},"guarded"," around ",[10,517,448],{},". Everything between is the look.",[206,520,522],{"id":521},"see-also","See also",[524,525,526,536,545,553],"ul",{},[527,528,529,535],"li",{},[530,531,533],"a",{"href":532},"\u002Fdocs\u002Fprimitives\u002Fmaterials\u002Fsurfacefield",[10,534,510],{}," — The first line of a material: the field taps, the signed distance and the pixel size, bound once.",[527,537,538,544],{},[530,539,541],{"href":540},"\u002Fdocs\u002Fprimitives\u002Fmaterials\u002Fgeometricnormal",[10,542,543],{},"geometricNormal"," — The surface normal of the shape, whichever kind of shape is active.",[527,546,547,552],{},[530,548,550],{"href":549},"\u002Fdocs\u002Fprimitives\u002Fmaterials\u002Fsilhouette",[10,551,460],{}," — The shape's coverage at this pixel: 1 inside, 0 outside, soft across the edge.",[527,554,555,560],{},[530,556,558],{"href":557},"\u002Fdocs\u002Fprimitives\u002Fmaterials\u002Fguarded",[10,559,514],{}," — Evaluates an expression only where a condition holds, and a cheap fallback everywhere else.",[206,562,564],{"id":563},"used-by","Used by",[140,566,567,185,571,185,575,185,579,185,583,185,587,185,591,185,595,185,599,185,603,185,607,185,611,185,615,185,619,185,623,185,627,185,631,185,635,185,639,185,643],{},[530,568,570],{"href":569},"\u002Fdocs\u002Fcomponents\u002Fbrushedmetal","BrushedMetal",[530,572,574],{"href":573},"\u002Fdocs\u002Fcomponents\u002Fcarbonfiber","CarbonFiber",[530,576,578],{"href":577},"\u002Fdocs\u002Fcomponents\u002Fchrome","Chrome",[530,580,582],{"href":581},"\u002Fdocs\u002Fcomponents\u002Fcrystal","Crystal",[530,584,586],{"href":585},"\u002Fdocs\u002Fcomponents\u002Femboss","Emboss",[530,588,590],{"href":589},"\u002Fdocs\u002Fcomponents\u002Ffrost","Frost",[530,592,594],{"href":593},"\u002Fdocs\u002Fcomponents\u002Fglass","Glass",[530,596,598],{"href":597},"\u002Fdocs\u002Fcomponents\u002Fgoo","Goo",[530,600,602],{"href":601},"\u002Fdocs\u002Fcomponents\u002Fheatmap","Heatmap",[530,604,606],{"href":605},"\u002Fdocs\u002Fcomponents\u002Fhologram","Hologram",[530,608,610],{"href":609},"\u002Fdocs\u002Fcomponents\u002Fholographic","Holographic",[530,612,614],{"href":613},"\u002Fdocs\u002Fcomponents\u002Firradiance","Irradiance",[530,616,618],{"href":617},"\u002Fdocs\u002Fcomponents\u002Flightedge","LightEdge",[530,620,622],{"href":621},"\u002Fdocs\u002Fcomponents\u002Fliquidmetal","LiquidMetal",[530,624,626],{"href":625},"\u002Fdocs\u002Fcomponents\u002Fnebula","Nebula",[530,628,630],{"href":629},"\u002Fdocs\u002Fcomponents\u002Fneon","Neon",[530,632,634],{"href":633},"\u002Fdocs\u002Fcomponents\u002Fobsidian","Obsidian",[530,636,638],{"href":637},"\u002Fdocs\u002Fcomponents\u002Fplastic","Plastic",[530,640,642],{"href":641},"\u002Fdocs\u002Fcomponents\u002Fthinfilm","ThinFilm",[530,644,646],{"href":645},"\u002Fdocs\u002Fcomponents\u002Fwater","Water",[648,649,650],"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 .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 .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .s9osk, html code.shiki .s9osk{--shiki-default:#FFAB70}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}",{"title":149,"searchDepth":269,"depth":269,"links":652},[653,654,655,656],{"id":208,"depth":269,"text":209},{"id":249,"depth":269,"text":250},{"id":521,"depth":269,"text":522},{"id":563,"depth":269,"text":564},"Materials & surfaces",false,null,"md","light","Noise, light & materials","function",{},true,"\u002Fdocs\u002Fprimitives\u002Fmaterials\u002Fshapedsurface",{"title":131,"description":142},"https:\u002F\u002Fgithub.com\u002Fshader-effects-inc\u002Fshaders\u002Fblob\u002Fmain\u002Fpackages\u002Fcore\u002Fsrc\u002Fstd\u002Fpaint\u002Fmaterials.ts#L237","docs\u002Fprimitives\u002F14.materials\u002F1.shapedsurface","nkkRBvcjIfNh5LM3Q1CmcRBrwq3_LPk_le-NoD81TE8"]