shaders 3.2.474 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -142
- package/README.md +192 -19
- package/dist/cli.js +2 -2
- package/dist/core/{AngularBlur-g4-fDx1N.js → AngularBlur-BEBs-lRR.js} +2 -3
- package/dist/core/{Arc-B4VGPOtO.js → Arc-D-WnjM7T.js} +1 -3
- package/dist/core/{Ascii-DxiduEzP.js → Ascii-BGPIwMc3.js} +2 -5
- package/dist/core/{Aurora-FgWLcSkh.js → Aurora-DqJBPdMQ.js} +2 -11
- package/dist/core/{BarShift-BukEd3jr.js → BarShift-BcCOweUh.js} +2 -3
- package/dist/core/{BarnDoors-BC0LM0aD.js → BarnDoors-B9B-AmCV.js} +2 -3
- package/dist/core/{Beam-CxAXVlAf.js → Beam-QG_9OS8I.js} +2 -3
- package/dist/core/{Bend-BfVVIo2C.js → Bend-Cy9VAowL.js} +1 -2
- package/dist/core/{Blob-D_IbcUCc.js → Blob-C3txJeW0.js} +2 -10
- package/dist/core/{BlockDissolve-C9nsgIz9.js → BlockDissolve-C1SFUys7.js} +2 -3
- package/dist/core/{BlockNoise-BgwbD0rx.js → BlockNoise-Cm3y8hce.js} +2 -4
- package/dist/core/{BlueNoise-BdwOaq4G.js → BlueNoise-BCLObOMm.js} +2 -4
- package/dist/core/{Blur-ceuv7ZTm.js → Blur-Dg29SnXd.js} +1 -2
- package/dist/core/{Boids-DEHsYo46.js → Boids-rsGsPN5h.js} +2 -5
- package/dist/core/{BokehBlur-C8xJ0xA8.js → BokehBlur-rFSFEnb0.js} +3 -4
- package/dist/core/{BrickPattern-C-6QFzp6.js → BrickPattern-DqN6JKEN.js} +2 -3
- package/dist/core/{BrightnessContrast-CMUaNvo0.js → BrightnessContrast-J9fCSBiC.js} +1 -3
- package/dist/core/{BrushedMetal-CQsu_96R.js → BrushedMetal-74wSZKjG.js} +3 -8
- package/dist/core/{Bulge-CgO7_0fe.js → Bulge-BIk0oq8j.js} +1 -2
- package/dist/core/{CRTScreen-DNqe2klB.js → CRTScreen-hEH-JNRd.js} +2 -3
- package/dist/core/{CarbonFiber-D0vgwlrV.js → CarbonFiber-CZdUDvRU.js} +4 -8
- package/dist/core/{Chalkboard-CDUJz_Ae.js → Chalkboard-CClJHqvs.js} +2 -3
- package/dist/core/{ChannelBlur-Z8ZvN6W3.js → ChannelBlur-BEuEwQOC.js} +1 -2
- package/dist/core/{CheckerWipe-DXm9kDaS.js → CheckerWipe-KuAWj2qg.js} +2 -3
- package/dist/core/{Checkerboard-DZAABNKo.js → Checkerboard-Rq9ze1W3.js} +2 -3
- package/dist/core/{Chevron-Dn1iHSiS.js → Chevron-C1j6X2Ye.js} +2 -3
- package/dist/core/{ChromaFlow-lnaJ4o1Y.js → ChromaFlow-BgsCUYIl.js} +2 -5
- package/dist/core/{ChromaticAberration-CGOQe4Pp.js → ChromaticAberration-2_4tjQ0u.js} +2 -4
- package/dist/core/{Chrome-DPAmErfN.js → Chrome-Be3z6C5i.js} +5 -11
- package/dist/core/{Circle-DVPhvXdr.js → Circle-e_qQI3tU.js} +1 -3
- package/dist/core/{ColorWheel-DXkVOQl2.js → ColorWheel-s5ep1H7d.js} +2 -3
- package/dist/core/{CompressionArtifacts-CEw9gfTu.js → CompressionArtifacts-OE9U9Qrq.js} +1 -3
- package/dist/core/{ConcentricSpin-GtNEq1T1.js → ConcentricSpin-CLE_5yCJ.js} +1 -2
- package/dist/core/{ConicGradient-DYPNJAOg.js → ConicGradient-Cji2SgVO.js} +2 -4
- package/dist/core/{ContourLines-DEmEepvT.js → ContourLines-wpPK00cF.js} +2 -3
- package/dist/core/{CornerPin-CJJeGyVf.js → CornerPin-gYU0Uf2m.js} +2 -3
- package/dist/core/{Crescent-C7yy9-xf.js → Crescent-viNc7Unp.js} +1 -2
- package/dist/core/{Cross-DyYrdTVw.js → Cross-DyQSsw_k.js} +1 -2
- package/dist/core/{Crystal-DQJd5oAd.js → Crystal-Vjj8azWg.js} +4 -9
- package/dist/core/{CurlNoise-Bjc6hhjR.js → CurlNoise-C7PHjDht.js} +2 -4
- package/dist/core/{CursorRipples-C1PNyYcB.js → CursorRipples-BzPPNkA3.js} +3 -39
- package/dist/core/{CursorTrail-C6v97bId.js → CursorTrail-cBj0AuQA.js} +2 -4
- package/dist/core/{DataMosh-AX4kIi4R.js → DataMosh-5Yr9TyVx.js} +1 -3
- package/dist/core/{DiamondGradient-Bj6mUxOy.js → DiamondGradient-DZM7HwF5.js} +2 -4
- package/dist/core/{DiamondWipe-BNSkpUn9.js → DiamondWipe-CqeT7lCt.js} +2 -3
- package/dist/core/{DiffuseBlur-C7l-5Dw3.js → DiffuseBlur-Y5hSDTZF.js} +2 -3
- package/dist/core/{DisplacementMap-DGpLSlxs.js → DisplacementMap-FobRx5Ie.js} +2 -3
- package/dist/core/{Dither-C9KDpqgP.js → Dither-50rqHpt9.js} +2 -3
- package/dist/core/{DotGrid-CkAtf-j_.js → DotGrid-B6AGLUbR.js} +3 -4
- package/dist/core/{DropShadow-BxI_a7dC.js → DropShadow-CEPpgatB.js} +2 -3
- package/dist/core/{Duotone-CrJ0P0SL.js → Duotone-D76Kp7Pb.js} +2 -3
- package/dist/core/{Ellipse-C2Tie_19.js → Ellipse-BGod1LeG.js} +1 -2
- package/dist/core/{Emboss-BjOlYydL.js → Emboss-DMNFb_ww.js} +3 -6
- package/dist/core/{Engraving-RpxXPqQq.js → Engraving-Dj7bCATQ.js} +2 -3
- package/dist/core/{ErosionNoise-D0qefxhq.js → ErosionNoise-4O68wJQZ.js} +2 -4
- package/dist/core/{Exposure-B7W7AVbY.js → Exposure-h-vapOpj.js} +1 -3
- package/dist/core/{FallingLines-Cxhmtqf4.js → FallingLines-Dzop_89k.js} +2 -3
- package/dist/core/{FilmGrain-CghUJIeK.js → FilmGrain-Bs8PCfdf.js} +1 -3
- package/dist/core/{FilmStock-DmOaROtC.js → FilmStock-DBjVo6rL.js} +1 -4
- package/dist/core/{Flip-BuOdbWjK.js → Flip-CfrS4KfZ.js} +2 -3
- package/dist/core/{FloatingParticles-BfFlt06Y.js → FloatingParticles-D1R2tD2J.js} +2 -5
- package/dist/core/{FlowField-A2njOtGx.js → FlowField-Slirm5AI.js} +2 -3
- package/dist/core/{Flower-CwdJOVR1.js → Flower-Ddlut7QZ.js} +1 -2
- package/dist/core/{FlowingGradient-D3BG2FW9.js → FlowingGradient-CwIgTtbj.js} +2 -7
- package/dist/core/{FlutedGlass-BWlTrLF-.js → FlutedGlass-CMMy2GJ5.js} +2 -4
- package/dist/core/{Fog-CpmIyRtJ.js → Fog-DjjUkcTZ.js} +2 -4
- package/dist/core/{Form3D-D-eUD4_k.js → Form3D-DQDOHWpC.js} +2 -4
- package/dist/core/{FractalNoise-DsESU8cP.js → FractalNoise-BjI3IOIj.js} +2 -4
- package/dist/core/{Frost-B1s1W_Qm.js → Frost-CK12HnL1.js} +4 -9
- package/dist/core/{GaborNoise-D3U1iz9E.js → GaborNoise-DKEIvvRJ.js} +3 -5
- package/dist/core/{Glass-O5o5OxlN.js → Glass-CzcOVD5Y.js} +3 -8
- package/dist/core/{GlassTiles-BxdT6Ee8.js → GlassTiles-gjhc563g.js} +1 -2
- package/dist/core/{Glitch-DQeLaNdU.js → Glitch-C_XAWltC.js} +1 -2
- package/dist/core/{Glow-DksG7wdu.js → Glow-CrYCanBI.js} +1 -3
- package/dist/core/{Godrays-D2Pzd9K9.js → Godrays-BBTMOVLP.js} +2 -3
- package/dist/core/{Goo-BL_ifIPI.js → Goo-Brhjk8aS.js} +3 -8
- package/dist/core/{GradientMap-B-5yUYjX.js → GradientMap-C5325QWw.js} +2 -4
- package/dist/core/{Grayscale-g7jQsxgi.js → Grayscale-dPjs-wvf.js} +1 -2
- package/dist/core/{Grid-DAglpJFP.js → Grid-UjEd3O76.js} +3 -4
- package/dist/core/{GridDistortion-CNlIESbs.js → GridDistortion-vVgYya1U.js} +1 -5
- package/dist/core/{Group-CeOfFv2K.js → Group-KVdmAi5g.js} +1 -1
- package/dist/core/{HTMLInCanvas-BgwCnbYn.js → HTMLInCanvas-CKr2u76R.js} +1 -2
- package/dist/core/{Halftone-DCiP4EDq.js → Halftone-pRV3TRUW.js} +4 -5
- package/dist/core/{Heart-CQhtzwFu.js → Heart-CX7MvvHZ.js} +1 -2
- package/dist/core/{Heatmap-e-lF_uZu.js → Heatmap-Dn6qyd2e.js} +3 -8
- package/dist/core/{HexGrid-BY_BPH8J.js → HexGrid-BIfYhkfV.js} +3 -4
- package/dist/core/{Hologram-BA_LJPm0.js → Hologram-ou27baPQ.js} +4 -8
- package/dist/core/{Holographic-CX8OG-Wa.js → Holographic-CiHdBSMg.js} +3 -7
- package/dist/core/{HueShift-BnwOshrg.js → HueShift-CG7pcXfg.js} +1 -3
- package/dist/core/{ImageTexture-Cd6vH2Z0.js → ImageTexture-BiZuU58C.js} +1 -2
- package/dist/core/{InkFlow-B7F9i3Kd.js → InkFlow-D9_L7opB.js} +9 -12
- package/dist/core/{Invert-6Q5kX8vd.js → Invert-CHEaiQZO.js} +1 -2
- package/dist/core/{IrisWipe-Cl5yYdEi.js → IrisWipe-x22vOQHm.js} +2 -3
- package/dist/core/Irradiance-7yq2K87_.js +389 -0
- package/dist/core/{IsometricCubes-BhK9MhCy.js → IsometricCubes-CkPGWr7M.js} +2 -3
- package/dist/core/{Kaleidoscope-D4X5N_qk.js → Kaleidoscope-CEC5m1Ww.js} +1 -2
- package/dist/core/{KeyFrames-Dv1vFfMa.js → KeyFrames-BMGEZsAZ.js} +2 -3
- package/dist/core/{LensDistortion-BqVp5WBS.js → LensDistortion-DKo8PiO5.js} +2 -3
- package/dist/core/{LensFlare-z0k68uJ1.js → LensFlare-DMS-NUtK.js} +2 -3
- package/dist/core/LightEdge-DxmnCRls.js +315 -0
- package/dist/core/{LightLeak-BgFq4bLG.js → LightLeak-yoEsZtYg.js} +2 -4
- package/dist/core/{Line--Ur3CJp1.js → Line-D17XDUjO.js} +2 -3
- package/dist/core/{LinearBlur-BkHF6lVm.js → LinearBlur-CiyjPTUH.js} +2 -3
- package/dist/core/{LinearGradient-DIdq_fiw.js → LinearGradient-DfjKG70q.js} +2 -4
- package/dist/core/{LinearWipe-DuCB9oV_.js → LinearWipe-D9CtBg6S.js} +2 -3
- package/dist/core/{LiquidMetal-B2Cz80Ka.js → LiquidMetal-8EG6DwV6.js} +3 -8
- package/dist/core/{Liquify-CvPn1ze-.js → Liquify-BySXF1OB.js} +1 -4
- package/dist/core/{MagneticFilings-BOgYrPhz.js → MagneticFilings-DNESH3Zs.js} +2 -5
- package/dist/core/{Marble-c2QGDXxB.js → Marble-C9WvdxrP.js} +2 -7
- package/dist/core/{MeshGradient-DMsza5tg.js → MeshGradient-d9--RXOU.js} +2 -10
- package/dist/core/{Mirror-Ck8qk1Km.js → Mirror-1V2FF2kD.js} +1 -2
- package/dist/core/{MultiPointGradient-DwO6snxn.js → MultiPointGradient-cRA9ytgL.js} +2 -3
- package/dist/core/{Nebula-3a9pYBDC.js → Nebula-BRV-q74y.js} +7 -90
- package/dist/core/{Neon-Cf95sJ7W.js → Neon-4PemK9Rj.js} +3 -6
- package/dist/core/{NoiseDissolve-DgvzEFOD.js → NoiseDissolve-B7LgD46G.js} +2 -3
- package/dist/core/{ObjectTracker-IopW8Jvf.js → ObjectTracker-CdzDxhpy.js} +3 -4
- package/dist/core/{Obsidian-BL_0ordp.js → Obsidian-2J1eX9kT.js} +9 -15
- package/dist/core/{PagePeel-BeAr_n0U.js → PagePeel-D-ziraOm.js} +1 -2
- package/dist/core/{Paper-BDEsyIPI.js → Paper-BxzCLyzB.js} +1 -2
- package/dist/core/{Parallelogram-Duj-0MLr.js → Parallelogram-D4OflTwn.js} +1 -2
- package/dist/core/{ParticleField-gk7JuNx4.js → ParticleField-tWNicEDO.js} +1 -4
- package/dist/core/{ParticleFlow-BzWOl7Hm.js → ParticleFlow-BiEYFyWR.js} +2 -6
- package/dist/core/{Particles-DYAtR6jZ.js → Particles-B7W4yWgo.js} +3 -7
- package/dist/core/{PerlinNoise-BHQ318g4.js → PerlinNoise-C-irUxp9.js} +3 -5
- package/dist/core/{Perspective-xBfd9BSE.js → Perspective-DlnAW-pe.js} +2 -3
- package/dist/core/{PixelSort-Bx9sUnGm.js → PixelSort-BBOTYuOE.js} +1 -4
- package/dist/core/{PixelThrow-0nJiGsmZ.js → PixelThrow-DCJb9Lxd.js} +2 -4
- package/dist/core/{Pixelate-CvCzoA0h.js → Pixelate-CZdwB--K.js} +1 -2
- package/dist/core/{Plasma-Be1yxNcP.js → Plasma-CTOQJeqy.js} +2 -4
- package/dist/core/{Plastic-Bom1oFFR.js → Plastic-DvyH9x-4.js} +3 -8
- package/dist/core/{PolarCoordinates-BGwTZ6NO.js → PolarCoordinates-XhdDAOD0.js} +1 -2
- package/dist/core/{Polygon-Byw5C7Qy.js → Polygon-CLohB-Ly.js} +2 -4
- package/dist/core/{Posterize-BHOstvyj.js → Posterize-BAQfnvmK.js} +1 -2
- package/dist/core/{Prism-pNsLhW8w.js → Prism-DJVCVAXX.js} +4 -8
- package/dist/core/{ProgressiveBlur-CR1IbvKQ.js → ProgressiveBlur-Dirva1on.js} +2 -3
- package/dist/core/{RadialGradient-BFOrMAK1.js → RadialGradient-DuSKR8Ds.js} +2 -4
- package/dist/core/{RadialWipe-BYnlbrNm.js → RadialWipe-n8tON7x2.js} +2 -3
- package/dist/core/{RandomBars-B7erRRHx.js → RandomBars-BYouiIgQ.js} +2 -3
- package/dist/core/{ReactionDiffusion-BnY40jHs.js → ReactionDiffusion-CHDd3y2q.js} +2 -5
- package/dist/core/{RectangularCoordinates-D9-3PQAz.js → RectangularCoordinates-CYFfCawa.js} +1 -2
- package/dist/core/{ReflectivePlane-BI-LIR2c.js → ReflectivePlane-DFTl5U9q.js} +2 -3
- package/dist/core/Repeater-CnbzXuAe.js +473 -0
- package/dist/core/{Ring-CvvtJYAf.js → Ring-CGkHVSVd.js} +1 -2
- package/dist/core/{RippleWipe-kAzZWsjR.js → RippleWipe-DLjPzY6u.js} +2 -3
- package/dist/core/{Ripples-BFLep1r1.js → Ripples-C2tITU62.js} +2 -3
- package/dist/core/{RoundedRect-DirNijIY.js → RoundedRect-sfNTUaCY.js} +1 -2
- package/dist/core/{Saturation-CfkRhJpe.js → Saturation-BRkifYWj.js} +1 -3
- package/dist/core/{Scratches-Dchfw1_5.js → Scratches-D87O5C2K.js} +2 -4
- package/dist/core/{Sharpness-DZzAnlsl.js → Sharpness-BGv613Zw.js} +1 -3
- package/dist/core/Shatter-DuyCFU1f.js +328 -0
- package/dist/core/{SimplexNoise-CmV42gYT.js → SimplexNoise-CQJvmqd-.js} +2 -4
- package/dist/core/{SineWave-TqnpIKO4.js → SineWave-BfOgSGMP.js} +2 -3
- package/dist/core/{SliceWipe-Dz8vj6bi.js → SliceWipe-CD_D99sl.js} +1 -2
- package/dist/core/{Smoke-B1TnZnG6.js → Smoke-BDQYKRP1.js} +2 -4
- package/dist/core/{SmokeFill-C8gSZ22X.js → SmokeFill-CPnzQtQv.js} +3 -8
- package/dist/core/{SmokeFlow-dd5uLztm.js → SmokeFlow-BkPMjZq8.js} +2 -4
- package/dist/core/{Solarize-CIQa9pKw.js → Solarize-DSiS32QS.js} +1 -3
- package/dist/core/{SolidColor-DuoQVKGk.js → SolidColor-DEKpgy1c.js} +2 -3
- package/dist/core/Sparkle-BZur6gPW.js +178 -0
- package/dist/core/{Spherize-FWwWEUyE.js → Spherize-D9Yg4n6O.js} +2 -3
- package/dist/core/{Spiral-DI1eG0E3.js → Spiral-BCacfEpT.js} +2 -3
- package/dist/core/{Star-DT-hnlIJ.js → Star-Dnw1ihk7.js} +1 -2
- package/dist/core/{Stone-oW35zD22.js → Stone-Cje-_vAg.js} +1 -3
- package/dist/core/{Strands-asB3fUr9.js → Strands-CFRxS1G_.js} +2 -4
- package/dist/core/{Stretch-Cm_B4WGY.js → Stretch-DXVhfIqO.js} +1 -2
- package/dist/core/{Stripes-BnJiniJY.js → Stripes-CCADWwyq.js} +2 -3
- package/dist/core/{StudioBackground-DwSO5KNV.js → StudioBackground-BlzYNAsu.js} +2 -6
- package/dist/core/{SunBurst-BL-BryZO.js → SunBurst-CmWbI18r.js} +2 -3
- package/dist/core/{Surface3D-DSvh7Zof.js → Surface3D-Dmh98-0V.js} +2 -6
- package/dist/core/{Swirl-BVPy039a.js → Swirl-CzI1qSVc.js} +2 -4
- package/dist/core/{Teardrop-CR1UqYaF.js → Teardrop-D24uulL0.js} +1 -2
- package/dist/core/{Text-fP5temat.js → Text-CrZKvBw6.js} +2 -6
- package/dist/core/{ThinFilm-CTQeVw7E.js → ThinFilm-D7R2dt1O.js} +11 -14
- package/dist/core/{TiltShift-BvYpYELk.js → TiltShift-AMMDZBvf.js} +2 -3
- package/dist/core/{TimeTrail-DqdYuHn7.js → TimeTrail-BCYDP2ep.js} +4 -8
- package/dist/core/{Tint-BXJMHYvg.js → Tint-DHb5wBN5.js} +2 -3
- package/dist/core/{Trapezoid--AgyKOWQ.js → Trapezoid-CL5Fxvq7.js} +1 -2
- package/dist/core/{TriangularGrid-CmDApxz9.js → TriangularGrid-Bp-SJS-H.js} +2 -3
- package/dist/core/{Tritone-DCd_IRp7.js → Tritone-C0nx7OdC.js} +2 -3
- package/dist/core/{Truchet-g1_jcoZ4.js → Truchet-DCetyDaq.js} +2 -3
- package/dist/core/{Twirl-JY-PXDS2.js → Twirl-D_mv9KEi.js} +1 -2
- package/dist/core/{VHS-ZWR6D4Da.js → VHS-Cp9aDjti.js} +2 -3
- package/dist/core/{VenetianBlinds-B7laTyPO.js → VenetianBlinds-DUyvaT5w.js} +2 -3
- package/dist/core/{Vesica-BTNW2p5u.js → Vesica-BpzrTPTA.js} +1 -2
- package/dist/core/{Vibrance-DmhtRT2D.js → Vibrance-DW3J-pvW.js} +1 -3
- package/dist/core/{VideoTexture-DK3EaAHY.js → VideoTexture-zoKsSrex.js} +1 -2
- package/dist/core/{Vignette-hyFfUS20.js → Vignette-KKbP3qdZ.js} +2 -5
- package/dist/core/{Voronoi-DhexPwNM.js → Voronoi-Bp2-U6lm.js} +2 -5
- package/dist/core/Voxels-B3e3LHH5.js +469 -0
- package/dist/core/{Water-BsBnXYYB.js → Water-CoYwvqKx.js} +7 -12
- package/dist/core/{Watercolor-C1HipGGO.js → Watercolor-DUNjSIN1.js} +2 -4
- package/dist/core/{WaveDistortion-VXyHFcJ3.js → WaveDistortion-Dp8ws0z1.js} +1 -2
- package/dist/core/{Waveform-CSP_4nZF.js → Waveform-DDBLB6zu.js} +2 -9
- package/dist/core/{WaveletNoise-CQqAufyv.js → WaveletNoise-CpBkzfRT.js} +2 -4
- package/dist/core/{Weave-DwX8T4_Q.js → Weave-cWkvSEAy.js} +2 -3
- package/dist/core/{WebcamTexture-B4SLwIP1.js → WebcamTexture-D484SXSE.js} +1 -2
- package/dist/core/{Wool-qg-z_TFC.js → Wool-C9L7O9fD.js} +1 -3
- package/dist/core/{WorleyNoise-CjVw20Fl.js → WorleyNoise-B5j5lDQZ.js} +2 -3
- package/dist/core/{ZoomBlur-Lm_pVpMf.js → ZoomBlur-bPC1dBu2.js} +2 -3
- package/dist/core/customShaders.d.ts +71 -0
- package/dist/core/customShaders.d.ts.map +1 -0
- package/dist/core/docs-manifest.json +29177 -0
- package/dist/core/gpu/composer.d.ts +2 -0
- package/dist/core/gpu/composer.d.ts.map +1 -1
- package/dist/core/gpu/contract.d.ts +17 -2
- package/dist/core/gpu/contract.d.ts.map +1 -1
- package/dist/core/gpu/frame.d.ts +5 -2
- package/dist/core/gpu/frame.d.ts.map +1 -1
- package/dist/core/gpu/index.d.ts.map +1 -1
- package/dist/core/gpu/kit/aa.d.ts +1 -1
- package/dist/core/gpu/kit/agents.d.ts +1 -1
- package/dist/core/gpu/kit/blur.d.ts +4 -4
- package/dist/core/gpu/kit/cells.d.ts +3 -3
- package/dist/core/gpu/kit/cellular.d.ts +1 -1
- package/dist/core/gpu/kit/colorOps.d.ts +6 -6
- package/dist/core/gpu/kit/effects/glass.d.ts +2 -2
- package/dist/core/gpu/kit/effects/thinFilm.d.ts +4 -4
- package/dist/core/gpu/kit/fields.d.ts.map +1 -1
- package/dist/core/gpu/kit/host/pointer.d.ts +1 -1
- package/dist/core/gpu/kit/lensParts.d.ts +3 -3
- package/dist/core/gpu/kit/lightfields.d.ts +3 -3
- package/dist/core/gpu/kit/materialParts.d.ts +1 -1
- package/dist/core/gpu/kit/materialParts.d.ts.map +1 -1
- package/dist/core/gpu/kit/media.d.ts +1 -1
- package/dist/core/gpu/kit/media.d.ts.map +1 -1
- package/dist/core/gpu/kit/motionBlur.d.ts +2 -2
- package/dist/core/gpu/kit/noiseColor.d.ts +5 -5
- package/dist/core/gpu/kit/noiseColor.d.ts.map +1 -1
- package/dist/core/gpu/kit/noisePaints.d.ts +1 -1
- package/dist/core/gpu/kit/sdf.d.ts +2 -2
- package/dist/core/gpu/kit/stylizePaints.d.ts +1 -1
- package/dist/core/gpu/kit/stylizePaints.d.ts.map +1 -1
- package/dist/core/gpu/kit/tone.d.ts +1 -1
- package/dist/core/gpu/kit/waves.d.ts +6 -0
- package/dist/core/gpu/kit/waves.d.ts.map +1 -1
- package/dist/core/gpu/passManager.d.ts +1 -1
- package/dist/core/gpu/passManager.d.ts.map +1 -1
- package/dist/core/gpu/scaffolds/fluids.d.ts +7 -7
- package/dist/core/gpu/scaffolds/fluids.d.ts.map +1 -1
- package/dist/core/gpu/scaffolds/gridKernels.d.ts +8 -8
- package/dist/core/gpu/scaffolds/gridKernels.d.ts.map +1 -1
- package/dist/core/gpu/scaffolds/pointwiseFilter.d.ts +5 -5
- package/dist/core/gpu/scaffolds/pointwiseFilter.d.ts.map +1 -1
- package/dist/core/gpu/scaffolds/radiance.d.ts +5 -5
- package/dist/core/gpu/scaffolds/radiance.d.ts.map +1 -1
- package/dist/core/gpu/scaffolds/rttFilter.d.ts +2 -2
- package/dist/core/gpu/scaffolds/rttFilter.d.ts.map +1 -1
- package/dist/core/gpu/scaffolds/sdfShape.d.ts +2 -2
- package/dist/core/gpu/scaffolds/sdfShape.d.ts.map +1 -1
- package/dist/core/gpu/scaffolds/uvRemapShader.d.ts +4 -4
- package/dist/core/gpu/support.d.ts +12 -0
- package/dist/core/gpu/support.d.ts.map +1 -1
- package/dist/core/index.d.ts +3 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +238 -255
- package/dist/core/llms.txt +1558 -0
- package/dist/core/{noiseColor-DuWjYRmO.js → noiseColor-D_bPhJ4m.js} +2 -2
- package/dist/core/presetRenderer.d.ts +4 -0
- package/dist/core/presetRenderer.d.ts.map +1 -1
- package/dist/core/registry.js +204 -248
- package/dist/core/shaderRegistry-BaozBFyh.js +445 -0
- package/dist/core/shaderRegistry.d.ts.map +1 -1
- package/dist/core/shaders/AngularBlur/index.d.ts +1 -1
- package/dist/core/shaders/AngularBlur/index.d.ts.map +1 -1
- package/dist/core/shaders/AngularBlur/index.js +4 -10
- package/dist/core/shaders/Arc/index.js +4 -6
- package/dist/core/shaders/Ascii/index.d.ts +1 -1
- package/dist/core/shaders/Ascii/index.d.ts.map +1 -1
- package/dist/core/shaders/Ascii/index.js +4 -11
- package/dist/core/shaders/Aurora/index.js +4 -21
- package/dist/core/shaders/BarShift/index.js +4 -8
- package/dist/core/shaders/BarnDoors/index.js +4 -7
- package/dist/core/shaders/Beam/index.js +4 -11
- package/dist/core/shaders/Bend/index.js +4 -8
- package/dist/core/shaders/Blob/index.js +4 -18
- package/dist/core/shaders/BlockDissolve/index.js +4 -7
- package/dist/core/shaders/BlockNoise/index.d.ts +1 -1
- package/dist/core/shaders/BlockNoise/index.d.ts.map +1 -1
- package/dist/core/shaders/BlockNoise/index.js +5 -14
- package/dist/core/shaders/BlueNoise/index.d.ts +1 -1
- package/dist/core/shaders/BlueNoise/index.d.ts.map +1 -1
- package/dist/core/shaders/BlueNoise/index.js +5 -14
- package/dist/core/shaders/Blur/index.d.ts +1 -1
- package/dist/core/shaders/Blur/index.d.ts.map +1 -1
- package/dist/core/shaders/Blur/index.js +4 -10
- package/dist/core/shaders/Boids/index.js +4 -9
- package/dist/core/shaders/BokehBlur/index.d.ts +1 -1
- package/dist/core/shaders/BokehBlur/index.js +4 -10
- package/dist/core/shaders/BrickPattern/index.d.ts +1 -1
- package/dist/core/shaders/BrickPattern/index.d.ts.map +1 -1
- package/dist/core/shaders/BrickPattern/index.js +4 -13
- package/dist/core/shaders/BrightnessContrast/index.js +4 -7
- package/dist/core/shaders/BrushedMetal/index.js +4 -11
- package/dist/core/shaders/Bulge/index.js +4 -8
- package/dist/core/shaders/CRTScreen/index.d.ts +2 -2
- package/dist/core/shaders/CRTScreen/index.d.ts.map +1 -1
- package/dist/core/shaders/CRTScreen/index.js +4 -10
- package/dist/core/shaders/CarbonFiber/index.d.ts +1 -1
- package/dist/core/shaders/CarbonFiber/index.js +4 -11
- package/dist/core/shaders/Chalkboard/index.d.ts +1 -1
- package/dist/core/shaders/Chalkboard/index.d.ts.map +1 -1
- package/dist/core/shaders/Chalkboard/index.js +4 -9
- package/dist/core/shaders/ChannelBlur/index.d.ts +1 -1
- package/dist/core/shaders/ChannelBlur/index.d.ts.map +1 -1
- package/dist/core/shaders/ChannelBlur/index.js +4 -10
- package/dist/core/shaders/CheckerWipe/index.js +4 -7
- package/dist/core/shaders/Checkerboard/index.d.ts +1 -1
- package/dist/core/shaders/Checkerboard/index.d.ts.map +1 -1
- package/dist/core/shaders/Checkerboard/index.js +4 -13
- package/dist/core/shaders/Chevron/index.d.ts +1 -1
- package/dist/core/shaders/Chevron/index.d.ts.map +1 -1
- package/dist/core/shaders/Chevron/index.js +4 -13
- package/dist/core/shaders/ChromaFlow/index.js +4 -8
- package/dist/core/shaders/ChromaticAberration/index.js +4 -11
- package/dist/core/shaders/Chrome/index.d.ts +1 -1
- package/dist/core/shaders/Chrome/index.js +4 -10
- package/dist/core/shaders/Circle/index.js +4 -6
- package/dist/core/shaders/ColorWheel/index.js +4 -11
- package/dist/core/shaders/CompressionArtifacts/index.d.ts +2 -2
- package/dist/core/shaders/CompressionArtifacts/index.d.ts.map +1 -1
- package/dist/core/shaders/CompressionArtifacts/index.js +4 -7
- package/dist/core/shaders/ConcentricSpin/index.js +4 -8
- package/dist/core/shaders/ConicGradient/index.js +4 -11
- package/dist/core/shaders/ContourLines/index.js +4 -6
- package/dist/core/shaders/CornerPin/index.js +4 -8
- package/dist/core/shaders/Crescent/index.js +4 -5
- package/dist/core/shaders/Cross/index.js +4 -5
- package/dist/core/shaders/Crystal/index.js +4 -11
- package/dist/core/shaders/CurlNoise/index.d.ts +1 -1
- package/dist/core/shaders/CurlNoise/index.d.ts.map +1 -1
- package/dist/core/shaders/CurlNoise/index.js +5 -14
- package/dist/core/shaders/CursorRipples/index.js +4 -7
- package/dist/core/shaders/CursorTrail/index.js +4 -7
- package/dist/core/shaders/DataMosh/index.js +4 -7
- package/dist/core/shaders/DiamondGradient/index.js +4 -11
- package/dist/core/shaders/DiamondWipe/index.js +4 -7
- package/dist/core/shaders/DiffuseBlur/index.d.ts +1 -1
- package/dist/core/shaders/DiffuseBlur/index.d.ts.map +1 -1
- package/dist/core/shaders/DiffuseBlur/index.js +4 -10
- package/dist/core/shaders/DisplacementMap/index.js +4 -8
- package/dist/core/shaders/Dither/index.d.ts +1 -1
- package/dist/core/shaders/Dither/index.d.ts.map +1 -1
- package/dist/core/shaders/Dither/index.js +4 -13
- package/dist/core/shaders/DotGrid/index.d.ts +2 -2
- package/dist/core/shaders/DotGrid/index.d.ts.map +1 -1
- package/dist/core/shaders/DotGrid/index.js +4 -13
- package/dist/core/shaders/DropShadow/index.d.ts +1 -1
- package/dist/core/shaders/DropShadow/index.d.ts.map +1 -1
- package/dist/core/shaders/DropShadow/index.js +4 -10
- package/dist/core/shaders/Duotone/index.js +4 -6
- package/dist/core/shaders/Ellipse/index.js +4 -5
- package/dist/core/shaders/Emboss/index.js +4 -9
- package/dist/core/shaders/Engraving/index.js +4 -9
- package/dist/core/shaders/ErosionNoise/index.d.ts +1 -1
- package/dist/core/shaders/ErosionNoise/index.d.ts.map +1 -1
- package/dist/core/shaders/ErosionNoise/index.js +5 -14
- package/dist/core/shaders/Exposure/index.js +4 -7
- package/dist/core/shaders/FallingLines/index.d.ts +1 -1
- package/dist/core/shaders/FallingLines/index.d.ts.map +1 -1
- package/dist/core/shaders/FallingLines/index.js +4 -13
- package/dist/core/shaders/FilmGrain/index.js +4 -7
- package/dist/core/shaders/FilmStock/index.js +4 -13
- package/dist/core/shaders/Flip/index.js +4 -8
- package/dist/core/shaders/FloatingParticles/index.d.ts +2 -2
- package/dist/core/shaders/FloatingParticles/index.d.ts.map +1 -1
- package/dist/core/shaders/FloatingParticles/index.js +4 -9
- package/dist/core/shaders/FlowField/index.js +4 -8
- package/dist/core/shaders/Flower/index.js +4 -5
- package/dist/core/shaders/FlowingGradient/index.js +4 -15
- package/dist/core/shaders/FlutedGlass/index.js +4 -11
- package/dist/core/shaders/Fog/index.js +4 -7
- package/dist/core/shaders/Form3D/index.js +4 -7
- package/dist/core/shaders/FractalNoise/index.d.ts +1 -1
- package/dist/core/shaders/FractalNoise/index.d.ts.map +1 -1
- package/dist/core/shaders/FractalNoise/index.js +4 -13
- package/dist/core/shaders/Frost/index.d.ts +1 -1
- package/dist/core/shaders/Frost/index.js +4 -11
- package/dist/core/shaders/GaborNoise/index.d.ts +2 -2
- package/dist/core/shaders/GaborNoise/index.d.ts.map +1 -1
- package/dist/core/shaders/GaborNoise/index.js +5 -14
- package/dist/core/shaders/Glass/index.js +4 -11
- package/dist/core/shaders/GlassTiles/index.d.ts +1 -1
- package/dist/core/shaders/GlassTiles/index.d.ts.map +1 -1
- package/dist/core/shaders/GlassTiles/index.js +4 -8
- package/dist/core/shaders/Glitch/index.d.ts +1 -1
- package/dist/core/shaders/Glitch/index.d.ts.map +1 -1
- package/dist/core/shaders/Glitch/index.js +4 -10
- package/dist/core/shaders/Glow/index.d.ts +1 -1
- package/dist/core/shaders/Glow/index.d.ts.map +1 -1
- package/dist/core/shaders/Glow/index.js +4 -11
- package/dist/core/shaders/Godrays/index.js +4 -12
- package/dist/core/shaders/Goo/index.js +4 -11
- package/dist/core/shaders/GradientMap/index.js +4 -7
- package/dist/core/shaders/Grayscale/index.js +4 -6
- package/dist/core/shaders/Grid/index.d.ts +2 -2
- package/dist/core/shaders/Grid/index.d.ts.map +1 -1
- package/dist/core/shaders/Grid/index.js +4 -13
- package/dist/core/shaders/GridDistortion/index.js +4 -11
- package/dist/core/shaders/Group/index.js +4 -6
- package/dist/core/shaders/HTMLInCanvas/index.js +4 -7
- package/dist/core/shaders/Halftone/index.d.ts +3 -3
- package/dist/core/shaders/Halftone/index.d.ts.map +1 -1
- package/dist/core/shaders/Halftone/index.js +4 -13
- package/dist/core/shaders/Heart/index.js +4 -5
- package/dist/core/shaders/Heatmap/index.js +4 -11
- package/dist/core/shaders/HexGrid/index.d.ts +2 -2
- package/dist/core/shaders/HexGrid/index.d.ts.map +1 -1
- package/dist/core/shaders/HexGrid/index.js +4 -13
- package/dist/core/shaders/Hologram/index.d.ts +1 -1
- package/dist/core/shaders/Hologram/index.js +4 -10
- package/dist/core/shaders/Holographic/index.js +4 -10
- package/dist/core/shaders/HueShift/index.js +4 -7
- package/dist/core/shaders/ImageTexture/index.js +4 -6
- package/dist/core/shaders/InkFlow/index.d.ts +7 -7
- package/dist/core/shaders/InkFlow/index.js +4 -8
- package/dist/core/shaders/Invert/index.js +4 -6
- package/dist/core/shaders/IrisWipe/index.js +4 -7
- package/dist/core/shaders/Irradiance/index.d.ts +1 -1
- package/dist/core/shaders/Irradiance/index.d.ts.map +1 -1
- package/dist/core/shaders/Irradiance/index.js +4 -13
- package/dist/core/shaders/IsometricCubes/index.d.ts +1 -1
- package/dist/core/shaders/IsometricCubes/index.d.ts.map +1 -1
- package/dist/core/shaders/IsometricCubes/index.js +4 -13
- package/dist/core/shaders/Kaleidoscope/index.js +4 -8
- package/dist/core/shaders/KeyFrames/index.js +4 -10
- package/dist/core/shaders/LensDistortion/index.js +4 -6
- package/dist/core/shaders/LensFlare/index.d.ts +1 -1
- package/dist/core/shaders/LensFlare/index.d.ts.map +1 -1
- package/dist/core/shaders/LensFlare/index.js +4 -12
- package/dist/core/shaders/LightEdge/index.js +4 -10
- package/dist/core/shaders/LightLeak/index.js +4 -12
- package/dist/core/shaders/Line/index.js +4 -10
- package/dist/core/shaders/LinearBlur/index.d.ts +1 -1
- package/dist/core/shaders/LinearBlur/index.d.ts.map +1 -1
- package/dist/core/shaders/LinearBlur/index.js +4 -10
- package/dist/core/shaders/LinearGradient/index.js +4 -11
- package/dist/core/shaders/LinearWipe/index.js +4 -7
- package/dist/core/shaders/LiquidMetal/index.js +4 -11
- package/dist/core/shaders/Liquify/index.js +4 -10
- package/dist/core/shaders/MagneticFilings/index.js +4 -9
- package/dist/core/shaders/Marble/index.d.ts +1 -1
- package/dist/core/shaders/Marble/index.d.ts.map +1 -1
- package/dist/core/shaders/Marble/index.js +4 -15
- package/dist/core/shaders/MeshGradient/index.js +4 -17
- package/dist/core/shaders/Mirror/index.js +4 -8
- package/dist/core/shaders/MultiPointGradient/index.js +4 -11
- package/dist/core/shaders/Nebula/index.d.ts +3 -3
- package/dist/core/shaders/Nebula/index.js +4 -13
- package/dist/core/shaders/Neon/index.js +4 -9
- package/dist/core/shaders/NoiseDissolve/index.js +4 -7
- package/dist/core/shaders/ObjectTracker/index.d.ts +1 -1
- package/dist/core/shaders/ObjectTracker/index.js +4 -10
- package/dist/core/shaders/Obsidian/index.d.ts +5 -5
- package/dist/core/shaders/Obsidian/index.js +4 -15
- package/dist/core/shaders/PagePeel/index.js +4 -10
- package/dist/core/shaders/Paper/index.d.ts +1 -1
- package/dist/core/shaders/Paper/index.d.ts.map +1 -1
- package/dist/core/shaders/Paper/index.js +4 -8
- package/dist/core/shaders/Parallelogram/index.js +4 -5
- package/dist/core/shaders/ParticleField/index.js +4 -9
- package/dist/core/shaders/ParticleFlow/index.js +4 -10
- package/dist/core/shaders/Particles/index.js +4 -9
- package/dist/core/shaders/PerlinNoise/index.d.ts +2 -2
- package/dist/core/shaders/PerlinNoise/index.d.ts.map +1 -1
- package/dist/core/shaders/PerlinNoise/index.js +5 -14
- package/dist/core/shaders/Perspective/index.js +4 -8
- package/dist/core/shaders/PixelSort/index.js +4 -8
- package/dist/core/shaders/PixelThrow/index.js +4 -8
- package/dist/core/shaders/Pixelate/index.d.ts +1 -1
- package/dist/core/shaders/Pixelate/index.d.ts.map +1 -1
- package/dist/core/shaders/Pixelate/index.js +4 -10
- package/dist/core/shaders/Plasma/index.js +4 -11
- package/dist/core/shaders/Plastic/index.js +4 -11
- package/dist/core/shaders/PolarCoordinates/index.js +4 -8
- package/dist/core/shaders/Polygon/index.js +4 -6
- package/dist/core/shaders/Posterize/index.js +4 -6
- package/dist/core/shaders/Prism/index.d.ts +2 -2
- package/dist/core/shaders/Prism/index.js +4 -12
- package/dist/core/shaders/ProgressiveBlur/index.d.ts +1 -1
- package/dist/core/shaders/ProgressiveBlur/index.d.ts.map +1 -1
- package/dist/core/shaders/ProgressiveBlur/index.js +4 -10
- package/dist/core/shaders/RadialGradient/index.js +4 -11
- package/dist/core/shaders/RadialWipe/index.js +4 -7
- package/dist/core/shaders/RandomBars/index.js +4 -7
- package/dist/core/shaders/ReactionDiffusion/index.js +4 -8
- package/dist/core/shaders/RectangularCoordinates/index.js +4 -8
- package/dist/core/shaders/ReflectivePlane/index.js +4 -10
- package/dist/core/shaders/Repeater/index.js +4 -5
- package/dist/core/shaders/Ring/index.js +4 -5
- package/dist/core/shaders/RippleWipe/index.js +4 -7
- package/dist/core/shaders/Ripples/index.d.ts +1 -1
- package/dist/core/shaders/Ripples/index.d.ts.map +1 -1
- package/dist/core/shaders/Ripples/index.js +4 -13
- package/dist/core/shaders/RoundedRect/index.js +4 -5
- package/dist/core/shaders/Saturation/index.js +4 -7
- package/dist/core/shaders/Scratches/index.d.ts +1 -1
- package/dist/core/shaders/Scratches/index.d.ts.map +1 -1
- package/dist/core/shaders/Scratches/index.js +5 -14
- package/dist/core/shaders/Sharpness/index.d.ts +1 -1
- package/dist/core/shaders/Sharpness/index.d.ts.map +1 -1
- package/dist/core/shaders/Sharpness/index.js +4 -11
- package/dist/core/shaders/Shatter/index.js +4 -6
- package/dist/core/shaders/SimplexNoise/index.d.ts +1 -1
- package/dist/core/shaders/SimplexNoise/index.d.ts.map +1 -1
- package/dist/core/shaders/SimplexNoise/index.js +5 -14
- package/dist/core/shaders/SineWave/index.js +4 -10
- package/dist/core/shaders/SliceWipe/index.js +4 -8
- package/dist/core/shaders/Smoke/index.js +4 -7
- package/dist/core/shaders/SmokeFill/index.js +4 -10
- package/dist/core/shaders/SmokeFlow/index.js +4 -7
- package/dist/core/shaders/Solarize/index.js +4 -7
- package/dist/core/shaders/SolidColor/index.js +4 -11
- package/dist/core/shaders/Sparkle/index.d.ts +57 -0
- package/dist/core/shaders/Sparkle/index.d.ts.map +1 -0
- package/dist/core/shaders/Sparkle/index.js +5 -0
- package/dist/core/shaders/Spherize/index.d.ts +1 -1
- package/dist/core/shaders/Spherize/index.d.ts.map +1 -1
- package/dist/core/shaders/Spherize/index.js +4 -10
- package/dist/core/shaders/Spiral/index.js +4 -11
- package/dist/core/shaders/Star/index.js +4 -5
- package/dist/core/shaders/Stone/index.d.ts +1 -1
- package/dist/core/shaders/Stone/index.d.ts.map +1 -1
- package/dist/core/shaders/Stone/index.js +4 -14
- package/dist/core/shaders/Strands/index.d.ts +1 -1
- package/dist/core/shaders/Strands/index.d.ts.map +1 -1
- package/dist/core/shaders/Strands/index.js +4 -13
- package/dist/core/shaders/Stretch/index.js +4 -8
- package/dist/core/shaders/Stripes/index.d.ts +1 -1
- package/dist/core/shaders/Stripes/index.d.ts.map +1 -1
- package/dist/core/shaders/Stripes/index.js +4 -13
- package/dist/core/shaders/StudioBackground/index.js +4 -14
- package/dist/core/shaders/SunBurst/index.js +4 -12
- package/dist/core/shaders/Surface3D/index.js +4 -8
- package/dist/core/shaders/Swirl/index.js +4 -11
- package/dist/core/shaders/Teardrop/index.js +4 -5
- package/dist/core/shaders/Text/index.js +4 -12
- package/dist/core/shaders/ThinFilm/index.d.ts +8 -8
- package/dist/core/shaders/ThinFilm/index.js +4 -9
- package/dist/core/shaders/TiltShift/index.d.ts +1 -1
- package/dist/core/shaders/TiltShift/index.d.ts.map +1 -1
- package/dist/core/shaders/TiltShift/index.js +4 -10
- package/dist/core/shaders/TimeTrail/index.d.ts +2 -2
- package/dist/core/shaders/TimeTrail/index.js +4 -8
- package/dist/core/shaders/Tint/index.js +4 -6
- package/dist/core/shaders/Trapezoid/index.js +4 -5
- package/dist/core/shaders/TriangularGrid/index.d.ts +1 -1
- package/dist/core/shaders/TriangularGrid/index.d.ts.map +1 -1
- package/dist/core/shaders/TriangularGrid/index.js +4 -13
- package/dist/core/shaders/Tritone/index.js +4 -6
- package/dist/core/shaders/Truchet/index.d.ts +1 -1
- package/dist/core/shaders/Truchet/index.d.ts.map +1 -1
- package/dist/core/shaders/Truchet/index.js +4 -13
- package/dist/core/shaders/Twirl/index.js +4 -8
- package/dist/core/shaders/VHS/index.d.ts +2 -2
- package/dist/core/shaders/VHS/index.d.ts.map +1 -1
- package/dist/core/shaders/VHS/index.js +4 -10
- package/dist/core/shaders/VenetianBlinds/index.js +4 -7
- package/dist/core/shaders/Vesica/index.js +4 -5
- package/dist/core/shaders/Vibrance/index.js +4 -7
- package/dist/core/shaders/VideoTexture/index.js +4 -6
- package/dist/core/shaders/Vignette/index.js +4 -8
- package/dist/core/shaders/Voronoi/index.d.ts +1 -1
- package/dist/core/shaders/Voronoi/index.d.ts.map +1 -1
- package/dist/core/shaders/Voronoi/index.js +4 -13
- package/dist/core/shaders/Voxels/index.d.ts +5 -5
- package/dist/core/shaders/Voxels/index.js +4 -14
- package/dist/core/shaders/Water/index.d.ts +3 -3
- package/dist/core/shaders/Water/index.js +4 -11
- package/dist/core/shaders/Watercolor/index.d.ts +1 -1
- package/dist/core/shaders/Watercolor/index.d.ts.map +1 -1
- package/dist/core/shaders/Watercolor/index.js +4 -10
- package/dist/core/shaders/WaveDistortion/index.js +4 -8
- package/dist/core/shaders/Waveform/index.js +4 -16
- package/dist/core/shaders/WaveletNoise/index.d.ts +1 -1
- package/dist/core/shaders/WaveletNoise/index.d.ts.map +1 -1
- package/dist/core/shaders/WaveletNoise/index.js +5 -14
- package/dist/core/shaders/Weave/index.d.ts +1 -1
- package/dist/core/shaders/Weave/index.d.ts.map +1 -1
- package/dist/core/shaders/Weave/index.js +4 -13
- package/dist/core/shaders/WebcamTexture/index.js +4 -6
- package/dist/core/shaders/Wool/index.d.ts +1 -1
- package/dist/core/shaders/Wool/index.d.ts.map +1 -1
- package/dist/core/shaders/Wool/index.js +4 -14
- package/dist/core/shaders/WorleyNoise/index.d.ts +1 -1
- package/dist/core/shaders/WorleyNoise/index.d.ts.map +1 -1
- package/dist/core/shaders/WorleyNoise/index.js +4 -13
- package/dist/core/shaders/ZoomBlur/index.d.ts +1 -1
- package/dist/core/shaders/ZoomBlur/index.d.ts.map +1 -1
- package/dist/core/shaders/ZoomBlur/index.js +4 -10
- package/dist/core/std/effects/blurs.d.ts +656 -138
- package/dist/core/std/effects/blurs.d.ts.map +1 -1
- package/dist/core/std/effects/color.d.ts +209 -32
- package/dist/core/std/effects/color.d.ts.map +1 -1
- package/dist/core/std/effects/edgeGlow.d.ts +86 -17
- package/dist/core/std/effects/edgeGlow.d.ts.map +1 -1
- package/dist/core/std/effects/fracture.d.ts +72 -8
- package/dist/core/std/effects/fracture.d.ts.map +1 -1
- package/dist/core/std/effects/index.d.ts +15 -0
- package/dist/core/std/effects/index.d.ts.map +1 -0
- package/dist/core/std/effects/instances.d.ts +87 -8
- package/dist/core/std/effects/instances.d.ts.map +1 -1
- package/dist/core/std/effects/lens.d.ts +48 -12
- package/dist/core/std/effects/lens.d.ts.map +1 -1
- package/dist/core/std/effects/overlay.d.ts +63 -22
- package/dist/core/std/effects/overlay.d.ts.map +1 -1
- package/dist/core/std/effects/pointerFields.d.ts +45 -20
- package/dist/core/std/effects/pointerFields.d.ts.map +1 -1
- package/dist/core/std/effects/reveal.d.ts +118 -40
- package/dist/core/std/effects/reveal.d.ts.map +1 -1
- package/dist/core/std/effects/stylize.d.ts +139 -70
- package/dist/core/std/effects/stylize.d.ts.map +1 -1
- package/dist/core/std/filter.d.ts +72 -12
- package/dist/core/std/filter.d.ts.map +1 -1
- package/dist/core/std/frames.d.ts +91 -24
- package/dist/core/std/frames.d.ts.map +1 -1
- package/dist/core/std/index.d.ts +46 -8
- package/dist/core/std/index.d.ts.map +1 -1
- package/dist/core/std/index.js +4 -0
- package/dist/core/std/invoke.d.ts +107 -12
- package/dist/core/std/invoke.d.ts.map +1 -1
- package/dist/core/std/lists.d.ts +40 -10
- package/dist/core/std/lists.d.ts.map +1 -1
- package/dist/core/std/lower.d.ts +73 -1
- package/dist/core/std/lower.d.ts.map +1 -1
- package/dist/core/std/mask.d.ts +60 -17
- package/dist/core/std/mask.d.ts.map +1 -1
- package/dist/core/std/math.d.ts +484 -9
- package/dist/core/std/math.d.ts.map +1 -1
- package/dist/core/std/motion.d.ts +130 -10
- package/dist/core/std/motion.d.ts.map +1 -1
- package/dist/core/std/paint/compose.d.ts +57 -16
- package/dist/core/std/paint/compose.d.ts.map +1 -1
- package/dist/core/std/paint/fields.d.ts +378 -95
- package/dist/core/std/paint/fields.d.ts.map +1 -1
- package/dist/core/std/paint/figures.d.ts +32 -17
- package/dist/core/std/paint/figures.d.ts.map +1 -1
- package/dist/core/std/paint/gradients.d.ts +58 -25
- package/dist/core/std/paint/gradients.d.ts.map +1 -1
- package/dist/core/std/paint/light.d.ts +501 -77
- package/dist/core/std/paint/light.d.ts.map +1 -1
- package/dist/core/std/paint/materials.d.ts +678 -151
- package/dist/core/std/paint/materials.d.ts.map +1 -1
- package/dist/core/std/paint/media.d.ts +47 -32
- package/dist/core/std/paint/media.d.ts.map +1 -1
- package/dist/core/std/paint/noise.d.ts +436 -87
- package/dist/core/std/paint/noise.d.ts.map +1 -1
- package/dist/core/std/paint/patterns.d.ts +474 -92
- package/dist/core/std/paint/patterns.d.ts.map +1 -1
- package/dist/core/std/paint/radiance.d.ts +75 -29
- package/dist/core/std/paint/radiance.d.ts.map +1 -1
- package/dist/core/std/paint/volume.d.ts +68 -27
- package/dist/core/std/paint/volume.d.ts.map +1 -1
- package/dist/core/std/paint/voxels.d.ts +46 -26
- package/dist/core/std/paint/voxels.d.ts.map +1 -1
- package/dist/core/std/shape.d.ts +195 -1
- package/dist/core/std/shape.d.ts.map +1 -1
- package/dist/core/std/signal.d.ts +55 -15
- package/dist/core/std/signal.d.ts.map +1 -1
- package/dist/core/std/sim/agentForces.d.ts +441 -99
- package/dist/core/std/sim/agentForces.d.ts.map +1 -1
- package/dist/core/std/sim/agentFrame.d.ts +94 -20
- package/dist/core/std/sim/agentFrame.d.ts.map +1 -1
- package/dist/core/std/sim/agentRender.d.ts +187 -60
- package/dist/core/std/sim/agentRender.d.ts.map +1 -1
- package/dist/core/std/sim/agents.d.ts +99 -28
- package/dist/core/std/sim/agents.d.ts.map +1 -1
- package/dist/core/std/sim/feedback.d.ts +40 -19
- package/dist/core/std/sim/feedback.d.ts.map +1 -1
- package/dist/core/std/sim/fluids.d.ts +127 -63
- package/dist/core/std/sim/fluids.d.ts.map +1 -1
- package/dist/core/std/sim/grids.d.ts +200 -48
- package/dist/core/std/sim/grids.d.ts.map +1 -1
- package/dist/core/std/sim/index.d.ts +14 -0
- package/dist/core/std/sim/index.d.ts.map +1 -0
- package/dist/core/std/sim/shapeFields.d.ts +56 -0
- package/dist/core/std/sim/shapeFields.d.ts.map +1 -1
- package/dist/core/std/sim.d.ts +112 -10
- package/dist/core/std/sim.d.ts.map +1 -1
- package/dist/core/std/slots.d.ts +72 -6
- package/dist/core/std/slots.d.ts.map +1 -1
- package/dist/core/std/types.d.ts +97 -60
- package/dist/core/std/types.d.ts.map +1 -1
- package/dist/core/std/values.d.ts +33 -14
- package/dist/core/std/values.d.ts.map +1 -1
- package/dist/core/std/warps.d.ts +221 -76
- package/dist/core/std/warps.d.ts.map +1 -1
- package/dist/core/std/wgsl.d.ts +115 -0
- package/dist/core/std/wgsl.d.ts.map +1 -0
- package/dist/core/std-ClftfWpF.js +218889 -0
- package/dist/core/{support-GJphyuEe.js → support-D3W86vgR.js} +11 -1
- package/dist/core/telemetry/index.js +1 -1
- package/dist/core/utilities/colorStops.d.ts +2 -2
- package/dist/core/utilities/listProps.d.ts +2 -2
- package/dist/core/utilities/listProps.d.ts.map +1 -1
- package/dist/core/utilities/noiseColor.d.ts +3 -3
- package/dist/core/utilities/transformations/index.js +1 -1
- package/dist/js/bundle.js +182 -180
- package/dist/js/createShader.d.ts.map +1 -1
- package/dist/js/createShader.js +4 -3
- package/dist/js/types.d.ts +5 -0
- package/dist/js/types.d.ts.map +1 -1
- package/dist/js/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/js/utils/generatePresetCode.js +35 -22
- package/dist/react/CustomShader.js +178 -0
- package/dist/react/Preview.js +1 -0
- package/dist/react/Shader.js +1 -1
- package/dist/react/Sparkle.js +226 -0
- package/dist/react/bundle.js +178 -176
- package/dist/react/components/Sparkle.d.ts +41 -0
- package/dist/react/components/Sparkle.d.ts.map +1 -0
- package/dist/react/engine/CustomShader.d.ts +37 -0
- package/dist/react/engine/CustomShader.d.ts.map +1 -0
- package/dist/react/engine/Preview.d.ts.map +1 -1
- package/dist/react/index.d.ts +5 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +4 -2
- package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/react/utils/generatePresetCode.js +35 -22
- package/dist/registry.js +410 -158
- package/dist/solid/components/Sparkle.d.ts +38 -0
- package/dist/solid/components/Sparkle.d.ts.map +1 -0
- package/dist/solid/components/Sparkle.js +232 -0
- package/dist/solid/engine/CustomShader.d.ts +35 -0
- package/dist/solid/engine/CustomShader.d.ts.map +1 -0
- package/dist/solid/engine/CustomShader.js +160 -0
- package/dist/solid/engine/Preview.d.ts.map +1 -1
- package/dist/solid/engine/Preview.js +319 -317
- package/dist/solid/engine/Shader.js +1 -1
- package/dist/solid/index.d.ts +5 -0
- package/dist/solid/index.d.ts.map +1 -1
- package/dist/solid/index.js +95 -86
- package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/solid/utils/generatePresetCode.js +35 -22
- package/dist/svelte/components/Sparkle.svelte.d.ts +28 -0
- package/dist/svelte/engine/CustomShader.svelte.d.ts +40 -0
- package/dist/svelte/index.d.ts +4 -0
- package/dist/svelte/index.js +1237 -877
- package/dist/svelte/source/components/Sparkle.svelte +352 -0
- package/dist/svelte/source/engine/CustomShader.svelte +216 -0
- package/dist/svelte/source/engine/Preview.svelte +5 -3
- package/dist/svelte/source/index.js +4 -0
- package/dist/svelte/utils/generatePresetCode.js +35 -22
- package/dist/vue/CustomShader.js +3 -0
- package/dist/vue/CustomShader.vue_vue_type_script_setup_true_lang.js +173 -0
- package/dist/vue/Preview.vue_vue_type_script_setup_true_lang.js +2 -0
- package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/vue/Sparkle.js +3 -0
- package/dist/vue/Sparkle.vue_vue_type_script_setup_true_lang.js +233 -0
- package/dist/vue/components/Sparkle.vue.d.ts +63 -0
- package/dist/vue/components/Sparkle.vue.d.ts.map +1 -0
- package/dist/vue/index.d.ts +4 -0
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +4 -2
- package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/vue/utils/generatePresetCode.js +35 -22
- package/package.json +27 -2
- package/dist/core/Irradiance-B36wYze9.js +0 -4191
- package/dist/core/LightEdge-AFfkNhDP.js +0 -2339
- package/dist/core/Repeater-C5LILb_Y.js +0 -762
- package/dist/core/Shatter-Dz3sH2ON.js +0 -1479
- package/dist/core/Voxels-Ca-6rRrz.js +0 -8547
- package/dist/core/agents-CBSp2UK_.js +0 -15709
- package/dist/core/agents-DXoEcto0.js +0 -5357
- package/dist/core/blur-7yjVyMvI.js +0 -8015
- package/dist/core/blurs-d4B9aUyx.js +0 -1751
- package/dist/core/canvasRaster-DDBkrdY8.js +0 -80
- package/dist/core/color-Do6tU0ry.js +0 -3619
- package/dist/core/compose-Dkf3v-xS.js +0 -46
- package/dist/core/device-m0ud8-Fn.js +0 -10
- package/dist/core/feedback-Dro_hxd4.js +0 -46
- package/dist/core/fields-DgADOKsP.js +0 -475
- package/dist/core/figures-B3lUGP8u.js +0 -48
- package/dist/core/filter-BrhpSs3Z.js +0 -23
- package/dist/core/fluids-umEWgdvj.js +0 -226
- package/dist/core/fonts-BUXTd9qb.js +0 -59
- package/dist/core/frames-BLqt7oaW.js +0 -78
- package/dist/core/glass-ABppDbYG.js +0 -2532
- package/dist/core/gradientPaints-5HpJVNfb.js +0 -6564
- package/dist/core/gradients-CIxKrfME.js +0 -159
- package/dist/core/grids-Cv99xcJg.js +0 -151
- package/dist/core/lens-DJQNJKCW.js +0 -352
- package/dist/core/light-D3BIVkxy.js +0 -271
- package/dist/core/lightfields-DvrUaH_6.js +0 -2255
- package/dist/core/lower-Bd2jez_2.js +0 -49452
- package/dist/core/mask-CeSwL79Q.js +0 -28
- package/dist/core/materials-4Oqvm_9m.js +0 -2944
- package/dist/core/math-D864seEs.js +0 -56
- package/dist/core/media-DXUY3ltG.js +0 -832
- package/dist/core/mediaLifecycle-BTPb5i1-.js +0 -320
- package/dist/core/motionBlur-g_WSi2iq.js +0 -6766
- package/dist/core/noise-d7rmP9yc.js +0 -546
- package/dist/core/noisePaints-CfHcXL02.js +0 -3619
- package/dist/core/noiseStylize-CUrW_HiC.js +0 -65
- package/dist/core/overlay-D5w0585O.js +0 -4712
- package/dist/core/patterns-Bg8lSdqH.js +0 -9723
- package/dist/core/pointerFields-CRecZwuZ.js +0 -2339
- package/dist/core/porters-OTkIMOyl.js +0 -30201
- package/dist/core/reveal-CfaAg-rg.js +0 -1688
- package/dist/core/sdf3d-2AWC_wdn.js +0 -21082
- package/dist/core/shaderRegistry-BUvL8ZZS.js +0 -443
- package/dist/core/shape-CAkSlCi8.js +0 -20
- package/dist/core/shapePaints-Bg2UwCZo.js +0 -3354
- package/dist/core/signal-emJuvOI3.js +0 -34
- package/dist/core/slots-BqIef2iV.js +0 -32
- package/dist/core/stylize-DiuoSq16.js +0 -4541
- package/dist/core/tone-BKhfiOBn.js +0 -763
- package/dist/core/warpMaps-Y8xSo-QJ.js +0 -10773
- package/dist/core/warps-P5O3NWLe.js +0 -276
- /package/dist/core/{transformations-CzFmhZww.js → transformations-P50Uo_Ju.js} +0 -0
|
@@ -0,0 +1,1558 @@
|
|
|
1
|
+
# Shaders std vocabulary (engine 4.0.0)
|
|
2
|
+
|
|
3
|
+
Compose shaders from these words with `defineShader` from `shaders/std`. Every word is a plain TypeScript
|
|
4
|
+
function; the engine lowers the composition to WGSL at runtime. A `wgsl` body is the escape hatch.
|
|
5
|
+
|
|
6
|
+
## Defining a shader
|
|
7
|
+
|
|
8
|
+
### defineShader & wgsl (`shaders/std` top level) — https://shaders.com/docs/primitives/define
|
|
9
|
+
|
|
10
|
+
A shader is a plain object: a name, the props a user can set, and one field that says what it
|
|
11
|
+
draws. Hand it to `defineShader` and it becomes a component you can mount, nest, blend, mask
|
|
12
|
+
and animate like any shader in the library.
|
|
13
|
+
|
|
14
|
+
- `defineShader<T extends ComponentProps>(definition: StdDefinition<T>): GpuShaderDefinition<T>` — Define a shader component from a plain object: its props, and one field that says what it draws.
|
|
15
|
+
- `wgsl(spec: WgslSpec): WgslBody
|
|
16
|
+
wgsl(body: string): WgslBody
|
|
17
|
+
wgsl(strings: TemplateStringsArray, ...values: unknown[]): WgslBody` — Write the per-pixel math by hand, as one WGSL function body that returns a `vec4f` color.
|
|
18
|
+
- `registerShader<T extends GpuShaderDefinition<any>>(definition: T): T` — Make a user-defined shader findable by its `name`, so preset JSON can reference it as `type: 'Halo'`.
|
|
19
|
+
- `unregisterShader(name: string): void` — Forget a user-defined shader by name.
|
|
20
|
+
- `getRegisteredShader(name: string): GpuShaderDefinition | undefined` — Look up a user-defined shader by name.
|
|
21
|
+
- `getRegisteredShaders(): GpuShaderDefinition[]` — Every user-defined shader currently registered, oldest first.
|
|
22
|
+
- `onShaderRegistered(listener: (name: string, definition: GpuShaderDefinition | null) => void): () => void` — Be told when a user-defined shader is registered, replaced or removed.
|
|
23
|
+
- `class WgslBody` — What `wgsl` returns: a body ready to sit in `paint:` or `effect:`.
|
|
24
|
+
|
|
25
|
+
### Props & values (`shaders/std` top level) — https://shaders.com/docs/primitives/values
|
|
26
|
+
|
|
27
|
+
How a definition points at its own props. `p('radius')` is a **prop ref**: hand it to any word
|
|
28
|
+
that takes a color, a position or a number and the word reads that prop live on the GPU, with
|
|
29
|
+
drivers and animation applied, and no rebuild when the value changes. A **Scalar** is a number
|
|
30
|
+
built from props and masks. `radialMask(…)` returns one, so does `oscillating(…)` from
|
|
31
|
+
`motion`, and `.times(p('intensity'))` scales one by a prop. Words that take a `ScalarInput`
|
|
32
|
+
accept either a prop ref or a Scalar.
|
|
33
|
+
|
|
34
|
+
- `p(name: string): PropRef` — Reference one of the definition's props by name, wherever a word asks for a value.
|
|
35
|
+
- `class Scalar` — A number built from props: what `radialMask(…)`, `motion.oscillating(…)` and `.times()` return.
|
|
36
|
+
|
|
37
|
+
### Identity & recompile rules (`shaders/std` top level) — https://shaders.com/docs/primitives/slots
|
|
38
|
+
|
|
39
|
+
Two small kinds of rule that make a filter cheap. An **identity rule** sits on a filter
|
|
40
|
+
definition's `identityWhen:` and says when the filter does nothing: while it holds, the layer
|
|
41
|
+
inside passes through untouched and the effect costs no GPU time. A **recompile rule** sits
|
|
42
|
+
on a prop's `recompile:` and says which changes rebuild the shader rather than just update a
|
|
43
|
+
value.
|
|
44
|
+
|
|
45
|
+
- `crosses(value: number): RecompileRule` — Rebuild the shader only when the prop crosses `value`, not on every change.
|
|
46
|
+
- `isZero(prop: string): IdentityRule` — Skip the filter entirely while `prop` is exactly 0.
|
|
47
|
+
- `isValue(prop: string, value: unknown): IdentityRule` — Skip the filter entirely while `prop` equals `value`, for a filter whose no-op is not 0.
|
|
48
|
+
- `allOf(...rules: IdentityRule[]): IdentityRule` — Skip the filter only while every rule holds, for a no-op that needs several props at rest.
|
|
49
|
+
- `identityWhenever(props: string[], when: (values: Record<string, unknown>) => boolean): IdentityRule` — Skip the filter when your own test of the props' values says so.
|
|
50
|
+
- `recompileWhen(predicate: (prev: any, next: any) => boolean): RecompileRule` — Rebuild when your own test of the old and new value says so, for a threshold `crosses` cannot express.
|
|
51
|
+
|
|
52
|
+
### Context & invocation (`shaders/std` top level) — https://shaders.com/docs/primitives/invoke
|
|
53
|
+
|
|
54
|
+
The **context** is what every pixel knows about its surroundings: its coordinate (`uv`, 0–1
|
|
55
|
+
across the canvas with y down), the clock (`time`, in seconds), the canvas shape (`aspect`,
|
|
56
|
+
`viewportSize`) and the mouse (`pointer`). `ctx` names these as tokens you can pass to a word
|
|
57
|
+
or bind in a `wgsl` body's `inputs`.
|
|
58
|
+
|
|
59
|
+
- `ctx.uv: CtxToken` — The pixel's coordinate: 0–1 across the canvas, y down.
|
|
60
|
+
- `ctx.time: CtxToken` — The global clock in seconds.
|
|
61
|
+
- `ctx.aspect: CtxToken` — The canvas's width divided by its height.
|
|
62
|
+
- `ctx.pointer: CtxToken` — The mouse position in uv (0–1, y down).
|
|
63
|
+
- `ctx.viewportSize: CtxToken` — The frame size in device pixels, as a `vec2f`.
|
|
64
|
+
- `ctx.logicalViewportSize: CtxToken` — The frame size in CSS pixels, as a `vec2f`, for feature counts that should not change with screen density.
|
|
65
|
+
- `paintFrame(params: GpuFragmentParams): {uv: Expr; viewport: Expr}` — The coordinate and frame size a hand-written `paint:` builder should draw in.
|
|
66
|
+
- `uniformOf(ref: PropRef, params: {uniforms: Record<string, Expr>}): Expr` — The live GPU value of a prop, for a hand-written builder: `uniformOf(p('radius'), params)`.
|
|
67
|
+
- `resolveScalar(input: Scalar | ScalarSource, params: SlotParams): Expr` — A `Scalar` or prop ref as a GPU value, for a hand-written builder.
|
|
68
|
+
- `resolveArg(spec: ArgSpec, params: FilterParams): Expr` — Any input value a word accepts (a prop ref, a `Scalar`, a context token, a number) as a GPU value inside a filter's builder.
|
|
69
|
+
- `resolveArgIn(spec: ArgSpec, params: SlotParams): Expr` — `resolveArg` for any host, including a warp's `map:` factory.
|
|
70
|
+
- `pointwiseOp(fn: unknown, hint: string, args: ArgSpec[], extra?: {compose?: PointwiseEffect['compose']; setup?: PointwiseEffect['setup']}): PointwiseEffect` — Wrap a compiled GPU function as a pointwise filter effect: the child's color goes in first, then `args`.
|
|
71
|
+
|
|
72
|
+
### List props (`shaders/std` top level) — https://shaders.com/docs/primitives/lists
|
|
73
|
+
|
|
74
|
+
A **list prop** holds any number of items of the same shape: lights, points, anchors. Declare
|
|
75
|
+
it with `listPropConfig`: each item is a small record of typed fields (`position`, `color`,
|
|
76
|
+
`number`, `boolean`) and the list has a `maxItems` cap. The editor renders it as an add and
|
|
77
|
+
remove list, every position field becomes a draggable handle, and any position can follow the
|
|
78
|
+
mouse. Adding or removing an item at runtime never rebuilds the shader.
|
|
79
|
+
|
|
80
|
+
- `listOf(params: {uniforms: Record<string, Expr>}, prop: string): ListRef` — Read a list prop inside a hand-written builder: its live item count and each item's fields.
|
|
81
|
+
- `accumulate(list: ListRef, body: (i: Expr) => Expr, opts: {zero?: 'f32' | 'vec3f'; deps?: Expr[]; hint?: string} = {}): Expr` — Add up a per-item value over every item of a list, in a real GPU loop over the live count.
|
|
82
|
+
|
|
83
|
+
## Painting
|
|
84
|
+
|
|
85
|
+
### Fields, palettes & ramps (`import {paint} from 'shaders/std'`) — https://shaders.com/docs/primitives/paint
|
|
86
|
+
|
|
87
|
+
The words every gradient and most textures are drawn with. A **field** is a number per pixel
|
|
88
|
+
(`Field`): the distance from a point, a noise value, a flow pattern. A **palette** turns a
|
|
89
|
+
number into a color (`Palette`): two colors, or a multi-stop ramp, mixed in the color space
|
|
90
|
+
your definition declares. `rampOver` joins the two and is the single most common line in a
|
|
91
|
+
generator.
|
|
92
|
+
|
|
93
|
+
- `rampOver(field: Field, palette: Palette, opts?: {edges?: PropRef}): Paint` — A paint that colors each pixel by looking its field value up in a palette.
|
|
94
|
+
- `pair(a: PropRef, b: PropRef, space: PropRef): Palette` — A palette of two color props, mixed in the color space named by the `space` prop.
|
|
95
|
+
- `stops(space: PropRef): Palette` — The standard multi-stop palette, read from the `stops`, `colorA` and `colorB` props.
|
|
96
|
+
- `standardPalette(t: Expr, params: GpuFragmentParams): Expr` — The color for a 0–1 value from the standard palette props: `colorA`, `colorB`, `stops`, `colorSpace`.
|
|
97
|
+
- `noiseField(basis: NoiseBasis): Field` — A field of smooth noise in the chosen flavor.
|
|
98
|
+
- `warped(field: Field, opts: {amount: FieldScalar; amountScale?: number; timeScale?: number}): Field` — Makes a field flow like liquid by bending its coordinate with moving noise.
|
|
99
|
+
- `scaledVolume(field: Field, opts: {scale: FieldScalar}): Field` — Gives a noise field a zoomable, aspect-correct coordinate.
|
|
100
|
+
- `tone(field: Field, opts: {glow: FieldScalar; contrast: FieldScalar; balance: FieldScalar; invert: true}): Field` — Reshapes a 0–1 field with glow, contrast and balance controls, then flips it.
|
|
101
|
+
- `threshold(field: Field, opts: {low: number; high: number; bias?: FieldScalar}): Field` — Turns a signed field (−1 to 1) into a soft 0–1 mask.
|
|
102
|
+
- `rings(field: Field, count: FieldScalar): Field` — Repeats a field as concentric bands.
|
|
103
|
+
- `tiles(field: Field, count: FieldScalar): Field` — Repeats a field `count` times, always wrapping.
|
|
104
|
+
- `share(field: Field): Field` — Evaluates a field once and lets several words read the same result.
|
|
105
|
+
- `flowField(slots: {detail: FieldScalar}): Field` — A swirling, animated wave pattern from −1 to 1.
|
|
106
|
+
- `pulse(field: Field, opts: {speed: number; span: number; depth: number}): Field` — A gentle brightness pulse that follows a pattern field, hovering around 1.
|
|
107
|
+
- `shimmered(paint: Paint, gain: Field): Paint` — Multiplies a paint's color and alpha by a gain field, for a slow shimmer over a pattern.
|
|
108
|
+
- `wrapRamp(opts: {t: Expr; cycles: Expr | number}): Expr` — Runs a palette value back and forth `cycles` times so a ramp repeats without a seam.
|
|
109
|
+
- `foldRamp(t: Expr): Expr` — Folds any number into 0–1 as a seamless zigzag: up from 0 to 1, back down, every 2 units.
|
|
110
|
+
- `warpedPoint(opts: {at: Expr; time: Expr | number; amount: Expr | number; levels?: 1 | 2}): Expr` — A 3D position pushed around by moving noise, for reading several fields at one warped spot.
|
|
111
|
+
- `warpStep(opts: {
|
|
112
|
+
at: Expr
|
|
113
|
+
scale: number
|
|
114
|
+
z: Expr | number
|
|
115
|
+
offsets: [[number, number], [number, number]]
|
|
116
|
+
reach: number
|
|
117
|
+
strength: Expr | number
|
|
118
|
+
}): Expr` — One step of a chained warp: pushes a 2D position by two noise reads and hands them back.
|
|
119
|
+
- `scatterField(opts: {
|
|
120
|
+
at: Expr
|
|
121
|
+
count: Expr | number
|
|
122
|
+
seed: Expr | number
|
|
123
|
+
drift: Expr | number
|
|
124
|
+
aspect: Expr | number
|
|
125
|
+
time: Expr | number
|
|
126
|
+
softness: Expr | number
|
|
127
|
+
/** The points precomputed each frame by `scatteredAnchors`. When given, `drift`, `aspect` and `time` are ignored here. */
|
|
128
|
+
anchors?: Expr
|
|
129
|
+
}): Expr` — A mesh-gradient field: up to 8 drifting points scattered across the canvas, blended by nearness.
|
|
130
|
+
- `scatteredAnchors(params: GpuFragmentParams, slots: {count: PropRef; seed: PropRef; drift: PropRef; field: string}): Expr` — Computes the `scatterField` points once per frame instead of once per pixel.
|
|
131
|
+
- `quadBlend(slots: {a: PropRef; b: PropRef; c: PropRef; d: PropRef; space: PropRef}): (t1: Expr, t2: Expr, params: GpuFragmentParams) => Expr` — A four-color blend on a square: `a` to `b` across the top, `c` to `d` across the bottom, then top to bottom.
|
|
132
|
+
- `colorLadder3(slots: {a: PropRef; b: PropRef; c: PropRef; space: PropRef}): (t1: Expr, t2: Expr, params: GpuFragmentParams) => Expr` — A three-color blend: `a` to `b` by the first value, then on to `c` by the second.
|
|
133
|
+
- `hueWheel(h: Expr): Expr` — A rainbow color for a hue value: 0 is red, cycling through the spectrum and back every 1.
|
|
134
|
+
- `dist.conic(slots: {center: PropRef; rotation: FieldScalar}): Field` — A sweep around a center, like a clock hand: 0 to 1 once around.
|
|
135
|
+
- `dist.diamond(slots: {center: PropRef; size: FieldScalar; rotation: FieldScalar; roundness: FieldScalar}): Field` — A diamond-shaped gradient spreading out from a center.
|
|
136
|
+
- `dist.linear(slots: {from: PropRef; to: PropRef; angle: FieldScalar}): Field` — A straight gradient from one point to another.
|
|
137
|
+
- `dist.radial(slots: {center: PropRef; radius: FieldScalar; aspect: FieldScalar; skew: FieldScalar}): Field` — A round or elliptical gradient spreading out from a center.
|
|
138
|
+
- `dist.spiral(slots: {center: PropRef; scale: FieldScalar; width: FieldScalar; falloff: FieldScalar; softness: FieldScalar}): Field` — A turning spiral stripe: 0 on the background, 1 on the stroke.
|
|
139
|
+
|
|
140
|
+
### Gradients (`import {gradients} from 'shaders/std'`) — https://shaders.com/docs/primitives/gradients
|
|
141
|
+
|
|
142
|
+
Finished gradient paints: a flat fill, a color wheel that cycles over time, a cloud of five
|
|
143
|
+
colored points, and a beam of light between two points. Each word binds your props and
|
|
144
|
+
returns a paint, so a definition is the props plus one line. They are complete looks rather
|
|
145
|
+
than building blocks. For a gradient of your own shape, compose a `dist` field with `rampOver`
|
|
146
|
+
from the fields words instead.
|
|
147
|
+
|
|
148
|
+
- `solidColor(color: PropRef): Paint` — A flat fill in one color prop.
|
|
149
|
+
- `beam(slots: {
|
|
150
|
+
from: PropRef
|
|
151
|
+
to: PropRef
|
|
152
|
+
thickness: {start: ArgSpec; end: ArgSpec}
|
|
153
|
+
softness: {start: ArgSpec; end: ArgSpec}
|
|
154
|
+
colors: {inside: PropRef; outside: PropRef}
|
|
155
|
+
space: PropRef
|
|
156
|
+
}): Paint` — A glowing beam of light between two points.
|
|
157
|
+
- `colorWheel(slots: {
|
|
158
|
+
mode: PropRef
|
|
159
|
+
direction: ArgSpec
|
|
160
|
+
scale: ArgSpec
|
|
161
|
+
palette: {a: PropRef; b: PropRef; c: PropRef}
|
|
162
|
+
space: PropRef
|
|
163
|
+
}): Paint` — A striped gradient that slides across the canvas, cycling through its colors over time.
|
|
164
|
+
- `pointCloudGradient(slots: {
|
|
165
|
+
points: {color: PropRef; position: PropRef}[]
|
|
166
|
+
smoothness: ArgSpec
|
|
167
|
+
space: PropRef
|
|
168
|
+
}): Paint` — Five colored points placed anywhere on the canvas, each pixel taking the colors of the points nearest it.
|
|
169
|
+
|
|
170
|
+
### Patterns & tiling (`import {patterns} from 'shaders/std'`) — https://shaders.com/docs/primitives/patterns
|
|
171
|
+
|
|
172
|
+
Repeating patterns you can color and animate: checkers, stripes, zigzags, rings, falling
|
|
173
|
+
streaks, and tiled lattices of squares, hexagons, triangles, bricks, truchet arcs, woven
|
|
174
|
+
threads and isometric cubes, plus the print-screen filters (halftone dots, CMYK plates and
|
|
175
|
+
dithering). Most pattern words return a **mask**: a number per pixel that is 1 on the pattern
|
|
176
|
+
and 0 off it. The lattice words also return a per-cell **shade**, a brightness factor around 1
|
|
177
|
+
that `vary` multiplies into a fill so every tile reads slightly different.
|
|
178
|
+
|
|
179
|
+
- `strokeOver(layers: {fill: PaintSlot; stroke: PaintSlot; mask: PaintSlot; space?: PropRef}): PatternPaint` — Two colors mixed through a mask: `fill` where the mask is 0, `stroke` where it is 1.
|
|
180
|
+
- `withAlpha(color: PaintSlot, alpha: PaintSlot): PatternPaint` — A color with its alpha replaced by a separately built mask.
|
|
181
|
+
- `checkerCells(slots: {cells: PropRef; softness: PropRef}): PatternPaint` — A checkerboard mask: 1 on one set of squares, 0 on the other, with clean edges at any size.
|
|
182
|
+
- `stripeBands(slots: {
|
|
183
|
+
angle: PropRef
|
|
184
|
+
density: PropRef
|
|
185
|
+
balance: PropRef
|
|
186
|
+
softness: PropRef
|
|
187
|
+
offset: PropRef
|
|
188
|
+
}): PatternPaint` — A mask of straight parallel stripes that scroll with the layer's clock.
|
|
189
|
+
- `zigzagBands(slots: {
|
|
190
|
+
count: PropRef
|
|
191
|
+
angle: PropRef
|
|
192
|
+
balance: PropRef
|
|
193
|
+
softness: PropRef
|
|
194
|
+
offset: PropRef
|
|
195
|
+
}): PatternPaint` — A mask of chevron (zigzag) stripes that scroll with the layer's clock.
|
|
196
|
+
- `ringWaves(slots: {
|
|
197
|
+
center: PropRef
|
|
198
|
+
frequency: PropRef
|
|
199
|
+
thickness: PropRef
|
|
200
|
+
softness: PropRef
|
|
201
|
+
phase: PropRef
|
|
202
|
+
}): PatternPaint` — A mask of concentric rings spreading out from a point, animated by the layer's clock.
|
|
203
|
+
- `fallingStreaks(slots: {
|
|
204
|
+
angle: PropRef
|
|
205
|
+
density: PropRef
|
|
206
|
+
speedVariance: PropRef
|
|
207
|
+
trailLength: PropRef
|
|
208
|
+
strokeWidth: PropRef
|
|
209
|
+
rounding: PropRef
|
|
210
|
+
balance: PropRef
|
|
211
|
+
}): {mask: PatternPaint; fade: PatternPaint}` — Streaks that fall across the canvas in columns, each column at its own random speed.
|
|
212
|
+
- `dotLattice(slots: {
|
|
213
|
+
density: PropRef
|
|
214
|
+
dotSize: PropRef
|
|
215
|
+
offset: PropRef
|
|
216
|
+
speedVariance: PropRef
|
|
217
|
+
twinkle: PropRef
|
|
218
|
+
}): PatternPaint` — A mask of round dots on a square grid, with optional row stagger, drift and twinkle.
|
|
219
|
+
- `cellFrame(slots: {cells: PropRef; rotation: PropRef; convention: CellFrameConvention}): PatternPaint` — The shared coordinate system of a tiled pattern: how many cells fit down the canvas height and how far the whole lattice is rotated.
|
|
220
|
+
- `gridLines(slots: {
|
|
221
|
+
frame: PatternPaint
|
|
222
|
+
thickness: PropRef
|
|
223
|
+
softness: PropRef
|
|
224
|
+
variation: PropRef
|
|
225
|
+
}): {lines: PatternPaint; shade: PatternPaint}` — Square grid lines drawn in a `cellFrame`, plus a per-cell shade for the fill.
|
|
226
|
+
- `hexLines(slots: {
|
|
227
|
+
frame: PatternPaint
|
|
228
|
+
thickness: PropRef
|
|
229
|
+
softness: PropRef
|
|
230
|
+
variation: PropRef
|
|
231
|
+
}): {lines: PatternPaint; shade: PatternPaint}` — Honeycomb lines (pointy-top hexagons) drawn in a `cellFrame`, plus a per-cell shade.
|
|
232
|
+
- `triangleLines(slots: {
|
|
233
|
+
frame: PatternPaint
|
|
234
|
+
thickness: PropRef
|
|
235
|
+
softness: PropRef
|
|
236
|
+
variation: PropRef
|
|
237
|
+
speedVariance: PropRef
|
|
238
|
+
}): {lines: PatternPaint; shade: PatternPaint}` — A lattice of equilateral triangles drawn in a `cellFrame`, with rows that can drift.
|
|
239
|
+
- `brickCourses(slots: {
|
|
240
|
+
cellsX: PropRef
|
|
241
|
+
cellsY: PropRef
|
|
242
|
+
mortar: PropRef
|
|
243
|
+
softness: PropRef
|
|
244
|
+
variation: PropRef
|
|
245
|
+
rotation: PropRef
|
|
246
|
+
offset: PropRef
|
|
247
|
+
speedVariance: PropRef
|
|
248
|
+
seed: PropRef
|
|
249
|
+
}): {bricks: PatternPaint; shade: PatternPaint}` — A brick wall: staggered rows with mortar gaps, optional rotation and per-row drift.
|
|
250
|
+
- `truchetArcs(slots: {
|
|
251
|
+
frame: PatternPaint
|
|
252
|
+
thickness: PropRef
|
|
253
|
+
softness: PropRef
|
|
254
|
+
seed: PropRef
|
|
255
|
+
}): PatternPaint` — A maze of quarter-circle arcs, two per tile, flipped at random so they join into flowing curves.
|
|
256
|
+
- `weaveThreads(slots: {
|
|
257
|
+
frame: PatternPaint
|
|
258
|
+
gap: PropRef
|
|
259
|
+
/** `[horizontal, vertical]` thread colors. */
|
|
260
|
+
colors: [PropRef, PropRef]
|
|
261
|
+
}): PatternPaint` — Two sets of threads woven over and under each other, returned as a finished color.
|
|
262
|
+
- `isoCubeFaces(slots: {
|
|
263
|
+
frame: PatternPaint
|
|
264
|
+
thickness: PropRef
|
|
265
|
+
softness: PropRef
|
|
266
|
+
}): {random: PatternPaint; tone: PatternPaint; wire: PatternPaint}` — Tumbling blocks: three shaded rhombus faces per hexagon that read as a field of 3D cubes.
|
|
267
|
+
- `vary(color: PaintSlot, factor: PaintSlot): PatternPaint` — A color lightened or darkened per cell by a shade factor, alpha untouched.
|
|
268
|
+
- `sampleMapsAtCellCentres(slots: {
|
|
269
|
+
cells: PropRef
|
|
270
|
+
rotation?: PropRef
|
|
271
|
+
props: string[]
|
|
272
|
+
}): GpuMapSampleUVs` — Makes map-driven props change per whole cell instead of per pixel, so a mapped dot size or line thickness grows cell by cell rather than being cut off mid-cell.
|
|
273
|
+
- `times(a: PaintSlot, b: PaintSlot): PatternPaint` — The product of two values: a mask scaled by a prop, an RGB dimmed by a shade, two masks combined.
|
|
274
|
+
- `mixOf(from: PaintSlot, to: PaintSlot, amount: PaintSlot): PatternPaint` — A straight blend from one value to another by an amount from 0 to 1.
|
|
275
|
+
- `alphaOf(color: PaintSlot): PatternPaint` — The alpha channel of a color, as a number per pixel.
|
|
276
|
+
- `rgbOf(color: PaintSlot): PatternPaint` — The RGB channels of a color, without its alpha.
|
|
277
|
+
- `opaque(rgb: PaintSlot): PatternPaint` — An RGB value finished as a fully opaque color.
|
|
278
|
+
- `dotScreen(slots: {angle: PropRef; frequency: PropRef}): GatherEffect` — A classic halftone filter: the layer inside it redrawn as a grid of dots that grow where it is bright.
|
|
279
|
+
- `cmykPress(slots: {
|
|
280
|
+
paper: PropRef
|
|
281
|
+
frequency: PropRef
|
|
282
|
+
misprint: PropRef
|
|
283
|
+
misprintAngle: PropRef
|
|
284
|
+
plates: InkPlateSpec[]
|
|
285
|
+
}): GatherEffect` — A four-color print filter: the layer inside it separated into ink plates, each screened into dots at its own angle and laid down on paper in order.
|
|
286
|
+
- `inkPlate(spec: InkPlateSpec): InkPlateSpec` — Declares one ink plate for `cmykPress`.
|
|
287
|
+
- `dotScreenMask(uv: Expr, aspect: Expr, angle: Expr, intensity: Expr, frequency: Expr): Expr` — The dot coverage of one halftone screen: 1 inside a dot, 0 between, with the dot size set by an ink amount.
|
|
288
|
+
- `inkTransmission(inkColor: Expr, inkMask: Expr): Expr` — How much light passes one ink plate: white where the dot mask is 0, the ink color where it is 1.
|
|
289
|
+
- `chosenBy<K extends string>(prop: PropRef, read: (raw: unknown) => K, recipes: Record<K, GatherEffect>): GatherEffect` — Picks one whole effect recipe from a select prop, decided when the shader compiles.
|
|
290
|
+
- `pixelGrid(slots: {size: PropRef}): PixelGrid` — The pixel grid of a dither: the layer inside it chopped into square cells of a given size.
|
|
291
|
+
- `quantise(slots: {grid: PixelGrid; pattern: PropRef; threshold: PropRef; spread: PropRef}): GatherStage` — Reduces each grid cell of the layer inside to 0 or 1 using a dither pattern.
|
|
292
|
+
- `ditherInks(slots: {
|
|
293
|
+
grid: PixelGrid
|
|
294
|
+
levels: GatherStage
|
|
295
|
+
mode: PropRef
|
|
296
|
+
colors: [PropRef, PropRef]
|
|
297
|
+
}): GatherEffect` — A dither filter: colors the 0/1 levels from `quantise`, either with two colors of your own or with darkened and brightened versions of the layer's own pixels.
|
|
298
|
+
- `scatterPoint(coord: Expr, opts: ScatterOptions): ScatteredPoint` — One random point in each cell of a square grid: the classic scatter for glitter, stars, dust and sparkles.
|
|
299
|
+
- `scatterPoints(coord: Expr, opts: ScatterOptions): ScatteredPoint[]` — The scattered points of the four grid cells nearest the pixel, so anything drawn up to half a cell from its point shows whole, never clipped at a cell edge.
|
|
300
|
+
|
|
301
|
+
### Figures & strokes (`import {figures} from 'shaders/std'`) — https://shaders.com/docs/primitives/figures
|
|
302
|
+
|
|
303
|
+
Drawn lines: a straight segment and a traveling sine wave. Each word binds your props and
|
|
304
|
+
returns a paint that draws the stroke in one color prop with an antialiased edge and leaves
|
|
305
|
+
everything else transparent, so it layers cleanly over what sits behind it.
|
|
306
|
+
|
|
307
|
+
- `strokedSegment(slots: StrokedSegmentSlots): Paint` — A straight line between two points, solid, dashed or dotted, with square or round ends.
|
|
308
|
+
- `sineStroke(slots: SineStrokeSlots): Paint` — A wavy line that travels along itself, drawn as a soft band.
|
|
309
|
+
|
|
310
|
+
### Layering & output (`import {compose} from 'shaders/std'`) — https://shaders.com/docs/primitives/compose
|
|
311
|
+
|
|
312
|
+
The words that finish a `paint:` function. `layers` stacks several colors into one, back to
|
|
313
|
+
front, each with an optional opacity and an optional factor it is seen through. `layered`
|
|
314
|
+
builds N variations of one recipe from a data list and sums them, which is how curtains,
|
|
315
|
+
cloud banks and echo trails get their depth cheaply.
|
|
316
|
+
|
|
317
|
+
- `layers(entries: Layer[]): Expr` — Stacks colors into one, first entry at the back.
|
|
318
|
+
- `emissiveAlpha(rgb: Expr, hint: string = 'emissive'): Expr` — Turns an rgb light value into a color with alpha, so glows composite over transparency.
|
|
319
|
+
- `dithered(color: Expr, params: GpuFragmentParams): Expr` — Adds a tiny amount of noise to a final color so long soft gradients show no banding.
|
|
320
|
+
- `layered<T>(layerData: readonly T[], build: (layer: T, index: number) => {value: Expr; weight: Expr}): {weightedSum: Expr; totalWeight: Expr}` — Builds N variations of one thing from a data list and sums them with weights.
|
|
321
|
+
|
|
322
|
+
### Media (`import {media} from 'shaders/std'`) — https://shaders.com/docs/primitives/media
|
|
323
|
+
|
|
324
|
+
Pixels that come from an image, a video or the user's camera instead of from math. Each word
|
|
325
|
+
loads its source, fits it into the layer the way CSS `object-fit` fits an image into a box,
|
|
326
|
+
and returns the GPU half of a definition. Spread it into `defineShader({...})` next to your
|
|
327
|
+
props, with `role: 'media'` and `species: 'custom'`.
|
|
328
|
+
|
|
329
|
+
- `imageMedia(opts: MediaFitSlots & {
|
|
330
|
+
/** The URL prop. */
|
|
331
|
+
src: PropRef
|
|
332
|
+
/** A debug label for the texture, shown in GPU tooling. */
|
|
333
|
+
label: string
|
|
334
|
+
/** Called when the image fails to load. */
|
|
335
|
+
onError?: (error: unknown, url: string) => void
|
|
336
|
+
}): MediaSurfaceHalf` — An image from a URL prop, fitted into the layer.
|
|
337
|
+
- `videoMedia(opts: MediaFitSlots & {
|
|
338
|
+
/** The URL prop. */
|
|
339
|
+
src: PropRef
|
|
340
|
+
/** The loop prop, synced to the video each frame. */
|
|
341
|
+
loop: PropRef
|
|
342
|
+
/** Milliseconds to wait for the video's metadata before giving up. */
|
|
343
|
+
metadataTimeoutMs: number
|
|
344
|
+
onError?: (error: unknown, info: {url: string | null; stage: 'acquire' | 'autoplay'}) => void
|
|
345
|
+
}): MediaSurfaceHalf` — A video from a URL prop, playing in the layer.
|
|
346
|
+
- `webcamMedia(opts: MediaFitSlots & {
|
|
347
|
+
/** The selfie-mirror boolean prop. */
|
|
348
|
+
mirror: PropRef
|
|
349
|
+
/** The `getUserMedia` constraints to request the camera with. */
|
|
350
|
+
constraints: MediaStreamConstraints
|
|
351
|
+
/** The key the definition's `naturalSizeKey: {fixed}` uses (a webcam has no URL). */
|
|
352
|
+
naturalSizeKey: string
|
|
353
|
+
onError?: (error: unknown, info: {url: string | null; stage: 'acquire' | 'autoplay'}) => void
|
|
354
|
+
}): MediaSurfaceHalf` — The user's camera, live in the layer.
|
|
355
|
+
|
|
356
|
+
## Noise, light & materials
|
|
357
|
+
|
|
358
|
+
### Noise (`import {noise} from 'shaders/std'`) — https://shaders.com/docs/primitives/noise
|
|
359
|
+
|
|
360
|
+
Words for grainy, cloudy, cellular and streaked surfaces: the textures behind clouds, film
|
|
361
|
+
grain, stone, water and brushed metal. Read a noise recipe from the inside out, in four
|
|
362
|
+
steps. A **basis** is the raw pattern, one number per point (`gaborGrains`, `curlSpeed`,
|
|
363
|
+
`blueSpeckle`, or a `noiseField` from paint). A **framing** decides where on the canvas the
|
|
364
|
+
basis is sampled and how big it is: `seededPlane` for almost everything, `pixelGrid` for
|
|
365
|
+
patterns that live on pixels. A **tone** word turns the raw number into a 0–1 ramp position
|
|
366
|
+
with contrast and balance controls: `noiseTone` for a 0–1 basis, `signedTone` for a −1 to 1
|
|
367
|
+
one, or `unitized` to convert first. A **ramp** closes it: `rampOver` with `stops` or
|
|
368
|
+
`linearPair` gives the field color.
|
|
369
|
+
|
|
370
|
+
- `seededPlane(field: Field, slots: {scale: PropRef; seed: PropRef}): Field` — Frames a field on a zoomable plane: how big the pattern is and where it starts.
|
|
371
|
+
- `evolving(field: Field, opts: {rate: number}): Field` — Makes a 3D noise basis morph in place over time instead of sliding across the canvas.
|
|
372
|
+
- `noiseTone(field: Field, slots?: {contrast?: PropRef; balance?: PropRef}): Field` — The standard contrast and balance controls of a noise texture, turning a 0–1 field into the ramp position.
|
|
373
|
+
- `unitized(field: Field): Field` — Turns a signed field (−1 to 1) into a unit field (0 to 1).
|
|
374
|
+
- `signedTone(field: Field, slots: {contrast: PropRef; balance: PropRef}): Field` — Contrast and balance for a signed field (−1 to 1), applied before it is squashed to 0–1.
|
|
375
|
+
- `gainTone(field: Field, slots: {contrast: PropRef; balance: PropRef}): Field` — Contrast as a multiplier and balance as a shift over a 0–1 field, not flipped.
|
|
376
|
+
- `gaborGrains(slots: {frequency: PropRef}): Field` — Oriented sine grains: short striped patches, each facing a random way, like brushed metal or wood grain.
|
|
377
|
+
- `waveletBands(slots: {detail: PropRef}): Field` — Rotating bands of wavelets: layered ripples that turn against each other, a watery interference look.
|
|
378
|
+
- `curlSpeed(opts: {rate: number}): Field` — How fast a swirling flow moves at each point: soft eddies and streams that morph in place.
|
|
379
|
+
- `erosionRidges(): Field` — Terrain eroded by water: sharp branching ridges with gullies running off them.
|
|
380
|
+
- `scratchStreaks(slots: {thickness: PropRef}): Field` — Fine hairline scratches, like a scuffed surface, flickering on the layer's clock.
|
|
381
|
+
- `pixelGrid(field: Field, slots: {grain: PropRef; seed: PropRef}): Field` — Frames a field on the pixel grid: one value per block of `grain` device pixels.
|
|
382
|
+
- `blueSpeckle(): Field` — Fine, even speckle with no clumps: blue noise, one random value per pixel block.
|
|
383
|
+
- `scaledPlane(field: Field, slots: {scale: PropRef}): Field` — Frames a field on the aspect-corrected canvas plane, zoomed by a plain multiplier.
|
|
384
|
+
- `linearPair(a: PropRef, b: PropRef): Palette` — A two-color palette mixed in linear RGB, for a definition with no color-space prop.
|
|
385
|
+
- `fractalNoise(slots: {
|
|
386
|
+
angle: PropRef
|
|
387
|
+
detail: PropRef
|
|
388
|
+
contrast: PropRef
|
|
389
|
+
octaves: PropRef
|
|
390
|
+
seed: PropRef
|
|
391
|
+
space: PropRef
|
|
392
|
+
}): Paint` — A complete fractal-noise paint: layered simplex noise that morphs over time, read through the color ramp.
|
|
393
|
+
- `worleyNoise(slots: {
|
|
394
|
+
scale: PropRef
|
|
395
|
+
jitter: PropRef
|
|
396
|
+
lacunarity: PropRef
|
|
397
|
+
persistence: PropRef
|
|
398
|
+
contrast: PropRef
|
|
399
|
+
balance: PropRef
|
|
400
|
+
seed: PropRef
|
|
401
|
+
/** Compile-time prop: `'f1' | 'f2' | 'f2MinusF1' | 'f1PlusF2' | 'f1TimesF2'`. */
|
|
402
|
+
mode: PropRef
|
|
403
|
+
/** Compile-time prop: `'euclidean' | 'manhattan' | 'chebyshev'`. */
|
|
404
|
+
distance: PropRef
|
|
405
|
+
/** Compile-time prop: 1 to 4. */
|
|
406
|
+
octaves: PropRef
|
|
407
|
+
space: PropRef
|
|
408
|
+
}): Paint` — A complete cellular-noise paint: distances to drifting cell points, read through the color ramp.
|
|
409
|
+
- `transformWorleyMode(value: string): number` — The `transform` for a `worleyNoise` `mode` prop: maps `'f1'`, `'f2'`, `'f2MinusF1'`, `'f1PlusF2'` or `'f1TimesF2'` to the number the paint reads.
|
|
410
|
+
- `transformWorleyDistance(value: string): number` — The `transform` for a `worleyNoise` `distance` prop: maps `'euclidean'`, `'manhattan'` or `'chebyshev'` to the number the paint reads.
|
|
411
|
+
- `cellDistances(slots: {scale: PropRef; seed: PropRef}): Field` — Distances from each pixel to its nearest two cell points, as `(d1, d2)`: the raw material for Voronoi fills and borders.
|
|
412
|
+
- `cellFill(cells: Field, slots: {edgeIntensity: PropRef}): Field` — A 0–1 fill for each cell: 0 at the cell's point, 1 at its boundary, whatever the cell size.
|
|
413
|
+
- `cellBorders(cells: Field, slots: {softness: PropRef; scale: PropRef}): Field` — A mask of the lines between cells: 0 on a boundary, 1 inside a cell.
|
|
414
|
+
- `borderOverlay(paint: Paint, mask: Field, slots: {color: PropRef}): Paint` — Draws a color over a paint wherever a mask falls to 0, keeping the paint's alpha.
|
|
415
|
+
- `waves(axes: {x: Expr | number; y?: Expr | number; t?: Expr | number}, schedule: WaveTerm[]): Expr` — Overlapping traveling sine waves from a schedule written as data: the organic wobble behind blob edges, water lines and drifting fills.
|
|
416
|
+
- `wavyLine(opts: {
|
|
417
|
+
along: Expr | number
|
|
418
|
+
time: Expr | number
|
|
419
|
+
waves: {freq: number; speed: number; amount: number; phase?: Expr | number}[]
|
|
420
|
+
}): Expr` — The height of an animated wavy line at a point along it: a stack of traveling sines.
|
|
421
|
+
- `organicWaves(opts: {frequency: number; detail?: number; drift?: number; seed?: number}): WaveTerm[]` — A ready-made `waves` schedule from three knobs, for when you have no hand-tuned constants.
|
|
422
|
+
- `ribbons(slots: {
|
|
423
|
+
from: PropRef
|
|
424
|
+
to: PropRef
|
|
425
|
+
count: PropRef
|
|
426
|
+
width: PropRef
|
|
427
|
+
amplitude: PropRef
|
|
428
|
+
frequency: PropRef
|
|
429
|
+
softness: PropRef
|
|
430
|
+
spread: PropRef
|
|
431
|
+
pinEdges: PropRef
|
|
432
|
+
colorScale: PropRef
|
|
433
|
+
colorVariance: PropRef
|
|
434
|
+
}): Paint` — Flowing gradient-colored ribbons between two points: the Strands look.
|
|
435
|
+
- `overRgb(paint: Paint, ...stages: RgbStage[]): Paint` — Runs color-only steps over a paint, in order, leaving its alpha alone.
|
|
436
|
+
- `backToP3(slots: {space?: PropRef}): RgbStage` — Brings `ribbons` color from its working color space back to display color.
|
|
437
|
+
- `tonePow(): RgbStage` — A gentle lift of the mid-tones (rgb to the power 0.85), as an `overRgb` step.
|
|
438
|
+
- `noiseRelief(basis: ReliefBasis): (params: GpuFragmentParams) => Expr` — Embosses the layer inside with a textured surface: the child is slightly distorted, then lit by a height field so it reads as carved stone or woven cloth.
|
|
439
|
+
- `reliefBases.stone: { readonly fn: TgpuFn<(p: Vec2f) => F32>; readonly hint: "stone12"; }` — Marbled stone height field.
|
|
440
|
+
- `reliefBases.wool: { readonly fn: TgpuFn<(p: Vec2f) => F32>; readonly hint: "wool12"; }` — Interwoven fibrous fabric height field.
|
|
441
|
+
|
|
442
|
+
### Light (`import {light} from 'shaders/std'`) — https://shaders.com/docs/primitives/light
|
|
443
|
+
|
|
444
|
+
Words for drawing light: glows, rays, beams, flares and halos, plus the frames they are drawn
|
|
445
|
+
in. A **frame** is the coordinate system a light evaluates in. `radialFrame` gives each pixel
|
|
446
|
+
its distance and angle from a center; `beamFrame` gives its distance along and across a beam.
|
|
447
|
+
**Parts** such as `glowPoint`, `rayLobes` and `featherMask` shape a light over a frame and
|
|
448
|
+
return a *field*, a 0–1 number per pixel. `withFrame` evaluates a part in a frame,
|
|
449
|
+
`modulate` multiplies parts (a mask over a pattern), and `additive` sums finished lights.
|
|
450
|
+
|
|
451
|
+
- `glowAt(opts: {uv: Expr; aspect: Expr | number; x: Expr | number; y: Expr | number; sizeSq: Expr | number}): Expr` — A soft round glow at a position on the canvas.
|
|
452
|
+
- `glowSpot(du: Expr, dv: Expr, sharpness: Expr): Expr` — A soft oval glow over an offset you have already scaled, the core of a bloom or a glare.
|
|
453
|
+
- `emitterFalloff(d: Expr, opts: {radius: Expr | number; power: Expr | number}): Expr` — How light spilling from an emitter dims with distance, with a long realistic tail.
|
|
454
|
+
- `radialFrame(center: PropRef): LightValue` — The frame for a burst, halo or sweep around a center prop.
|
|
455
|
+
- `seamlessRadialFrame(center: PropRef): LightValue` — The frame `noiseRays` needs: a radial frame around a center prop with no visible seam.
|
|
456
|
+
- `beamFrame(anchor: PropRef): LightValue` — The frame of a beam that starts at an anchor prop and points at the canvas center.
|
|
457
|
+
- `withFrame(frame: LightValue, part: LightPart, hint?: string): LightValue` — Evaluate a light part in a frame.
|
|
458
|
+
- `modulate(first: LightPart, ...rest: LightPart[]): LightPart` — Multiply light parts drawn in the same frame, such as a mask over a pattern.
|
|
459
|
+
- `glowPoint(slots: {sharpness: ArgSpec}): LightPart` — A soft glow at the center of a radial frame with no hard edge.
|
|
460
|
+
- `featherMask(slots: {radius: ArgSpec; feather: ArgSpec}): LightPart` — A round mask that is solid inside a radius and fades out at its edge.
|
|
461
|
+
- `rayLobes(slots: {count: ArgSpec; spin: number; sharpness: ArgSpec}): LightPart` — Soft rays fanning out from the center of a radial frame, turning with the layer's clock.
|
|
462
|
+
- `softRayLobes(slots: {count: ArgSpec; softness: ArgSpec; spin: number}): LightPart` — `rayLobes` with a softness slider instead of a sharpness.
|
|
463
|
+
- `raySpikes(slots: {halfCount: ArgSpec; power: ArgSpec}): LightPart` — Thin star spikes with dark gaps between them, like light through a camera aperture.
|
|
464
|
+
- `ringBand(slots: {center: ArgSpec; spread: ArgSpec; width: ArgSpec}): LightPart` — Three thin colored rings around the center, the rainbow edge of a lens or a halo.
|
|
465
|
+
- `noiseRays(slots: {density: ArgSpec; intensity: ArgSpec; spotty: ArgSpec}): LightPart` — Volumetric god rays: shafts of light drifting outward from the center, moving on the layer's clock.
|
|
466
|
+
- `rayBands(opts: {
|
|
467
|
+
along: Expr
|
|
468
|
+
frequency: Expr | number
|
|
469
|
+
time: Expr | number
|
|
470
|
+
speed: Expr | number
|
|
471
|
+
phase?: Expr | number
|
|
472
|
+
sharpness: Expr | number
|
|
473
|
+
}): Expr` — Bright bands that travel along a coordinate, for aurora curtains or shimmering rays.
|
|
474
|
+
- `shine(opts: {normal: Expr; light: Expr; gloss: Expr | number}): Expr` — A specular highlight on any surface that gives you a normal.
|
|
475
|
+
- `domeNormal(opts: {
|
|
476
|
+
delta: Expr
|
|
477
|
+
dist: Expr
|
|
478
|
+
radius: Expr | number
|
|
479
|
+
bulge?: {tilt?: number; drop?: number}
|
|
480
|
+
}): Expr` — The surface normals of a flat disc treated as a puffy dome, ready to light with `shine`.
|
|
481
|
+
- `additive(first: Expr, ...rest: Expr[]): Expr` — Adds lights together, since light from several sources simply sums.
|
|
482
|
+
- `heatRamp(colors: {hot: PropRef; mid: PropRef; fringe: PropRef}): { kind: "heatRamp"; taps: (heat: Expr, params: { uniforms: Record<string, Expr>; }) => Expr; }` — The colors of overexposed light, from a dim fringe through a mid tone to a hot core.
|
|
483
|
+
- `vignetteMask(slots: {strength: ArgSpec; scale?: number}): LightValue` — Darkens the corners of the canvas.
|
|
484
|
+
- `screenGlow(glow: (params: FilterParams) => Expr): PointwiseEffect` — An `effect` that shines emitted light onto the layer inside it, the way light hits film.
|
|
485
|
+
- `coverageMix(slots: {color: PropRef; background: PropRef; coverage: LightValue; hint?: string}): LightValue` — Blends from a background color to a light color by a coverage field, as a finished paint.
|
|
486
|
+
- `coverageOver(slots: {color: PropRef; background: PropRef; coverage: LightValue}): LightValue` — Lays a light color over a background color by a coverage field, like a layer with an opacity mask, as a finished paint.
|
|
487
|
+
- `slowDrift(slots: {seed: ArgSpec; flicker: ArgSpec}): (clock: Expr, params: GpuFragmentParams) => Expr` — The slow breathing and drifting signals that keep a light leak alive.
|
|
488
|
+
- `beamBloom(slots: {spread: ArgSpec}): (frame: Expr, drift: Expr, params: GpuFragmentParams) => Expr` — The soft pool of light at the start of a beam, with a wider faint shoulder around it.
|
|
489
|
+
- `beamStreaks(slots: {spread: ArgSpec; strength: ArgSpec}): (frame: Expr, drift: Expr, params: GpuFragmentParams) => Expr` — Two bright bands crossing a beam further along it, slowly drifting, like light bouncing inside a film camera.
|
|
490
|
+
- `streakBand(u: Expr, center: Expr, width: Expr): Expr` — One soft band across a single coordinate, peaking at `center`.
|
|
491
|
+
- `lightBeam(dist: Expr, t: Expr, thickness: {start: Expr; end: Expr}, softness: {start: Expr; end: Expr}): Expr` — The glow of a beam that can be thicker or softer at one end than the other.
|
|
492
|
+
- `segmentProject(p: Expr, a: Expr, b: Expr): Expr` — Where a pixel falls along a line from `a` to `b`, and how far it is from that line.
|
|
493
|
+
- `flareFrame(slots: {position: PropRef; intensity: ArgSpec; edgeFade: ArgSpec}): LightValue` — The shared frame of a camera lens flare, which every `flare*` part reads.
|
|
494
|
+
- `lensGhost(slots: {intensity: ArgSpec; spread: ArgSpec; chroma: ArgSpec}): (flare: Expr, disc: [number, number, number, number], tint: [number, number, number, number], params: GpuFragmentParams) => Expr` — One ghost disc of a lens flare, the faint circles that line up across from the light.
|
|
495
|
+
- `flareHalo(slots: {intensity: ArgSpec; radius: ArgSpec; chroma: ArgSpec; softness: ArgSpec}): (flare: Expr, params: GpuFragmentParams) => Expr` — The rainbow halo ring of a lens flare, drawn across the canvas from the light.
|
|
496
|
+
- `flareStarburst(slots: {intensity: ArgSpec; points: ArgSpec}): (flare: Expr, params: GpuFragmentParams) => Expr` — The star of thin spikes around the light in a lens flare.
|
|
497
|
+
- `flareStreak(slots: {intensity: ArgSpec; length: ArgSpec}): (flare: Expr, params: GpuFragmentParams) => Expr` — The horizontal widescreen streak through the light in a lens flare.
|
|
498
|
+
- `flareGlare(slots: {intensity: ArgSpec; size: ArgSpec}): (flare: Expr, params: GpuFragmentParams) => Expr` — The broad warm-white wash around the light that lifts contrast near it.
|
|
499
|
+
- `flareCore(slots: {intensity: ArgSpec}): (flare: Expr, params: GpuFragmentParams) => Expr` — The bright point at the light itself: a hard pinpoint inside a small soft glow.
|
|
500
|
+
- `flareComposite(total: Expr, flare: Expr): Expr` — Closes a lens flare: turns the summed flare parts into the color to return from `paint`.
|
|
501
|
+
- `dithered(heat: Expr, uv: Expr, clock: Expr): Expr` — Adds a trace of noise to a heat field so long soft ramps do not show bands.
|
|
502
|
+
- `starGlint(offset: Expr, opts: {
|
|
503
|
+
core: Expr | number
|
|
504
|
+
rayLength: Expr | number
|
|
505
|
+
rayWidth: Expr | number
|
|
506
|
+
rays: Expr | number
|
|
507
|
+
/** Optional: the glint fades to nothing by this distance from its centre (measured along the larger axis). */
|
|
508
|
+
reach?: Expr | number
|
|
509
|
+
}): Expr` — A four-point star of light: a round core with a thin ray along each axis, like a glint off glitter or a star in a photograph.
|
|
510
|
+
|
|
511
|
+
### Materials & surfaces (`import {materials} from 'shaders/std'`) — https://shaders.com/docs/primitives/materials
|
|
512
|
+
|
|
513
|
+
Words that shade a surface so a shape reads as glass, metal, plastic or stone. A material is
|
|
514
|
+
three things: a **normal** (which way the surface faces at this pixel), a **light** (where it
|
|
515
|
+
comes from) and a **response** (how the surface answers: diffuse, glint, mirror, tint).
|
|
516
|
+
`shapedSurface` turns a shape prop into a surface you can shade. It hands your `surface`
|
|
517
|
+
function a frame with the shape's distance field, and `surfaceField` binds what you read from
|
|
518
|
+
it: the signed distance, the pixel size, the neighbour taps.
|
|
519
|
+
|
|
520
|
+
- `shapedSurface(spec: ShapedSurfaceSpec): ShapedSurfaceEffect` — Turns a shape prop into a surface your material shades.
|
|
521
|
+
- `surfaceField(frame: SurfaceFrame, params: GpuFragmentParams, opts: {scale?: Expr} = {}): SurfaceField` — The first line of a material: the field taps, the signed distance and the pixel size, bound once.
|
|
522
|
+
- `geometricNormal(frame: SurfaceFrame, field: SurfaceField, opts: {bevelWidth: Expr; bevelShape: Expr; sharpness?: number; eps?: number; hint?: string}): Expr` — The surface normal of the shape, whichever kind of shape is active.
|
|
523
|
+
- `marchedNormal(field: SurfaceField, sharpness: number = 5, hint: string = 'nGeo'): Expr` — The surface normal of a 3D shape, from the marched depth.
|
|
524
|
+
- `nudgeNormal(n: Expr, dx: Expr, dy: Expr, hint: string = 'n'): Expr` — Tilts a normal by a slope in x and y, turning a height field into relief.
|
|
525
|
+
- `tiltNormal(n: Expr, frame: DirectionFrame, slopes: {along?: Expr; across?: Expr}, hint: string = 'n'): Expr` — Tilts a normal along and across a direction, for brushed or woven relief.
|
|
526
|
+
- `tiltAlong(n: Expr, axis: Expr, amount: Expr, hint: string = 'n'): Expr` — Tilts a normal along one 2D direction by a slope amount.
|
|
527
|
+
- `fdSlope(sampleAt: (p: Expr) => Expr, p: Expr, eps: number, hint: string = 'fd'): {value: Expr; dx: Expr; dy: Expr}` — The value and slope of any field at a point: `value`, `dx` and `dy`.
|
|
528
|
+
- `perlinSlope(q: Expr, gain: Expr | number): Expr` — The slope of smooth noise at a point, for wavy or molten relief.
|
|
529
|
+
- `fieldSlope(field: SurfaceField, eps: number = 0.01): Expr` — The direction the shape's distance grows in: a 2D vector pointing outward at this pixel.
|
|
530
|
+
- `surfacePattern(frame: SurfaceFrame, field: SurfaceField, opts: {uv?: Expr} = {}): Expr` — Coordinates for a pattern that sticks to the shape's surface.
|
|
531
|
+
- `keyLightAt(dir: Expr, elevation: number, hint: string = 'kl'): Expr` — A key light from an angle: the light direction `.L` and the half vector `.H` for highlights.
|
|
532
|
+
- `keyLightXY(x: Expr, y: Expr, elevation: number, hint: string = 'kl'): Expr` — A key light from explicit x and y components, for a second or a crossed light.
|
|
533
|
+
- `lightVec3(dir: Expr, z: number, hint: string = 'L'): Expr` — A 3D light direction from a `direction()` vector and an elevation.
|
|
534
|
+
- `placementPoint(params: GpuFragmentParams, position: Expr, hint: string = 'placed'): Expr` — A position prop in the shape's own coordinates, so you can compare it with the field.
|
|
535
|
+
- `pointLightFrom(light: {position: Expr; height: Expr | number}, at: Expr, hint: string = 'pl'): {L: Expr; toLight: Expr; distance: Expr}` — A point light as seen from a point on the shape: the 3D light vector `L`, the 2D direction `toLight` and the `distance`.
|
|
536
|
+
- `inverseSquare(distance: Expr, range: Expr | number): Expr` — How a point light fades with distance: 1 at the source, half at `range`.
|
|
537
|
+
- `lambert(normal: Expr, light: Expr, opts: {wrap?: Expr | number} = {}): Expr` — How much a light falls on a surface: 0 facing away, 1 facing it.
|
|
538
|
+
- `sharpGlint(ndh: Expr, sharpness: Expr, cfg: Expr): Expr` — A highlight whose tightness follows a sharpness slider.
|
|
539
|
+
- `dualLobeGlint(ndh: Expr, opts: {
|
|
540
|
+
/** `[exponent, gain]` of the hot core lobe. */
|
|
541
|
+
core: [number, number]
|
|
542
|
+
/** `[exponent, gain]` of the wide halo lobe. */
|
|
543
|
+
halo: [number, number]
|
|
544
|
+
softness?: Expr
|
|
545
|
+
gain: Expr
|
|
546
|
+
}): Expr` — A highlight with a tight hot core and a wide dim halo.
|
|
547
|
+
- `anisoSpecular(opts: {
|
|
548
|
+
normal: Expr
|
|
549
|
+
/** The 2D grain direction. */
|
|
550
|
+
tangent: Expr
|
|
551
|
+
/** A unit 3D light direction (see `lightVec3`). */
|
|
552
|
+
light: Expr
|
|
553
|
+
view: Expr
|
|
554
|
+
alphas: {along: Expr; across: Expr}
|
|
555
|
+
gain?: Expr | number
|
|
556
|
+
}): Expr` — A highlight stretched along a grain, as on brushed metal or carbon fibre.
|
|
557
|
+
- `wardAlphas(roughness: Expr, anisotropy: Expr): {along: Expr; across: Expr}` — Turns roughness and anisotropy sliders (0–1 each) into the two lobe widths `anisoSpecular` takes.
|
|
558
|
+
- `viewRay(params: GpuFragmentParams, field: SurfaceField, fov: number = 0.6): Expr` — The direction the viewer looks along at this pixel, for reflections that sweep across a face.
|
|
559
|
+
- `grazingOf(n: Expr, view: Expr): Expr` — How edge-on the surface is to the viewer: 0 face-on, 1 grazing.
|
|
560
|
+
- `grazingFlat(n: Expr): Expr` — How edge-on the surface is to a straight-on viewer: 0 face-on, 1 grazing.
|
|
561
|
+
- `fresnelBoost(grazing: Expr, opts: {power?: number; amount: Expr | number}): Expr` — A multiplier that brightens grazing edges: 1 face-on, up to `1 + amount` at the rim.
|
|
562
|
+
- `schlickFresnel(grazing: Expr, opts: {r0?: number; gain: Expr | number; power?: number}): Expr` — How mirror-like a surface is at this pixel: `r0` face-on, rising to `r0 + gain` at the rim.
|
|
563
|
+
- `studioSoftboxes(x: Expr, y: Expr, opts: {
|
|
564
|
+
/** A `direction()` vector that rotates the studio. */
|
|
565
|
+
rotation: Expr
|
|
566
|
+
keyRadius: Expr | number
|
|
567
|
+
drift: Expr | number
|
|
568
|
+
strength: Expr | number
|
|
569
|
+
skyGain: number
|
|
570
|
+
}): Expr` — The brightness of a five-light studio seen in a reflected direction.
|
|
571
|
+
- `smearAlong(opts: {center: Expr; axis: Expr; spread: Expr; taps?: number; sigma?: number; hint?: string}, sample: (x: Expr, y: Expr) => Expr): Expr` — Blurs any 2D lookup along a direction, for streaked reflections and motion smear.
|
|
572
|
+
- `opticalThickness(field: SurfaceField, frame: SurfaceFrame): Expr` — How much material the view passes through at this pixel: 0 at the edge, up to about 1.2 deep inside.
|
|
573
|
+
- `beerLambert(thickness: Expr, absorb: Expr): Expr` — How much light survives a thickness of tinted material, per channel.
|
|
574
|
+
- `cosineRainbow(t: Expr, phases: [number, number, number]): Expr` — A smooth rainbow color from a value that wraps every 1.
|
|
575
|
+
- `tintRamp(t: Expr, dark: Expr, light: Expr): Expr` — Maps a lighting value (0 dark, 1 light) onto two colors.
|
|
576
|
+
- `neutralTone(rgb: Expr): Expr` — Compresses bright color back into range without shifting its hue.
|
|
577
|
+
- `exposureTone(rgb: Expr): Expr` — Turns light that piles past 1 into a soft burn toward white, like film.
|
|
578
|
+
- `silhouette(field: SurfaceField, edgeSoftness: Expr): Expr` — The shape's coverage at this pixel: 1 inside, 0 outside, soft across the edge.
|
|
579
|
+
- `insideShape(sdf: Expr, pxH: Expr): Expr` — True inside the shape and up to two pixels outside it.
|
|
580
|
+
- `guarded(cond: Expr, inner: Expr, fallback: Expr, hint: string = 'guarded', deps: Expr[] = []): Expr` — Evaluates an expression only where a condition holds, and a cheap fallback everywhere else.
|
|
581
|
+
- `surfaceNoise(x: Expr | number, y: Expr | number): Expr` — Smooth signed noise at a 2D point, roughly −1 to 1, with features about one unit wide.
|
|
582
|
+
- `surfaceNoiseAt(p: Expr): Expr` — `surfaceNoise` at a 2D point you already hold.
|
|
583
|
+
- `volumeNoiseAt(p: Expr): Expr` — Smooth signed noise at a 3D point, roughly −1 to 1.
|
|
584
|
+
- `cellNoiseAt(p: Expr): Expr` — Cellular noise at a 2D point: 0 at each cell's seed point, rising toward the cell walls.
|
|
585
|
+
- `valueNoise(x: Expr | number, y: Expr | number): Expr` — Smooth noise 0–1 at a 2D point, softer and blockier than `surfaceNoise`.
|
|
586
|
+
- `hashNoise(x: Expr | number, y: Expr | number): Expr` — Random 0–1 per point, with no smoothness between neighbours.
|
|
587
|
+
- `interleavedNoise(pixel: Expr, clock: Expr | number = 0): Expr` — A 0–1 dither pattern over device pixels where neighbours differ as much as possible.
|
|
588
|
+
- `grainNoise(coords: {along: Expr; across: Expr}, opts: {freq: [Expr | number, Expr | number]; offset?: [number, number]; drift?: Expr}): Expr` — One octave of smooth signed noise along and across a direction, for grain.
|
|
589
|
+
- `flowWarp(warpInput: Expr, flowT: Expr): Expr` — A slowly folding 2D offset to add to pattern coordinates, for molten or wind-blown motion.
|
|
590
|
+
- `sensorGrain(rgb: Expr, opts: {amount: Expr | number; pixel: Expr; clock: Expr | number}): Expr` — Adds a fine per-pixel brightness jitter, so rendered light reads as photographed.
|
|
591
|
+
- `pointStars(p: Expr, opts: {
|
|
592
|
+
/** Frequency of the per-point variation field relative to `p` (slow, about 0.1). */
|
|
593
|
+
variationFreq: number
|
|
594
|
+
/** Point radius as `[base, jitter]`: base plus variation times jitter. */
|
|
595
|
+
radius: [number, number]
|
|
596
|
+
/** The band of the variation field that keeps a point at all. Narrower is sparser. */
|
|
597
|
+
keep: [number, number]
|
|
598
|
+
/** Brightness as `[base, gain]`: base plus variation squared times gain. */
|
|
599
|
+
brightness: [number, number]
|
|
600
|
+
/** A per-point shimmer factor built from the variation field (see `twinkle`). */
|
|
601
|
+
shimmer?: (variation: Expr) => Expr
|
|
602
|
+
/** Overall gain. */
|
|
603
|
+
gain: Expr
|
|
604
|
+
/** Color the glints: variation mixes `from` to `to`, scaled by the glint times `gain`. */
|
|
605
|
+
tint?: {from: [number, number, number]; to: [number, number, number]; gain: number}
|
|
606
|
+
hint?: string
|
|
607
|
+
}): {glint: Expr; variation: Expr; rgb?: Expr}` — A plane of sparse glinting points: stars, glitter, dust.
|
|
608
|
+
- `twinkle(t: Expr, phase: Expr, opts: {amount: Expr; rate: number; spread: number}): Expr` — A brightness factor that shimmers over time, different for each element.
|
|
609
|
+
- `shellRefract(frame: SurfaceFrame, n: Expr, amount: Expr): {
|
|
610
|
+
x: Expr
|
|
611
|
+
y: Expr
|
|
612
|
+
centered: {x: Expr; y: Expr}
|
|
613
|
+
}` — Coordinates for what sits inside a glass shell, bent where the shell curves.
|
|
614
|
+
- `rotationSensor(frame: SurfaceFrame): {x: Expr; y: Expr}` — How far a 3D shape has rotated, as a 2D pan you can move content by.
|
|
615
|
+
- `nearestEdge(sdfUV: Expr, sdf: Expr, slope: Expr, hint: string = 'edge'): {point: Expr; normal: Expr}` — The closest point on the shape's edge to this pixel, and the outward normal there.
|
|
616
|
+
- `continuedField(frame: SurfaceFrame, field: SurfaceField, params: GpuFragmentParams): {sdf: Expr; outward: Expr; at: (uv: Expr) => Expr}` — The distance field extended past the edge of an SVG shape's texture.
|
|
617
|
+
|
|
618
|
+
### Volumes (`import {volume} from 'shaders/std'`) — https://shaders.com/docs/primitives/volume
|
|
619
|
+
|
|
620
|
+
Words for filling a shape with something you look through: smoke, gas, tinted glass, a
|
|
621
|
+
starfield behind a window. They work inside a shape-effect material, the `surface:` of
|
|
622
|
+
`shapedSurface` from `materials`. An **interior ray** is the line of sight through the shape:
|
|
623
|
+
where it enters, how far it travels inside, and where it is at any depth. A **medium** is a
|
|
624
|
+
density at each point inside. A **march** walks the ray front to back, adding up what each
|
|
625
|
+
sample glows and how much it dims what lies behind it.
|
|
626
|
+
|
|
627
|
+
- `interiorRay(field: SurfaceField, frame: SurfaceFrame, opts: {origin: {x: Expr; y: Expr}; view?: Expr; shear?: number; lengthScale?: number}): InteriorRay` — The line of sight through a shape: where it enters, how far it travels inside, and where it is at any depth.
|
|
628
|
+
- `volumeMarch(opts: {
|
|
629
|
+
steps: number
|
|
630
|
+
entry: Expr
|
|
631
|
+
length: Expr
|
|
632
|
+
/** A per-pixel offset added to each step's position along the ray, as a fraction of the ray. */
|
|
633
|
+
jitter?: Expr
|
|
634
|
+
/** A multiplier on every sample's `emit`. */
|
|
635
|
+
emissionGain?: Expr
|
|
636
|
+
hint?: string
|
|
637
|
+
}, sample: (step: VolumeMarchStep) => {emit: Expr; absorb: Expr}): {color: Expr; transmittance: Expr}` — Walk a ray through the medium front to back, adding up what glows and what dims.
|
|
638
|
+
- `turbulentMedium(p: {x: Expr; y: Expr; z: Expr}, opts: {frequency: Expr; drift?: Expr; seed?: Expr; billow?: Expr; hint?: string}): {density: Expr; mid: Expr; fine: Expr}` — A billowing cloud density at a point inside the shape.
|
|
639
|
+
- `parallaxPlane(ray: InteriorRay, opts: {depth: number; pan?: {x: Expr; y: Expr}; panRate?: number; hint?: string}): {x: Expr; y: Expr; z: Expr}` — A flat layer at a fixed depth inside the shape, like scenery seen through a window.
|
|
640
|
+
|
|
641
|
+
### Radiance (`import {radiance} from 'shaders/std'`) — https://shaders.com/docs/primitives/radiance
|
|
642
|
+
|
|
643
|
+
Words for light a shape gives off or blocks. Colored point lights strike the shape's
|
|
644
|
+
silhouette, the lit edges spill light into their surroundings, and the shape's body casts
|
|
645
|
+
shadows, so light stays out of a ring's hole and off the far side of a wall. They work inside
|
|
646
|
+
a shape-effect material, the `surface:` of `shapedSurface` from `materials`. The shape is a
|
|
647
|
+
**signed distance**, a function from a point to its distance from the edge, and every word
|
|
648
|
+
here marches rays against it.
|
|
649
|
+
|
|
650
|
+
- `irradianceField(spec: IrradianceFieldSpec): {
|
|
651
|
+
compute: GpuComputeNode
|
|
652
|
+
sample: (params: GpuFragmentParams) => Expr | undefined
|
|
653
|
+
}` — The light spilling from a shape's edges, gathered once into a texture and read per pixel.
|
|
654
|
+
- `shadowVisibility(spec: ShadowSpec): Expr` — How much of a light reaches a point, 1 when nothing is in the way and 0 when the shape blocks it.
|
|
655
|
+
- `gatherIrradiance(spec: GatherSpec): Expr` — The light arriving at a pixel from a glowing shape edge, with the shape's body blocking it.
|
|
656
|
+
|
|
657
|
+
### Voxels (`import {voxels} from 'shaders/std'`) — https://shaders.com/docs/primitives/voxels
|
|
658
|
+
|
|
659
|
+
One word, `voxelSurface`, rebuilds any shape out of blocks. A flat shape becomes chunky
|
|
660
|
+
pixel art, an SVG a slab of bricks, a 3D shape a lit voxel model. It asks you for one thing:
|
|
661
|
+
the color of a single block. For that it hands your `surface` a **voxel frame**, everything
|
|
662
|
+
a material needs already worked out: the block's normal, how open its surroundings are, how
|
|
663
|
+
much shadow other blocks cast on it, its cell position, a random number that stays fixed to
|
|
664
|
+
that block, how high and how deep it sits, and how close the pixel is to the face's edge.
|
|
665
|
+
|
|
666
|
+
- `voxelSurface(spec: VoxelSurfaceSpec): ShapedSurfaceEffect` — Rebuild the shape from blocks and shade each block with your `surface`.
|
|
667
|
+
|
|
668
|
+
## Shapes, frames & warps
|
|
669
|
+
|
|
670
|
+
### Shapes (`import {shape} from 'shaders/std'`) — https://shaders.com/docs/primitives/shape
|
|
671
|
+
|
|
672
|
+
The 2D shapes: a circle, a star, a heart and a dozen more, each as a function of a point
|
|
673
|
+
that tells you how far that point is from the shape's edge. The number is a **signed
|
|
674
|
+
distance**: negative inside, zero on the edge, positive outside. Sizes are in uv, where 1 is
|
|
675
|
+
the canvas height.
|
|
676
|
+
|
|
677
|
+
- `circle(x: Val, y: Val, radius: Val): Expr` — A circle of a given radius.
|
|
678
|
+
- `ellipse(x: Val, y: Val, radiusX: Val, radiusY: Val): Expr` — An ellipse with separate horizontal and vertical radii.
|
|
679
|
+
- `roundedRect(x: Val, y: Val, width: Val, height: Val, rounding: Val): Expr` — A rectangle with rounded corners.
|
|
680
|
+
- `polygon(x: Val, y: Val, radius: Val, sides: Val): Expr` — A regular polygon with any number of sides.
|
|
681
|
+
- `star(x: Val, y: Val, outerRadius: Val, sides: Val, innerRatio: Val): Expr` — A star with straight sides and sharp points.
|
|
682
|
+
- `flower(x: Val, y: Val, outerRadius: Val, sides: Val, innerRatio: Val): Expr` — A flower with pointed petals and V-shaped valleys between them.
|
|
683
|
+
- `heart(x: Val, y: Val, radius: Val): Expr` — A heart, point down at rotation 0.
|
|
684
|
+
- `ring(x: Val, y: Val, radius: Val, thickness: Val): Expr` — A ring: a circular band around a centre.
|
|
685
|
+
- `arc(x: Val, y: Val, radius: Val, halfAngle: Val): Expr` — A pie wedge: a filled sector of a circle.
|
|
686
|
+
- `APERTURE_TO_HALF_ANGLE: 0.008726646259971648` — The factor that turns an opening angle in degrees into the half-angle `arc` takes.
|
|
687
|
+
- `vesica(x: Val, y: Val, radius: Val, spread: Val): Expr` — A vesica: the lens where two equal circles overlap.
|
|
688
|
+
- `crescent(x: Val, y: Val, outerRadius: Val, innerRatio: Val, offset: Val): Expr` — A crescent: a disc with a smaller disc bitten out of it.
|
|
689
|
+
- `teardrop(x: Val, y: Val, radius: Val, height: Val): Expr` — A teardrop: a round bulb tapering to a sharp point, point up at rotation 0.
|
|
690
|
+
- `cross(x: Val, y: Val, size: Val, thickness: Val, rounding: Val): Expr` — A plus-shaped cross with four equal arms.
|
|
691
|
+
- `trapezoid(x: Val, y: Val, topWidth: Val, bottomWidth: Val, height: Val): Expr` — A trapezoid: a four-sided shape with a flat top and bottom of different widths.
|
|
692
|
+
- `parallelogram(x: Val, y: Val, width: Val, height: Val, skew: Val): Expr` — A parallelogram: a rectangle with its top edge slid sideways.
|
|
693
|
+
|
|
694
|
+
### Frames & coordinates (`import {frames} from 'shaders/std'`) — https://shaders.com/docs/primitives/frames
|
|
695
|
+
|
|
696
|
+
Frames are how a generator measures its pixels. Instead of raw uv you get named numbers
|
|
697
|
+
ready to use: the distance from a centre, how far along and across a line between two
|
|
698
|
+
points, or the axes of a chosen direction. `surfaceOf` is the starting point: the canvas's
|
|
699
|
+
`uv` (0–1, y down), its size in pixels and its aspect ratio. Every frame is aspect-corrected,
|
|
700
|
+
so 1 is the canvas height and a circle stays round on a wide canvas.
|
|
701
|
+
|
|
702
|
+
- `surfaceOf(params: GpuFragmentParams): {uv: Expr; viewport: Expr; aspect: Expr}` — The canvas a generator paints on: its `uv`, its `viewport` size in pixels and its `aspect`.
|
|
703
|
+
- `centredFrame(slots: {center: PropRef}): (params: GpuFragmentParams, surface: { uv: Expr; aspect: Expr; }) => CentredFrame` — A frame centred on a position prop: each pixel's offset from the centre and its distance.
|
|
704
|
+
- `segmentFrame(slots: {from: PropRef; to: PropRef}): (params: GpuFragmentParams, surface: { uv: Expr; aspect: Expr; }) => SegmentFrame` — A frame along the line between two position props: how far each pixel is along it and across it.
|
|
705
|
+
- `direction(angleDeg: Expr | number, hint: string = 'dir'): Expr` — A direction in degrees as a unit vector.
|
|
706
|
+
- `directionFrame(angleDeg: Expr | number, hint: string = 'grain'): DirectionFrame` — The two axes of a direction given in degrees, for patterns that run along it.
|
|
707
|
+
- `sectorFold(x: Expr, y: Expr, sectorAngle: Expr, center: number = 0.5): Expr` — Fold a point into one mirrored wedge around a centre: the kaleidoscope fold.
|
|
708
|
+
- `rawSurfaceOf(params: GpuFragmentParams): {uv: Expr; viewport: Expr; aspect: Expr}` — The canvas like `surfaceOf`, but always measured against the whole canvas, never a fitted box.
|
|
709
|
+
|
|
710
|
+
### Warps (`import {warps} from 'shaders/std'`) — https://shaders.com/docs/primitives/warps
|
|
711
|
+
|
|
712
|
+
Words for the `map:` field. A **warp** is a component that moves the pixels of the layer
|
|
713
|
+
inside it (the child): for every pixel on screen, the map says where in the child to look.
|
|
714
|
+
Twisting, bulging, mirroring, tilting and wiping are all warps. Positions are in uv (0–1
|
|
715
|
+
across the canvas, y down) and angles are in degrees.
|
|
716
|
+
|
|
717
|
+
- `twirl(slots: {center: ArgSpec; intensity: ArgSpec}): UvMapSource` — Twist the child around `center`, turning more the farther a pixel is from it.
|
|
718
|
+
- `bulge(slots: {center: ArgSpec; strength: ArgSpec; radius: ArgSpec; falloff: ArgSpec}): UvMapSource` — Magnify or pinch the child inside a disc around `center`.
|
|
719
|
+
- `mirrorLine(slots: {center: ArgSpec; angle: ArgSpec}): UvMapSource` — Mirror the child across a line through `center` at `angle`.
|
|
720
|
+
- `flip(slots: {flipX: ArgSpec; flipY: ArgSpec}): UvMapSource` — Flip the child horizontally, vertically, or both.
|
|
721
|
+
- `kaleidoscope(slots: {center: ArgSpec; segments: ArgSpec; angle: ArgSpec}): UvMapSource` — Fold the child into mirrored pie slices around `center`.
|
|
722
|
+
- `perspective(slots: {
|
|
723
|
+
center: ArgSpec
|
|
724
|
+
pan: ArgSpec
|
|
725
|
+
tilt: ArgSpec
|
|
726
|
+
fov: ArgSpec
|
|
727
|
+
zoom: ArgSpec
|
|
728
|
+
offset: ArgSpec
|
|
729
|
+
}): UvMapSource` — Tilt the child in 3D, as if it were a card turned away from the camera.
|
|
730
|
+
- `cornerPin(slots: {
|
|
731
|
+
topLeft: ArgSpec
|
|
732
|
+
topRight: ArgSpec
|
|
733
|
+
bottomRight: ArgSpec
|
|
734
|
+
bottomLeft: ArgSpec
|
|
735
|
+
amount: ArgSpec
|
|
736
|
+
}): UvMapSource` — Pin the four corners of the child to new positions, with true perspective between them.
|
|
737
|
+
- `bend(slots: {strength: ArgSpec; falloff: ArgSpec; angle: ArgSpec}): UvMapSource` — Curve the child like a bent sheet seen in perspective, so its ends swell or shrink.
|
|
738
|
+
- `stretch(slots: {center: ArgSpec; strength: ArgSpec; angle: ArgSpec; falloff: ArgSpec}): UvMapSource` — Stretch the child along one direction, starting at `center`.
|
|
739
|
+
- `wave(slots: {strength: ArgSpec; frequency: ArgSpec; angle: ArgSpec; waveType: PropRef}): UvMapSource` — Ripple the child with a travelling wave.
|
|
740
|
+
- `flowNoise(slots: {strength: ArgSpec; detail: ArgSpec; seed: PropRef}): UvMapSource` — Push the child around with a slowly flowing liquid motion.
|
|
741
|
+
- `toPolar(slots: {center: ArgSpec; wrap: ArgSpec; radius: ArgSpec; intensity: ArgSpec}): UvMapSource` — Unroll the child around `center`, so angle becomes x and distance becomes y.
|
|
742
|
+
- `fromPolar(slots: {center: ArgSpec; scale: ArgSpec; intensity: ArgSpec}): UvMapSource` — Wrap the child into a circle around `center`, reading its x as angle and its y as distance.
|
|
743
|
+
- `concentricRings(slots: {
|
|
744
|
+
center: ArgSpec
|
|
745
|
+
intensity: ArgSpec
|
|
746
|
+
rings: ArgSpec
|
|
747
|
+
smoothness: ArgSpec
|
|
748
|
+
seed: ArgSpec
|
|
749
|
+
speedRandomness: ArgSpec
|
|
750
|
+
}): UvMapSource` — Cut the child into rings around `center` and spin each ring by its own amount.
|
|
751
|
+
- `barOffset(slots: {count: ArgSpec; angle: ArgSpec; intensity: ArgSpec; seed: ArgSpec}): UvMapSource` — Cut the child into parallel bars and shift each one sideways by a random amount.
|
|
752
|
+
- `slicedSlide(slots: {angle: ArgSpec; count: ArgSpec; progress: ArgSpec}): UvMapSource` — Slice the child into strips that slide out of frame in alternating directions.
|
|
753
|
+
- `liquidDisplace(slots: {intensity: ArgSpec; output: string}): UvMapSource` — Move the child smoothly by a displacement field your own simulation produces.
|
|
754
|
+
- `gridCellDisplace(slots: {gridSize: ArgSpec; output: string}): UvMapSource` — Move the child by a displacement field your own simulation produces, one grid cell at a time.
|
|
755
|
+
- `displaceByLayer(slots: {
|
|
756
|
+
source: PropRef
|
|
757
|
+
amount: ArgSpec
|
|
758
|
+
channels: PropRef
|
|
759
|
+
angle: ArgSpec
|
|
760
|
+
edges: PropRef
|
|
761
|
+
}): GatherEffect` — Distort the child using another layer's pixels as a displacement map.
|
|
762
|
+
|
|
763
|
+
### Masks (`import {mask} from 'shaders/std'`) — https://shaders.com/docs/primitives/mask
|
|
764
|
+
|
|
765
|
+
A mask is coverage: a number from 0 to 1 at every pixel that says how much of something
|
|
766
|
+
shows there. Multiply it into a color's alpha to cut a shape out of a paint, or hand it to
|
|
767
|
+
an effect as its amount so the effect fades in across the canvas. Most masks start from a
|
|
768
|
+
distance, how far this pixel is from a center, a line or a shape's edge, and the mask word
|
|
769
|
+
turns that distance into an edge. `softDisc` and `softBand` give soft, styled edges for orbs
|
|
770
|
+
and curtains. `crispFill` and `crispStroke` give clean anti-aliased fills and outlines from a
|
|
771
|
+
signed distance, such as one of the `shape` words. `radialMask` is the ready-made one for
|
|
772
|
+
effects: 0 at a center, 1 past a radius, plugged straight into an effect's amount.
|
|
773
|
+
|
|
774
|
+
- `radialMask(slots: {center: PropRef; radius: PropRef; falloff: PropRef}): Scalar` — An amount that is 0 near a center and grows to 1 with distance, for an effect's strength.
|
|
775
|
+
- `softDisc(opts: {
|
|
776
|
+
dist: Expr
|
|
777
|
+
radius: Expr | number
|
|
778
|
+
softness: {width: Expr | number; curve: Expr | number}
|
|
779
|
+
}): Expr` — A filled disc with a soft, shaped edge.
|
|
780
|
+
- `crispFill(opts: {distance: Expr; footprint: Expr | number}): Expr` — A clean fill of a shape: 1 inside, 0 outside.
|
|
781
|
+
- `crispStroke(opts: {distance: Expr; width: Expr | number; footprint: Expr | number}): Expr` — A clean outline of a shape, or a drawn curve, of a given width.
|
|
782
|
+
- `softBand(opts: {
|
|
783
|
+
distance: Expr
|
|
784
|
+
below: {from: Expr | number; to: Expr | number}
|
|
785
|
+
above: {from?: Expr | number; to: Expr | number}
|
|
786
|
+
}): Expr` — A soft band around a line, sharp on one side and long on the other.
|
|
787
|
+
|
|
788
|
+
### Math (`import {math} from 'shaders/std'`) — https://shaders.com/docs/primitives/math
|
|
789
|
+
|
|
790
|
+
The arithmetic you write your own paint with. Every word takes expressions or plain numbers
|
|
791
|
+
and returns an expression the GPU works out once per pixel: `mul(color, coverage)` fades a
|
|
792
|
+
color, `smoothstep(a, b, dist)` turns a distance into a soft mask, `mix(a, b, t)` blends two
|
|
793
|
+
colors. Props reach you as `params.uniforms.<name>` (or `uniformOf(p('name'), params)`), a
|
|
794
|
+
frame gives you the coordinate, and the words compose by nesting until you return a `vec4`
|
|
795
|
+
color from `paint:`. Wrap anything you read twice in `local` so it is computed once.
|
|
796
|
+
|
|
797
|
+
- `add(a: Val, b: Val): Expr` — The sum of two values.
|
|
798
|
+
- `sub(a: Val, b: Val): Expr` — The first value minus the second.
|
|
799
|
+
- `mul(a: Val, b: Val): Expr` — The product of two values.
|
|
800
|
+
- `div(a: Val, b: Val): Expr` — The first value divided by the second.
|
|
801
|
+
- `mix(a: Val, b: Val, t: Val): Expr` — A blend from `a` to `b` by `t`, where 0 gives `a` and 1 gives `b`.
|
|
802
|
+
- `smoothstep(e0: Val, e1: Val, x: Val): Expr` — A soft edge: 0 below `e0`, 1 above `e1`, an S-curve between.
|
|
803
|
+
- `clamp(x: Val, lo: Val, hi: Val): Expr` — The value limited to the range `lo`..`hi`.
|
|
804
|
+
- `local(e: Expr, hint: string): Expr` — A value computed once per pixel and shared by everything that reads it.
|
|
805
|
+
- `vec4(...parts: Val[]): Expr` — A 4D vector, usually the final color with alpha.
|
|
806
|
+
- `vec3(x: Val, y: Val, z: Val): Expr` — A 3D vector from three values, often a color without alpha.
|
|
807
|
+
- `vec2(x: Val, y: Val): Expr` — A 2D vector from two values.
|
|
808
|
+
- `splat3(x: Val): Expr` — One number copied into all three channels of a vec3.
|
|
809
|
+
- `length(v: Val): Expr` — The length of a vector.
|
|
810
|
+
- `distance(a: Val, b: Val): Expr` — The distance between two points.
|
|
811
|
+
- `abs(x: Val): Expr` — The value without its sign.
|
|
812
|
+
- `fract(x: Val): Expr` — The fractional part of a value, 0..1.
|
|
813
|
+
- `floor(x: Val): Expr` — The value rounded down to a whole number.
|
|
814
|
+
- `min(a: Val, b: Val): Expr` — The smaller of two values.
|
|
815
|
+
- `max(a: Val, b: Val): Expr` — The larger of two values.
|
|
816
|
+
- `sin(x: Val): Expr` — The sine of an angle in radians, −1..1.
|
|
817
|
+
- `cos(x: Val): Expr` — The cosine of an angle in radians, −1..1.
|
|
818
|
+
- `step(edge: Val, x: Val): Expr` — A hard edge: 0 when `x` is below `edge`, 1 from `edge` on.
|
|
819
|
+
- `pow(x: Val, y: Val): Expr` — The first value raised to the power of the second.
|
|
820
|
+
- `exp(x: Val): Expr` — e raised to the value.
|
|
821
|
+
- `sqrt(x: Val): Expr` — The square root of a value.
|
|
822
|
+
- `neg(a: Val): Expr` — The value with its sign flipped.
|
|
823
|
+
- `select(cond: Expr, ifTrue: Val, ifFalse: Val): Expr` — `ifTrue` when the condition holds, otherwise `ifFalse`.
|
|
824
|
+
- `lt(a: Val, b: Val): Expr` — True when `a` is less than `b`.
|
|
825
|
+
- `gt(a: Val, b: Val): Expr` — True when `a` is greater than `b`.
|
|
826
|
+
- `le(a: Val, b: Val): Expr` — True when `a` is less than or equal to `b`.
|
|
827
|
+
- `ge(a: Val, b: Val): Expr` — True when `a` is greater than or equal to `b`.
|
|
828
|
+
- `atan2(y: Val, x: Val): Expr` — The angle of the point (x, y) in radians, −π..π.
|
|
829
|
+
- `dot(a: Val, b: Val): Expr` — The dot product of two vectors.
|
|
830
|
+
- `normalize(v: Val): Expr` — The vector scaled to length 1.
|
|
831
|
+
- `rotate2(p: Val, cosA: Val, sinA: Val): Expr` — A 2D point rotated around the origin.
|
|
832
|
+
- `gaussBell(x: Expr, k: Val): Expr` — A bell curve: 1 at zero, falling toward 0 on both sides.
|
|
833
|
+
- `softPlus(x: Expr, k: Val): Expr` — A soft hinge: about 0 for values well below zero, about `x` above, rounded near zero.
|
|
834
|
+
- `hashPhase(seed: Val, salt: {k: number; big: number}): Expr` — A random but stable angle in radians, 0..2π, from a seed.
|
|
835
|
+
- `sign(x: Val): Expr` — −1, 0 or 1 by the sign of the value.
|
|
836
|
+
- `ceil(x: Val): Expr` — The value rounded up to a whole number.
|
|
837
|
+
- `log(x: Val): Expr` — The natural logarithm of a value.
|
|
838
|
+
- `exp2(x: Val): Expr` — 2 raised to the value.
|
|
839
|
+
- `tan(x: Val): Expr` — The tangent of an angle in radians.
|
|
840
|
+
- `cross(a: Val, b: Val): Expr` — The cross product of two 3D vectors.
|
|
841
|
+
- `reflect(i: Val, n: Val): Expr` — The direction `i` bounced off a surface with unit normal `n`.
|
|
842
|
+
- `refract(i: Val, n: Val, eta: Val): Expr` — The direction `i` bent through a surface with unit normal `n`.
|
|
843
|
+
- `float(n: number): Expr` — A plain number as an expression.
|
|
844
|
+
|
|
845
|
+
### Motion & timing (`import {motion} from 'shaders/std'`) — https://shaders.com/docs/primitives/motion
|
|
846
|
+
|
|
847
|
+
Words that turn a clock into rhythm. The clock is a number of seconds: declare
|
|
848
|
+
`animatedTime: {speed: 'speed'}` on the definition and read the layer's clock with
|
|
849
|
+
`animatedTime(params)`, and a speed prop and a pause button come for free. `cycle` splits
|
|
850
|
+
that clock into "which pass is this" and "how far through it are we", `cycleSeed` gives each
|
|
851
|
+
pass a stable random number, `oscillate` and `pulseTrain` shape it into a sweep or a blink,
|
|
852
|
+
and the easings bend a 0..1 progress. The result is a number you multiply into a color, a
|
|
853
|
+
radius or a coordinate.
|
|
854
|
+
|
|
855
|
+
- `oscillating(opts: {rate?: number; min?: Expr | number; max?: Expr | number; offset?: number; clock?: SignalClock}): Scalar` — A knob that sweeps between `min` and `max` on its own, for any slot that takes a prop.
|
|
856
|
+
- `pulsing(opts: {period: number; duty: number; soften?: number; clock?: SignalClock}): Scalar` — A knob that switches on and off in a rhythm, for any slot that takes a prop.
|
|
857
|
+
- `cycle(t: Expr, period: Expr | number): {progress: Expr; index: Expr}` — A repeating cycle as two numbers: `progress` (0..1 through the current cycle) and `index` (which cycle this is).
|
|
858
|
+
- `cycleSeed(index: Expr, salt: number = 0): Expr` — A random but stable number, 0..1, for each cycle index.
|
|
859
|
+
- `oscillate(t: Expr, opts: {rate?: number; min?: Expr | number; max?: Expr | number; offset?: number}): Expr` — A smooth back-and-forth between `min` and `max`.
|
|
860
|
+
- `pulseTrain(t: Expr, opts: {period: Expr | number; duty: Expr | number; soften?: number}): Expr` — An on/off rhythm: 1 for the first part of each cycle, 0 for the rest.
|
|
861
|
+
- `phase(t: Expr, period: Expr | number): Expr` — How far through a repeating cycle the clock is, 0..1.
|
|
862
|
+
- `easeInOut(x: Expr): Expr` — A 0..1 value that starts slow, speeds up, and slows again at the end.
|
|
863
|
+
- `easeOut(x: Expr): Expr` — A 0..1 value that starts fast and slows to a stop.
|
|
864
|
+
- `easeIn(x: Expr): Expr` — A 0..1 value that starts slow and speeds up.
|
|
865
|
+
- `flashes(t: Expr, opts: {rate: Expr | number; offset?: Expr | number; sharpness: 2 | 4 | 8 | 16}): Expr` — Short, bright flashes at a steady rate: dark most of the time, peaking briefly to 1.
|
|
866
|
+
|
|
867
|
+
### Signals (`import {signal} from 'shaders/std'`) — https://shaders.com/docs/primitives/signal
|
|
868
|
+
|
|
869
|
+
Live inputs a simulation reads every frame: where the pointer is and how fast it is moving.
|
|
870
|
+
You never read the numbers yourself. You hand a signal to a simulation step, such as the
|
|
871
|
+
splat step of a grid simulation, and the engine tracks the pointer, measures its speed in
|
|
872
|
+
uv per second, and feeds both in. `pointer` carries one choice, the teleport guard, which
|
|
873
|
+
stops a cursor that jumps into the canvas from slamming the field. `pointerSpeed` caps the
|
|
874
|
+
speed so a fast flick cannot overdrive it. Both are also exported at the top level of
|
|
875
|
+
`shaders/std`.
|
|
876
|
+
|
|
877
|
+
- `pointer(opts?: {teleportGuard?: 'on' | 'off'}): PointerSignal` — The pointer's position, for a simulation step that reacts to the cursor.
|
|
878
|
+
- `pointerSpeed(opts?: {max?: number}): PointerSpeedSignal` — The pointer's speed, capped at `max`, as the strength of a simulation step.
|
|
879
|
+
- `cpuHash01(x: number): number` — A random but stable number, 0..1, from a seed, computed in JavaScript.
|
|
880
|
+
|
|
881
|
+
## Filters & effects
|
|
882
|
+
|
|
883
|
+
### Filter effects (`shaders/std` top level) — https://shaders.com/docs/primitives/filter
|
|
884
|
+
|
|
885
|
+
Words for the `effect:` field. A **filter** is a component that changes the layer inside it
|
|
886
|
+
(the child). A definition with an `effect:` is a filter, nothing else to declare.
|
|
887
|
+
|
|
888
|
+
- `tintToward(color: PropRef, opts: {amount: ScalarInput}): TintTowardEffect` — Mix the child's color toward one color by an amount, leaving its alpha alone.
|
|
889
|
+
- `paintThrough(paint: Paint, opts: {by?: 'alpha' | 'luminance'} = {}): PointwiseEffect` — Show a paint through the child, so the child becomes the mask.
|
|
890
|
+
- `displaceBy(field: import('./sim').SimOutputRef, opts: {strength: PropRef; chromatic: PropRef; edges: PropRef}): DisplaceByEffect` — Push the child's pixels around by a vector field from one of your simulations.
|
|
891
|
+
- `pointwise(config: Omit<PointwiseEffect, 'kind'>): PointwiseEffect` — Write your own pointwise effect: a function of the child's color at this pixel.
|
|
892
|
+
- `gather(config: Omit<GatherEffect, 'kind'>): GatherEffect` — Write your own gather effect: a function that can read the child anywhere.
|
|
893
|
+
|
|
894
|
+
### Color effects (`import {effects} from 'shaders/std'`) — https://shaders.com/docs/primitives/effects.color
|
|
895
|
+
|
|
896
|
+
Words that recolor the layer inside them, one pixel at a time. Each returns a **pointwise
|
|
897
|
+
effect** for a filter definition's `effect:` field: it reads the child's color at this pixel
|
|
898
|
+
and returns the adjusted color, with alpha kept. Nothing is sampled from neighbouring
|
|
899
|
+
pixels, so these filters are cheap and stack freely. Pass props with `p('name')`; the units
|
|
900
|
+
are the ones the word names (degrees, 0–1 amounts, a multiplier around 1).
|
|
901
|
+
|
|
902
|
+
- `saturate(intensity: ArgSpec): PointwiseEffect` — Scale the child's saturation.
|
|
903
|
+
- `vibrance(intensity: ArgSpec): PointwiseEffect` — Boost muted colors while leaving already-vivid ones mostly alone.
|
|
904
|
+
- `hueRotate(shift: ArgSpec): PointwiseEffect` — Rotate the child's hue around the color wheel.
|
|
905
|
+
- `brightnessContrast(slots: {brightness: ArgSpec; contrast: ArgSpec}): PointwiseEffect` — Adjust the child's brightness and contrast together.
|
|
906
|
+
- `exposure(gain: ArgSpec): PointwiseEffect` — Multiply the child's brightness, like opening a camera's aperture.
|
|
907
|
+
- `grayscale(): PointwiseEffect` — Turn the child black and white, weighted the way the eye sees brightness.
|
|
908
|
+
- `invert(): PointwiseEffect` — Flip every color of the child to its negative.
|
|
909
|
+
- `solarize(slots: {threshold: ArgSpec; strength: ArgSpec}): PointwiseEffect` — Invert only the bright parts of the child, the darkroom solarization look.
|
|
910
|
+
- `posterize(steps: ArgSpec): PointwiseEffect` — Reduce the child to a few flat color levels, like a screen-printed poster.
|
|
911
|
+
- `tint(slots: {color: PropRef; amount: ArgSpec; preserveLuminosity: PropRef}): PointwiseEffect` — Wash the child toward one color.
|
|
912
|
+
- `duotone(slots: {colorA: PropRef; colorB: PropRef; blend: ArgSpec; colorSpace: PropRef}): PointwiseEffect` — Repaint the child in two colors: `colorA` for the shadows, `colorB` for the highlights.
|
|
913
|
+
- `tritone(slots: {colorA: PropRef; colorB: PropRef; colorC: PropRef; blendMid: ArgSpec; colorSpace: PropRef}): PointwiseEffect` — Repaint the child in three colors: `colorA` for the shadows, `colorB` for the midtones, `colorC` for the highlights.
|
|
914
|
+
- `gradientMap(slots: {
|
|
915
|
+
palette: PropRef
|
|
916
|
+
colorLow: PropRef
|
|
917
|
+
colorMid: PropRef
|
|
918
|
+
colorHigh: PropRef
|
|
919
|
+
speed: PropRef
|
|
920
|
+
contrast: ArgSpec
|
|
921
|
+
blackPoint: ArgSpec
|
|
922
|
+
whitePoint: ArgSpec
|
|
923
|
+
strength: PropRef
|
|
924
|
+
colorSpace: PropRef
|
|
925
|
+
}): PointwiseEffect` — Recolor the child by its brightness through a gradient, the Photoshop gradient map.
|
|
926
|
+
- `filmGrain(slots: {strength: ArgSpec; bias: ArgSpec; animated: PropRef}): PointwiseEffect` — Sprinkle film grain over the child, heaviest in the shadows.
|
|
927
|
+
- `isolines(slots: {
|
|
928
|
+
source: PropRef
|
|
929
|
+
levels: ArgSpec
|
|
930
|
+
lineWidth: ArgSpec
|
|
931
|
+
softness: ArgSpec
|
|
932
|
+
gamma: ArgSpec
|
|
933
|
+
invert: ArgSpec
|
|
934
|
+
colorMode: PropRef
|
|
935
|
+
lineColor: PropRef
|
|
936
|
+
backgroundColor: PropRef
|
|
937
|
+
}): PointwiseEffect` — Draw topographic contour lines over the child, traced from its brightness or its alpha.
|
|
938
|
+
- `lutAtlasGrade(slots: {
|
|
939
|
+
select: PropRef
|
|
940
|
+
strength: PropRef
|
|
941
|
+
size: number
|
|
942
|
+
decode: (key: string) => Uint8Array
|
|
943
|
+
fallback: string
|
|
944
|
+
label: string
|
|
945
|
+
}): (color: Expr, params: FilterParams | GpuFragmentParams) => Expr` — Grade a color through a measured 3D color lookup table (LUT), the film-stock look.
|
|
946
|
+
|
|
947
|
+
### Blurs, glows & screens (`import {effects} from 'shaders/std'`) — https://shaders.com/docs/primitives/effects.blurs
|
|
948
|
+
|
|
949
|
+
Effects that read the layer inside them (the child) as a texture and rebuild it: blurs, glows,
|
|
950
|
+
sharpening, pixelation, shadows, retro screens, glitches, fluted glass, page peels and mirror
|
|
951
|
+
floors. A **pointwise** effect edits the child's color at one pixel; the words here are
|
|
952
|
+
**gather** effects, which sample the child at other pixels too, so they can smear, spread and
|
|
953
|
+
displace it. Every word here goes in a filter definition's `effect:` field, or spreads into a
|
|
954
|
+
definition when it needs its own pass over the child first.
|
|
955
|
+
|
|
956
|
+
- `gaussianBlur(opts: {intensity: PropRef}): ComputeBackedEffect` — A soft, even blur of the child.
|
|
957
|
+
- `motionBlur(opts: {path: BlurPathSpec; amount: ArgSpec}): GatherEffect` — Smears the child along a path: a straight streak, an arc around a point, or a zoom out of a point.
|
|
958
|
+
- `progressiveBlur(opts: {
|
|
959
|
+
intensity: PropRef
|
|
960
|
+
angle: PropRef
|
|
961
|
+
center: PropRef
|
|
962
|
+
falloff: PropRef
|
|
963
|
+
}): ComputeBackedEffect` — A blur that ramps from sharp to full strength in one direction across the child.
|
|
964
|
+
- `tiltShift(opts: {
|
|
965
|
+
intensity: PropRef
|
|
966
|
+
width: PropRef
|
|
967
|
+
falloff: PropRef
|
|
968
|
+
angle: PropRef
|
|
969
|
+
center: PropRef
|
|
970
|
+
}): ComputeBackedEffect` — Keeps a band of the child in focus and blurs everything beyond it, like a tilt-shift lens.
|
|
971
|
+
- `bloom(opts: {intensity: PropRef; threshold: PropRef; size: PropRef}): ComputeBackedEffect` — A glow: the child's bright parts spread into a soft halo that adds back on top.
|
|
972
|
+
- `bokehDefocus(opts: {
|
|
973
|
+
radius: PropRef
|
|
974
|
+
gain: PropRef
|
|
975
|
+
threshold: PropRef
|
|
976
|
+
shape: PropRef
|
|
977
|
+
blades: PropRef
|
|
978
|
+
rotation: PropRef
|
|
979
|
+
fringe: PropRef
|
|
980
|
+
}): {compute: GpuComputeNode; gpu: {fragment: (params: GpuFragmentParams) => Expr}}` — A photographic lens blur where bright highlights bloom into aperture-shaped discs.
|
|
981
|
+
- `channelBlur(opts: {red: PropRef; green: PropRef; blue: PropRef}): ComputeBackedEffect` — Blurs red, green and blue by separate amounts, for a soft chromatic fringe.
|
|
982
|
+
- `scatter(opts: {amount: ArgSpec; edges: PropRef}): GatherEffect` — Scatters every pixel of the child by a random offset: a grainy diffusion, not a smooth blur.
|
|
983
|
+
- `sharpen(amount: ArgSpec): GatherEffect` — Sharpens the child by boosting the contrast between each pixel and its neighbours.
|
|
984
|
+
- `pixelate(opts: {scale: ArgSpec; gap: ArgSpec; roundness: ArgSpec}): GatherEffect` — Turns the child into a grid of flat cells, each showing one color.
|
|
985
|
+
- `gatherStack(sample: SampleStage, overlays: OverlayStage[], opts?: {resultAlpha?: 'premultiplied' | 'straight'}): GatherEffect` — Assemble an effect from one sampling stage and an ordered list of overlay stages.
|
|
986
|
+
- `childTap(): SampleStage` — The child's own color at this pixel, unchanged.
|
|
987
|
+
- `shadowOffset(opts: {angle: ArgSpec; distance: ArgSpec}): (params: RttFilterParams) => Expr` — The coordinate a shadow reads the child's silhouette from: `distance` away in the compass direction `angle`.
|
|
988
|
+
- `silhouetteCoverage(opts: {at: (params: RttFilterParams) => Expr; blur: ArgSpec}): (params: RttFilterParams) => Expr` — A soft copy of the child's alpha silhouette: a number per pixel from 0 to 1.
|
|
989
|
+
- `shadowComposite(opts: {
|
|
990
|
+
coverage: (params: RttFilterParams) => Expr
|
|
991
|
+
color: PropRef
|
|
992
|
+
intensity: ArgSpec
|
|
993
|
+
cutout: PropRef
|
|
994
|
+
}): OverlayStage` — A tinted shadow behind the child.
|
|
995
|
+
- `rgbSplit(opts: {amount: ArgSpec}): SampleStage` — The child with its red and blue pulled a little to either side, like a misaligned CRT.
|
|
996
|
+
- `adjust(opts: {brightness: ArgSpec; contrast: ArgSpec}): OverlayStage` — Brightness and contrast, pivoting around mid-grey.
|
|
997
|
+
- `scanlines(opts: {frequency: ArgSpec; intensity: ArgSpec}): OverlayStage` — Horizontal scanlines darkening the child in a smooth wave.
|
|
998
|
+
- `phosphorMask(opts: {pitch: ArgSpec}): OverlayStage` — A faint red, green and blue phosphor stripe pattern across the child.
|
|
999
|
+
- `vignetteOverlay(opts: {radius: ArgSpec; intensity: ArgSpec}): OverlayStage` — Darkens the child toward its corners.
|
|
1000
|
+
- `opaque(): OverlayStage` — Closes a three-channel stack as a solid color with alpha 1.
|
|
1001
|
+
- `tapeWarp(opts: {wobble: ArgSpec; jitter: ArgSpec; speed: ArgSpec}): (params: RttFilterParams) => Expr` — The wobbling, jittering coordinates of a worn VHS tape, to feed into `chromaSmearTaps`.
|
|
1002
|
+
- `chromaSmearTaps(opts: {warp: (params: RttFilterParams) => Expr; smear: ArgSpec}): SampleStage` — The child sampled like a VHS deck: brightness stays sharp while color bleeds sideways.
|
|
1003
|
+
- `beatPulse(opts: {wobble: ArgSpec; speed: ArgSpec}): OverlayStage` — A faint brightness throb, like the mains hum of an old television.
|
|
1004
|
+
- `glitchFrame(opts: {
|
|
1005
|
+
intensity: ArgSpec
|
|
1006
|
+
speed: ArgSpec
|
|
1007
|
+
blockDensity: ArgSpec
|
|
1008
|
+
mirrorAmount: ArgSpec
|
|
1009
|
+
}): GatherFrame` — The shared geometry of a digital glitch: when bursts fire, which horizontal bands jitter, and which blocks shift or flip.
|
|
1010
|
+
- `glitchRgbSplit(frame: GatherFrame, opts: {shift: ArgSpec}): SampleStage` — The child sampled through a glitch frame, with red and blue pulled apart inside the active bands.
|
|
1011
|
+
- `colorBarFills(frame: GatherFrame, opts: {intensity: ArgSpec}): OverlayStage` — Neon color bars filling the blocks a glitch frame currently has active.
|
|
1012
|
+
- `distortedScanlines(frame: GatherFrame, opts: {intensity: ArgSpec}): OverlayStage` — CRT-style scanlines that appear only where a glitch frame is currently distorting.
|
|
1013
|
+
- `sphereFrame(opts: {center: ArgSpec; radius: ArgSpec; depth: ArgSpec}): GatherFrame` — The geometry of a sphere bulging out of the canvas: where each pixel reads the child from, where the sphere ends, and which way its surface faces.
|
|
1014
|
+
- `crispTap(frame: GatherFrame): SampleStage` — One clean sample of the child at a frame's warped coordinate.
|
|
1015
|
+
- `rimLit(frame: GatherFrame, opts: {
|
|
1016
|
+
position: ArgSpec
|
|
1017
|
+
intensity: ArgSpec
|
|
1018
|
+
softness: ArgSpec
|
|
1019
|
+
color: PropRef
|
|
1020
|
+
}): OverlayStage` — A tinted rim of light around the edge of a bulged surface, added on top of the child's color.
|
|
1021
|
+
- `fluteFrame(opts: {
|
|
1022
|
+
shape: PropRef
|
|
1023
|
+
angle: ArgSpec
|
|
1024
|
+
frequency: ArgSpec
|
|
1025
|
+
softness: ArgSpec
|
|
1026
|
+
waveAmplitude: ArgSpec
|
|
1027
|
+
waveFrequency: ArgSpec
|
|
1028
|
+
refraction: ArgSpec
|
|
1029
|
+
aberration: ArgSpec
|
|
1030
|
+
}): GatherFrame` — The geometry of fluted (reeded) glass over the child: where each pixel reads through the glass, how far its colors split, and the slope of the flute at that point.
|
|
1031
|
+
- `refractedTaps(frame: GatherFrame, opts: {aberration: PropRef; edges: PropRef}): SampleStage` — The child seen through a flute frame, with edge handling and a color split when `aberration` is above 0.
|
|
1032
|
+
- `fluteHighlight(frame: GatherFrame, opts: {
|
|
1033
|
+
lightAngle: ArgSpec
|
|
1034
|
+
highlight: ArgSpec
|
|
1035
|
+
softness: ArgSpec
|
|
1036
|
+
color: PropRef
|
|
1037
|
+
}): OverlayStage` — A specular highlight running along each flute, added on top of the child's color.
|
|
1038
|
+
- `peelFrame(opts: {corner: PropRef; amount: ArgSpec; radius: ArgSpec}): GatherFrame` — The geometry of a page curling up from one corner: where the curl reads the child from, how far it has turned, and how far each pixel is from the crease.
|
|
1039
|
+
- `peelCompose(frame: GatherFrame, parts: {
|
|
1040
|
+
shade: PeelShade
|
|
1041
|
+
sheen: PeelShade
|
|
1042
|
+
overhang: PeelShade
|
|
1043
|
+
reveal: PeelShade
|
|
1044
|
+
}): SampleStage` — A finished page peel: the cast shadows, the flat page and the lit curl, layered back to front.
|
|
1045
|
+
- `curlShading(frame: GatherFrame, opts: {shading: ArgSpec}): PeelShade` — The darkening in the crook of a curl, easing to full brightness at the lip.
|
|
1046
|
+
- `curlSheen(frame: GatherFrame, opts: {highlight: ArgSpec; softness: ArgSpec}): PeelShade` — The band of light running up a curl.
|
|
1047
|
+
- `overhangShadow(frame: GatherFrame, opts: {amount: ArgSpec; shadow: ArgSpec}): PeelShade` — The shadow a lifted curl casts on the flat page just past the crease.
|
|
1048
|
+
- `revealShadow(frame: GatherFrame, opts: {amount: ArgSpec; shadow: ArgSpec}): PeelShade` — The shadow on the surface a peel reveals, just inside the crease.
|
|
1049
|
+
- `mirrorAcrossRow(line: PropRef): (params: GpuFragmentParams) => Expr` — The coordinate mirrored across a horizontal line, for reading a reflection below it.
|
|
1050
|
+
- `depthRampBlur(opts: {line: PropRef; blur: PropRef; blurDistance: PropRef; halfKernel: number}): {compute: GpuComputeNode}` — The blur half of a mirror floor: blurs the child more the further a row sits below the line.
|
|
1051
|
+
- `planarReflection(opts: {line: PropRef; distance: PropRef; falloff: PropRef; edges: PropRef}, original: Expr, reflection: (uv: Expr) => Expr, reflectedUV: (params: GpuFragmentParams) => Expr): (params: GpuFragmentParams) => Expr` — A mirror floor: the child as it is above a line, and its reflection fading out below it.
|
|
1052
|
+
- `screenedBloom(slots: {
|
|
1053
|
+
strength: PropRef
|
|
1054
|
+
radius: PropRef
|
|
1055
|
+
tint: [number, number, number]
|
|
1056
|
+
threshold: number
|
|
1057
|
+
output: string
|
|
1058
|
+
extractName: string
|
|
1059
|
+
}): {
|
|
1060
|
+
compute: GpuComputeNode
|
|
1061
|
+
screen: (base: Expr, at: Expr, params: GpuFragmentParams) => Expr
|
|
1062
|
+
}` — A tinted glow of the child's bright parts, screened over a color you have already graded: film halation, phosphor bloom.
|
|
1063
|
+
- `frameSway(slots: {amount: PropRef; field: string}): (params: GpuFragmentParams) => Expr` — A slight drifting shift and rotation of where the child is read from, like film in an unsteady projector gate.
|
|
1064
|
+
- `blurPath.linear(angle: PropRef): BlurPathSpec` — A straight streak along an angle prop, in degrees (0 points right, 90 points down).
|
|
1065
|
+
- `blurPath.orbit(center: PropRef): BlurPathSpec` — An arc streak rotating around a center prop (a position in uv).
|
|
1066
|
+
- `blurPath.zoom(center: PropRef): BlurPathSpec` — A radial streak rushing outward from a center prop (a position in uv).
|
|
1067
|
+
- `brightestNear(read: (uv: Expr) => Expr, center: Expr, opts: {radius: Expr; taps: number; angle?: number}): {
|
|
1068
|
+
color: Expr
|
|
1069
|
+
luma: Expr
|
|
1070
|
+
}` — The brightest color in a small ring around a point: the layer grown outward, so a spot just outside a bright area still reads as bright.
|
|
1071
|
+
|
|
1072
|
+
### Stylize (`import {effects} from 'shaders/std'`) — https://shaders.com/docs/primitives/effects.stylize
|
|
1073
|
+
|
|
1074
|
+
Hand-made looks for the layer inside: a watercolor wash, a chalk drawing on a board, ASCII
|
|
1075
|
+
characters, and copper-plate line engraving. Each look is a recipe of two or three words. A
|
|
1076
|
+
**stage** is one piece of the look that reads the layer once it is rendered to a texture (a
|
|
1077
|
+
wobbled sample position, a brush, a ring of edge samples, a character grid). Build a stage once
|
|
1078
|
+
and hand the same one to every word that needs it, so they agree. The closing word (`wash`,
|
|
1079
|
+
`chalkSketch`, `linework`) returns the effect for `effect:`. The ASCII look closes with
|
|
1080
|
+
`glyphTint`, which returns a fragment for `gpu.fragment` because it also needs a character
|
|
1081
|
+
atlas drawn on the CPU.
|
|
1082
|
+
|
|
1083
|
+
- `wash(slots: {
|
|
1084
|
+
at: GatherStage
|
|
1085
|
+
brush: KuwaharaBrush
|
|
1086
|
+
grain: GatherStage
|
|
1087
|
+
paper: PropRef
|
|
1088
|
+
paperColor: PropRef
|
|
1089
|
+
strength: PropRef
|
|
1090
|
+
}): GatherEffect` — The watercolor look: the layer inside flattened into soft patches of color over paper grain.
|
|
1091
|
+
- `kuwahara(slots: {at: GatherStage; radius: PropRef}): KuwaharaBrush` — A painter's brush: the flattening that turns fine detail into soft patches of one color.
|
|
1092
|
+
- `bleedWarp(slots: {amount: PropRef}): GatherStage` — A sample position that drifts slowly past hard edges, so paint bleeds instead of stopping.
|
|
1093
|
+
- `paperGrain(slots: {amount: PropRef}): GatherStage` — Fine paper grain for the pigment to settle into, one brightness value per screen pixel.
|
|
1094
|
+
- `chalkSketch(slots: {
|
|
1095
|
+
edges: SobelRing
|
|
1096
|
+
sensitivity: PropRef
|
|
1097
|
+
hatchScale: PropRef
|
|
1098
|
+
shading: PropRef
|
|
1099
|
+
grain: PropRef
|
|
1100
|
+
board: PropRef
|
|
1101
|
+
chalk: PropRef
|
|
1102
|
+
}): GatherEffect` — The chalk-drawing look: edges become chalk strokes and dark areas fill with cross-hatching.
|
|
1103
|
+
- `sobelTaps(slots: {spacing: PropRef}): SobelRing` — Eight brightness samples in a ring around each pixel, for finding edges.
|
|
1104
|
+
- `linework(slots: {
|
|
1105
|
+
style: PropRef
|
|
1106
|
+
frequency: PropRef
|
|
1107
|
+
angle: PropRef
|
|
1108
|
+
center: PropRef
|
|
1109
|
+
relief: PropRef
|
|
1110
|
+
waviness: PropRef
|
|
1111
|
+
contrast: PropRef
|
|
1112
|
+
ink: PropRef
|
|
1113
|
+
paper: PropRef
|
|
1114
|
+
}): GatherEffect` — The engraving look: the layer inside redrawn as ink lines that swell where it is dark.
|
|
1115
|
+
- `glyphTint(slots: {
|
|
1116
|
+
grid: FragmentStage
|
|
1117
|
+
cell: FragmentStage
|
|
1118
|
+
glyph: FragmentStage
|
|
1119
|
+
alphaThreshold: PropRef
|
|
1120
|
+
preserveAlpha: PropRef
|
|
1121
|
+
}): FragmentStage` — The finished ASCII look: each character tinted with its cell's color, everything else transparent.
|
|
1122
|
+
- `glyphFor(slots: {
|
|
1123
|
+
grid: FragmentStage
|
|
1124
|
+
cell: FragmentStage
|
|
1125
|
+
gamma: PropRef
|
|
1126
|
+
atlas: (params: GpuFragmentParams) => KitTexture
|
|
1127
|
+
}): FragmentStage` — The character drawn in each cell, picked by how bright the cell is.
|
|
1128
|
+
- `charGrid(slots: {cellSize: PropRef; spacing: PropRef}): FragmentStage` — The character grid: which cell each pixel falls in, and where it sits inside that cell.
|
|
1129
|
+
- `cellSample(slots: {grid: FragmentStage}): FragmentStage` — The color of the layer inside at the centre of each character cell.
|
|
1130
|
+
|
|
1131
|
+
### Lens (`import {effects} from 'shaders/std'`) — https://shaders.com/docs/primitives/effects.lens
|
|
1132
|
+
|
|
1133
|
+
Words for the color fringing a real lens leaves behind: the red, green and blue copies of
|
|
1134
|
+
the layer inside pushed apart, or fanned out into a whole spectrum. Because they read the
|
|
1135
|
+
child at several places per pixel, these are **gather effects**: the child is rendered to a
|
|
1136
|
+
texture first and the effect samples it. `chromaticFan` is a sampling stage; hand it to
|
|
1137
|
+
`gatherStack` (from `effects.blurs`) to turn it into the `effect:` of a filter definition,
|
|
1138
|
+
optionally followed by more stages. `spectralLens` is a complete fragment for a `gpu:`
|
|
1139
|
+
definition, with the lens warp, focus zones and grain built in.
|
|
1140
|
+
|
|
1141
|
+
- `chromaticFan(opts: {
|
|
1142
|
+
strength: ArgSpec
|
|
1143
|
+
angle: ArgSpec
|
|
1144
|
+
red: ArgSpec
|
|
1145
|
+
green: ArgSpec
|
|
1146
|
+
blue: ArgSpec
|
|
1147
|
+
}): SampleStage` — Split the child into red, green and blue copies pushed apart along one direction.
|
|
1148
|
+
- `spectralLens(slots: SpectralLensSlots): (params: GpuFragmentParams) => Expr` — Fan the child out into many color-shifted copies through a warped lens, the spectral-lens look.
|
|
1149
|
+
|
|
1150
|
+
### Reveals & wipes (`import {effects} from 'shaders/std'`) — https://shaders.com/docs/primitives/effects.reveal
|
|
1151
|
+
|
|
1152
|
+
Words that make the layer inside disappear in a chosen order: a straight edge, a growing
|
|
1153
|
+
circle, a clock sweep, a grid of blocks, a noise dissolve. Every wipe is the same effect,
|
|
1154
|
+
`reveal`, fed a different **coverage**: a number per pixel from 0 to 1 that says when that
|
|
1155
|
+
pixel goes (0 first, 1 last). As the `progress` prop climbs from 0 to 1, pixels whose
|
|
1156
|
+
coverage falls below it fade out across a soft front `feather` wide.
|
|
1157
|
+
|
|
1158
|
+
- `reveal(slots: RevealSlots): PointwiseEffect` — Fade the child away in coverage order as `progress` goes from 0 to 1.
|
|
1159
|
+
- `coverage.directional(angleDeg: ArgSpec): Coverage` — A straight edge sweeping across the canvas.
|
|
1160
|
+
- `coverage.radial(center: ArgSpec): Coverage` — A circle growing out from `center`, an iris wipe.
|
|
1161
|
+
- `coverage.angular(center: ArgSpec, startDeg: ArgSpec, direction: PropRef | AngularDirection): Coverage` — A clock hand sweeping around `center`.
|
|
1162
|
+
- `coverage.cells(size: ArgSpec): CellCoverage` — A grid of square cells `size` wide.
|
|
1163
|
+
- `coverage.noise(scale: ArgSpec, seed: ArgSpec): Coverage` — Soft blobs eating the image away, the classic film dissolve.
|
|
1164
|
+
- `class Coverage` — The order pixels disappear in: a number per pixel from 0 (goes first) to 1 (goes last).
|
|
1165
|
+
- `class BandedCoverage` — A coverage cut into bands.
|
|
1166
|
+
- `class CellCoverage` — The canvas cut into a grid of square cells, waiting for you to pick the order the cells go in.
|
|
1167
|
+
|
|
1168
|
+
### Instances (`import {effects} from 'shaders/std'`) — https://shaders.com/docs/primitives/effects.instances
|
|
1169
|
+
|
|
1170
|
+
Repeat the layer inside. `repeatInstances` draws many copies of it, laid out in a grid, around
|
|
1171
|
+
a circle or along a line, each copy scaled, turned, faded and jittered a little more than the
|
|
1172
|
+
last. It returns the fragment for `gpu.fragment`. The layout words (`grid`, `radial`, `line`)
|
|
1173
|
+
say where the copies go, `byMode` lets one select prop switch between all three, and the
|
|
1174
|
+
recipe's `variation` object says how the copies differ.
|
|
1175
|
+
|
|
1176
|
+
- `repeatInstances(recipe: RepeatInstancesRecipe): (params: GpuFragmentParams) => Expr` — Many copies of the layer inside, laid out and varied as the recipe says.
|
|
1177
|
+
- `grid(slots: GridSlots): PlacementSpec` — Copies in rows and columns, filling this layer's bounding box.
|
|
1178
|
+
- `radial(slots: RadialSlots): PlacementSpec` — Copies around a circle centred on the layer inside.
|
|
1179
|
+
- `line(slots: LineSlots): PlacementSpec` — Copies in a row, marching away from the layer inside in one direction.
|
|
1180
|
+
- `byMode(mode: PropRef, members: PlacementPick['members']): PlacementPick` — Lets one select prop switch between a grid, a radial and a linear layout.
|
|
1181
|
+
|
|
1182
|
+
### Fracture (`import {effects} from 'shaders/std'`) — https://shaders.com/docs/primitives/effects.fracture
|
|
1183
|
+
|
|
1184
|
+
Broken glass. The canvas splits into **shards** around a set of random sites; a pixel belongs
|
|
1185
|
+
to the nearest site. Where a shard has moved, a **crack** opens along its border with the
|
|
1186
|
+
next-nearest shard, and the layer inside bends and colour-splits across it like light through
|
|
1187
|
+
a prism. `voronoiRegionField` is the compute hook (for `compute:`) that finds each pixel's
|
|
1188
|
+
shard and the next-nearest one; it only recomputes when the seed changes. The crack words run
|
|
1189
|
+
in the fragment: `crackGeom` measures the crack at a pixel, `crackRefractUV` bends one colour
|
|
1190
|
+
channel across it, and `crackShardCompose` joins the three channels with a little light on
|
|
1191
|
+
tilted shards.
|
|
1192
|
+
|
|
1193
|
+
- `voronoiRegionField(opts: {
|
|
1194
|
+
count: number
|
|
1195
|
+
size: number
|
|
1196
|
+
sites: (seed: number) => Float32Array
|
|
1197
|
+
seedProp: string
|
|
1198
|
+
seedDefault: number
|
|
1199
|
+
output: string
|
|
1200
|
+
}): GpuComputeNode` — Splits the canvas into shards around random sites and records, per pixel, its shard and the next-nearest one.
|
|
1201
|
+
- `crackGeom(uv: v2f, nPosX: number, nPosY: number, sPosX: number, sPosY: number, dispX: number, dispY: number, crackWidth: number): { crackIntensity: number; edgeNormal: v2f; displacedUV: v2f; disp: v2f; }` — How much crack there is at a pixel, and which way the shard under it has moved.
|
|
1202
|
+
- `crackRefractUV(displacedUV: v2f, edgeNormal: v2f, crackIntensity: number, refractionStrength: number, chromaticSplit: number, channel: number): v2f` — Where to sample one color channel so the crack bends the light and splits it like a prism.
|
|
1203
|
+
- `crackShardCompose(normalColor: v4f, rFinal: v4f, gFinal: v4f, bFinal: v4f, crackIntensity: number, disp: v2f, shardLighting: number): v4f` — The finished glass: the three refracted channels blended into the crack, with a hint of light on tilted shards.
|
|
1204
|
+
- `cellLaneUVFor(laneWidth: number): TgpuFn<(idx: F32, field: F32) => Vec2f>` — Where one shard's value sits in a one-row data texture.
|
|
1205
|
+
|
|
1206
|
+
### Edge glow (`import {effects} from 'shaders/std'`) — https://shaders.com/docs/primitives/effects.edgeGlow
|
|
1207
|
+
|
|
1208
|
+
A band of light hugging the edge of any shape, with coloured spots racing around it. The words
|
|
1209
|
+
live inside a `shapedSurface` surface function (from `materials`), which hands them the
|
|
1210
|
+
shape's **distance field**: for every pixel, how far it is from the shape's edge, negative
|
|
1211
|
+
inside. `edgeGlowBand` turns that distance into the glowing band (with drifting smoke) and
|
|
1212
|
+
also gives the angle around the shape. `orbitSpotsAccum` places one colour's spots along that
|
|
1213
|
+
angle. The spots of every colour are folded together, starting from `edgeGlowAccumZero` and
|
|
1214
|
+
adding one colour at a time with the step from `edgeGlowAccumColorFor`, and `edgeGlowCompose`
|
|
1215
|
+
turns the fold into the final colour with bloom. `heartbeatPulse` is the beat the band and the
|
|
1216
|
+
spots share.
|
|
1217
|
+
|
|
1218
|
+
- `edgeGlowBand(fieldRaw: number, sdfUV: v2f, viewport: v2f, scale: number, thickness: number, softness: number, smokeSize: number, smokeAmt: number, animTime: number, pulse: number, beat: number): v2f` — The glowing band around the shape's edge, with drifting smoke, plus the angle around the shape.
|
|
1219
|
+
- `orbitSpotsAccum(angle01: number, border: number, animTime: number, beat: number, spotsF: number, spotSize: number, pulse: number, intensity: number, softness: number, seed: number, colorIdxF: number): v2f` — The spots of one color orbiting the band, as coverage at this pixel.
|
|
1220
|
+
- `heartbeatPulse(animTime: number): number` — A double heartbeat, 0 to 1, driven by the layer's clock.
|
|
1221
|
+
- `edgeGlowAccumZero(): { rgb: v3f; w: number; ba: number; ac: v3f; aa: number; }` — The empty state to start folding colors into.
|
|
1222
|
+
- `edgeGlowAccumColorFor(mode: number): TgpuFn<(st: WgslStruct<{ rgb: Vec3f; w: F32; ba: F32; ac: Vec3f; aa: F32; }>, color: Vec4f, sectors: Vec2f) => WgslStruct<{ rgb: Vec3f; w: F32; ba: F32; ac: Vec3f; aa: F32; }>>` — The fold step for one color space: adds one color's spots to the running state.
|
|
1223
|
+
- `edgeGlowCompose(st: { rgb: v3f; w: number; ba: number; ac: v3f; aa: number; }, bloom: number): v4f` — The final color from the folded state, over a transparent background.
|
|
1224
|
+
- `colorAtIndex(colors: v4f[], idx: number): v4f` — One color from a `stops` prop, by index.
|
|
1225
|
+
|
|
1226
|
+
### Overlays (`import {effects} from 'shaders/std'`) — https://shaders.com/docs/primitives/effects.overlay
|
|
1227
|
+
|
|
1228
|
+
Heads-up-display overlays: whole fragments that look at the layer inside, find things in it
|
|
1229
|
+
and draw chrome on top. `detectionOverlay` cuts the canvas into cells, finds the bright,
|
|
1230
|
+
dark, colored or opaque content in each and draws a bounding box with an optional label
|
|
1231
|
+
around it, the computer-vision look. `motionTrackerHud` draws tracker gizmos that chase
|
|
1232
|
+
content over time, dropping keyframe diamonds behind them along their paths.
|
|
1233
|
+
|
|
1234
|
+
- `detectionOverlay(slots: DetectionOverlaySlots): (params: GpuFragmentParams) => ExprT` — Draw computer-vision style detection boxes over whatever the child contains.
|
|
1235
|
+
- `motionTrackerHud(slots: MotionTrackerHudSlots): (params: GpuFragmentParams) => ExprT` — Draw motion-tracker gizmos that chase content across the child, leaving keyframe trails.
|
|
1236
|
+
|
|
1237
|
+
### Pointer fields (`import {effects} from 'shaders/std'`) — https://shaders.com/docs/primitives/effects.pointerFields
|
|
1238
|
+
|
|
1239
|
+
Push fields the pointer stirs. Each word is a whole simulation: a grid of cells, each holding
|
|
1240
|
+
how far the layer inside should shift there, that the cursor pushes and that settles back on
|
|
1241
|
+
its own. Spread the word into a warp definition with `...sim.grids.gridSim(word)` and it
|
|
1242
|
+
publishes the field under its `output` name; the warp's `map:` then reads it with
|
|
1243
|
+
`warps.gridCellDisplace` (per cell, blocky) or `warps.liquidDisplace` (smoothly, scaled by an
|
|
1244
|
+
intensity prop). The definition needs `usesPointer: true`.
|
|
1245
|
+
|
|
1246
|
+
- `pointerSplatField(slots: {
|
|
1247
|
+
gridSize: PropRef
|
|
1248
|
+
decay: PropRef
|
|
1249
|
+
intensity: PropRef
|
|
1250
|
+
radius: PropRef
|
|
1251
|
+
output: string
|
|
1252
|
+
}): (params: GpuFragmentParams, root: GridRoot) => GridSimConfig` — A field the cursor smears: cells near the pointer move with it, then fade back to rest.
|
|
1253
|
+
- `springLatticeField(slots: {
|
|
1254
|
+
stiffness: PropRef
|
|
1255
|
+
damping: PropRef
|
|
1256
|
+
radius: PropRef
|
|
1257
|
+
output: string
|
|
1258
|
+
}): (params: GpuFragmentParams, root: GridRoot) => GridSimConfig` — A cloth of springs the cursor pushes: it stretches, rings and settles like fabric.
|
|
1259
|
+
- `clampSplatGridSize(v: number): number` — The grid size `pointerSplatField` really uses for a prop value: floored, then held to 8–128.
|
|
1260
|
+
- `SPLAT_MIN_GRID: 8` — The smallest grid `pointerSplatField` runs on: 8 cells per side.
|
|
1261
|
+
- `SPLAT_MAX_GRID: 128` — The largest grid `pointerSplatField` runs on: 128 cells per side.
|
|
1262
|
+
|
|
1263
|
+
## Simulation
|
|
1264
|
+
|
|
1265
|
+
### Simulate (`shaders/std` top level) — https://shaders.com/docs/primitives/simulate
|
|
1266
|
+
|
|
1267
|
+
Say "simulate this" and let the engine run it. `simulate.grid` declares a square grid of
|
|
1268
|
+
numbers that changes a little every frame: you list the steps that advance it (`op.wave`
|
|
1269
|
+
makes it ripple, `op.splat` presses the pointer into it) and name the outputs you want derived
|
|
1270
|
+
from it (`op.gradient`, the slope at every cell). The engine allocates the state, keeps the
|
|
1271
|
+
history a wave needs, tracks the pointer, clamps the frame clock, and stops dispatching once
|
|
1272
|
+
the field has faded to nothing. There is no GPU code in the definition at all.
|
|
1273
|
+
|
|
1274
|
+
- `simulate.grid(config: GridSimConfig): GridSim` — A square grid of numbers advanced once per frame by `step`, with named outputs in `derive`.
|
|
1275
|
+
- `op.wave(config: {damping: PropRef}): WaveOp` — A wave step: the grid ripples outward from any disturbance and fades by `damping` (a prop, 0–20).
|
|
1276
|
+
- `op.splat(config: {at: PointerSignal; amount: PointerSpeedSignal; radius: PropRef}): SplatOp` — A brush step: a soft round push into the grid at the pointer, scaled by how fast it moves.
|
|
1277
|
+
- `op.gradient(): GradientOp` — A derived output: the grid's slope at every cell as a 2D vector, ready for `displaceBy`.
|
|
1278
|
+
- `class GridSim` — A declared grid simulation.
|
|
1279
|
+
|
|
1280
|
+
### Grid programs (`import {sim} from 'shaders/std'`) — https://shaders.com/docs/primitives/sim.grids
|
|
1281
|
+
|
|
1282
|
+
A grid simulation is a fixed-size field of cells (a displacement per cell, two chemical
|
|
1283
|
+
concentrations, a sort offset) that changes a little every frame. `gridSim` runs it: you
|
|
1284
|
+
describe the frame as an ordered list of **stages** built with `op.*`, and the engine runs that
|
|
1285
|
+
list every frame, owning the clock, the frame-delta clamp, the ready gate, the settle gate and
|
|
1286
|
+
the outputs the layer samples. A stage is bookkeeping (`op.host`, `op.values`, `op.readyWhen`,
|
|
1287
|
+
`op.settle`) or work (`op.pass`, `op.cache`, `op.seedOnce`, `op.iterate`, `op.sortPass`), and
|
|
1288
|
+
every frame ends with `op.publish`, which writes the state into the texture the fragment reads.
|
|
1289
|
+
|
|
1290
|
+
- `gridSim(build: (params: GpuFragmentParams, root: GridRoot) => GridSimConfig | null): {compute: GpuComputeNode}` — A field of cells advanced every frame by an ordered list of stages.
|
|
1291
|
+
- `op.values(name: string, run: (f: GridFrame) => void): GridStage` — A named step that writes this frame's values for the passes after it.
|
|
1292
|
+
- `op.pass(step: ComputeStep): GridStage` — One GPU pass, the same every frame.
|
|
1293
|
+
- `op.publish(step: (f: GridFrame) => ComputeStep): GridStage` — The last stage: write the state into the texture the layer samples.
|
|
1294
|
+
- `op.iterate(opts: {count: (f: GridFrame) => number; step: (i: number, nodes: ComputeStep[], f: GridFrame) => void}): GridStage` — Run a step `count` times this frame.
|
|
1295
|
+
- `op.seedOnce(opts: {pass: ComputeStep; staleWhen: (f: GridFrame) => boolean; onSeed?: () => void}): GridStage` — A one-shot reset run before the rest of the frame whenever `staleWhen` says the state is stale: on the first frame, or when a seed prop changes.
|
|
1296
|
+
- `op.sortPass(opts: {passes: (f: GridFrame) => number; pass: (parity: 0 | 1, side: 'A' | 'B') => ComputeStep}): SortPassStage` — A compare-and-swap sort that converges a little more every frame: `passes` swaps per frame, alternating odd and even pairs and the two buffers.
|
|
1297
|
+
- `op.cache(step: (f: GridFrame) => ComputeStep): GridStage` — A GPU pass chosen per frame, for a pass whose input is rebound after the frame starts.
|
|
1298
|
+
- `op.readyWhen(fn: () => boolean): GridStage` — Run nothing until `fn` returns true, typically once the child's picture has arrived through `bindInputs`.
|
|
1299
|
+
- `op.settle(opts: {activeWhen: (f: GridFrame) => boolean; settleMs: (f: GridFrame) => number}): GridStage` — Sleep the simulation once nothing has driven it for `settleMs` of simulated time.
|
|
1300
|
+
- `op.host(name: string, run: (f: GridFrame) => void): GridStage` — A named step that runs before any gate: pointer smoothing, activity flags, anything a later `settle` needs to know.
|
|
1301
|
+
- `trackedViewport(params: GpuFragmentParams): {
|
|
1302
|
+
tracked(): {width: number; height: number}
|
|
1303
|
+
safe(fp: GridFrameParams): {width: number; height: number}
|
|
1304
|
+
}` — The canvas size in pixels, kept current across resizes, in the two forms a stage wants.
|
|
1305
|
+
- `hostGridProgram(opts: {clampDt: number; steps: HostStep[]}): (fp: unknown) => void` — A frame program for a small grid stepped in plain JavaScript: the steps run in order every frame until one returns `'skip'`.
|
|
1306
|
+
- `hostStep(name: string, run: (f: HostFrame) => void | 'skip'): HostStep` — One named step of a JavaScript-stepped grid.
|
|
1307
|
+
- `hostFieldTexture(params: GpuFragmentParams, opts: {size: number; label: string}): {texData: Uint16Array; texture: ReturnType<GpuFragmentParams['registerMediaTexture']>; upload(): void}` — The texture a JavaScript-stepped grid is read through.
|
|
1308
|
+
|
|
1309
|
+
### Fluids (`import {sim} from 'shaders/std'`) — https://shaders.com/docs/primitives/sim.fluids
|
|
1310
|
+
|
|
1311
|
+
Smoke, ink and fog that flow. A fluid is a square grid of velocity plus a **dye** (a density
|
|
1312
|
+
and an age, or a color) that the engine advances with a full fluid solve every frame:
|
|
1313
|
+
swirl, pressure, advection. `fluidSim` owns the state buffers, the output texture, the solve
|
|
1314
|
+
chain, the pointer tracker, the clock and the idle gate that sleeps a settled field. You bring
|
|
1315
|
+
the parts that make the look and declare them by role.
|
|
1316
|
+
|
|
1317
|
+
- `fluidSim<TParams>(build: (params: GpuFragmentParams, root: FluidRoot) => FluidSimConfig<TParams>): {compute: GpuComputeNode}` — A fluid the engine solves every frame.
|
|
1318
|
+
- `splat<TParams = unknown>(opts: {kernel: FluidKernel} | {setup: (ctx: FluidSetupCtx) => KitComputePipeline}): FluidEmitter<TParams>` — An emitter at a fixed source: one pass per frame that adds dye and momentum where your pass function says (a cone from a point, a line along an edge).
|
|
1319
|
+
- `cursorRibbon<TParams = unknown, TPrepared = undefined>(opts: {
|
|
1320
|
+
/** Pointer tracking: smoothing, the teleport distance, the minimum drag. */
|
|
1321
|
+
tracker?: PointerVelocityTrackerOptions
|
|
1322
|
+
/** Whether the stroke emits this frame. A live frame keeps the simulation awake. */
|
|
1323
|
+
activeWhen: (ptr: PointerFrame, f: FluidFrame) => boolean
|
|
1324
|
+
/** Seconds after the last activity before the simulation may sleep. */
|
|
1325
|
+
fadeSeconds: (f: FluidFrame) => number
|
|
1326
|
+
/** Extra bookkeeping per frame before the idle gate. */
|
|
1327
|
+
// InkFlow's color-cycle time drift.
|
|
1328
|
+
onFrame?: (f: FluidFrame, ptr: PointerFrame) => void
|
|
1329
|
+
/** The stamp pass: a pass function, or a `setup` that builds one on resources of its own. */
|
|
1330
|
+
pass: {kernel: FluidKernel} | {setup: (ctx: FluidSetupCtx) => KitComputePipeline}
|
|
1331
|
+
/** This frame's stamps. */
|
|
1332
|
+
ribbon: (f: FluidFrame, ptr: PointerFrame, values: TParams) => CursorRibbonSpec<TPrepared>
|
|
1333
|
+
}): FluidEmitter<TParams> & {ptr(): PointerFrame | null; active(): boolean}` — An emitter that paints along the pointer's stroke: a ribbon of stamps between last frame's position and this one, so a fast flick leaves a continuous line, not dots.
|
|
1334
|
+
- `seededFieldInit<TParams>(opts: {
|
|
1335
|
+
kernel: FluidKernel
|
|
1336
|
+
/** The value whose change forces a re-seed. */
|
|
1337
|
+
seed: (f: FluidFrame) => number
|
|
1338
|
+
warm: {
|
|
1339
|
+
/** How many silent solves to run. */
|
|
1340
|
+
steps: number
|
|
1341
|
+
jacobiIters: number
|
|
1342
|
+
/** Simulated seconds per warm step. */
|
|
1343
|
+
dt: number
|
|
1344
|
+
/** Where the warm clock starts. Randomize it so two instances differ. */
|
|
1345
|
+
startTime: () => number
|
|
1346
|
+
/** The full values for a warm step at simulated time `t`. `t = 0` is the seed write. */
|
|
1347
|
+
values: (t: number, f: FluidFrame) => TParams
|
|
1348
|
+
}
|
|
1349
|
+
}): FluidInitPart<TParams>` — A field that starts full: seed it from a pass function, then run the solve silently `warm.steps` times so the first visible frame already flows.
|
|
1350
|
+
- `ambientForce(kernel: FluidKernel): FluidSolveStage` — A force applied to the whole field before every solve: a turbulence field, a steady wind.
|
|
1351
|
+
- `restoreToward(kernel: FluidKernel): FluidSolveStage` — A correction applied after every solve: re-seed a color that the solve slowly blurs away.
|
|
1352
|
+
|
|
1353
|
+
### Feedback (`import {sim} from 'shaders/std'`) — https://shaders.com/docs/primitives/sim.feedback
|
|
1354
|
+
|
|
1355
|
+
Effects that remember the last frame. A feedback simulation keeps a picture of its own
|
|
1356
|
+
previous output and advances it by one step of your rule every frame: read last frame's state,
|
|
1357
|
+
apply the rule, write the new state. Temporal echoes, codec smears and decaying trails all live
|
|
1358
|
+
here. `feedbackSim` keeps the two state textures and swaps them, keeps a display copy the layer
|
|
1359
|
+
samples, binds the child's picture once it exists, and runs a clock you can scale with a speed
|
|
1360
|
+
prop.
|
|
1361
|
+
|
|
1362
|
+
- `feedbackSim<TParams, TGroups = unknown>(build: (params: GpuFragmentParams, root: FeedbackRoot) => FeedbackSimConfig<TParams, TGroups>): {compute: GpuComputeNode}` — A simulation that advances a picture of its own last frame by one step of your rule, every frame.
|
|
1363
|
+
|
|
1364
|
+
### Agents (`import {sim} from 'shaders/std'`) — https://shaders.com/docs/primitives/sim.agents
|
|
1365
|
+
|
|
1366
|
+
Thousands of small things that move: flocks, motes, filings, swarms, particles standing on an
|
|
1367
|
+
image. An agent simulation keeps a state per agent, moves every agent one step per frame, draws
|
|
1368
|
+
each one into a shared canvas, and hands the result to the layer. `agentSim` owns the plumbing:
|
|
1369
|
+
the state buffers, the output texture, the spawn on the first frame and again on a seed change,
|
|
1370
|
+
the lower count on phones, the child's picture when one is needed, and the fragment that
|
|
1371
|
+
samples the picture over the full canvas.
|
|
1372
|
+
|
|
1373
|
+
- `agentSim<TParams extends AnyWgslStruct>(cfg: AgentSimConfig<TParams>): AgentSimSpread` — A simulation of many agents, spread into a definition: `bake` assembles the steps from your declared parts, `frame` writes the per-frame values, and the fragment samples the picture.
|
|
1374
|
+
- `renderAgents.orientedWorld(layout: WorldSplatLayout & RampResolveLayout, cfg: Omit<OrientedWorldSplatConfig, 'name'> & {
|
|
1375
|
+
ramp: Omit<RampResolveConfig, 'name' | 'res' | 'invGain'> & {invGain?: number}
|
|
1376
|
+
names: {splat: string; resolve: string}
|
|
1377
|
+
/** Give the splat the second resource group as well (a shape family's own resources). */
|
|
1378
|
+
extraOnSplat?: boolean
|
|
1379
|
+
}): RenderAgentsPipelines` — Agents with a heading, drawn as a shape pointing the way they move (or the way they are turned), colored from a rest color to an excited color.
|
|
1380
|
+
- `renderAgents.pointWorld(layout: PointWorldSplatLayout & Parameters<typeof resolve.tint>[0], cfg: Omit<PointWorldSplatConfig, 'name'> & {names: {splat: string; resolve: string}}): RenderAgentsPipelines` — Round motes with no heading, drawn in one tint with a live softness.
|
|
1381
|
+
- `renderAgents.volume(layout: Parameters<typeof splat.volume>[0] & RampResolveLayout, cfg: Omit<VolumeSplatConfig, 'names'> & {
|
|
1382
|
+
ramp: Omit<RampResolveConfig, 'name' | 'res' | 'invGain'>
|
|
1383
|
+
names: VolumeSplatConfig['names'] & {resolve: string}
|
|
1384
|
+
extraOnSplat?: boolean
|
|
1385
|
+
}): RenderAgentsPipelines` — A 3D swarm seen in perspective: nearer particles draw larger and brighter, and the color runs from rest to excited with speed.
|
|
1386
|
+
- `renderAgents.relief(layout: Parameters<typeof splat.relief>[0], cfg: Omit<ReliefSplatConfig, 'name'> & {
|
|
1387
|
+
out: [number, number]
|
|
1388
|
+
weightedColor: {alphaK: number}
|
|
1389
|
+
names: {splat: string; resolve: string}
|
|
1390
|
+
}): RenderAgentsPipelines` — Particles standing on an image, seen through a camera: each carries the child's color at its home, and nearer particles win the color where they overlap.
|
|
1391
|
+
|
|
1392
|
+
### Agent forces (`import {sim} from 'shaders/std'`) — https://shaders.com/docs/primitives/sim.agentForces
|
|
1393
|
+
|
|
1394
|
+
What pushes, turns and carries each agent. The physics of an agent simulation is a list of
|
|
1395
|
+
parts folded into one update step by an **integrator**. A `force` returns a push for one
|
|
1396
|
+
agent; a `torque` returns a turn; a `field` samples something at the agent's position (the
|
|
1397
|
+
magnet at the cursor, a home on a grid); a `drift` is a built-in velocity. Every part is built
|
|
1398
|
+
over your layout, which names the per-agent buffers and the per-frame values it reads, so the
|
|
1399
|
+
same part works in any layer that provides those names.
|
|
1400
|
+
|
|
1401
|
+
- `integrator.steering2d(layout: SteeringLayout, cfg: {
|
|
1402
|
+
forces: AgentSteer2[]
|
|
1403
|
+
/** Excitement: effort above `rest` (in max-force units) charges by `gain`, and cools at `cool` per second. */
|
|
1404
|
+
agitation: {rest: number; gain: number; cool: number}
|
|
1405
|
+
/** Slowest cruise, as a fraction of each agent's top speed. */
|
|
1406
|
+
cruiseFloor: number
|
|
1407
|
+
/** Speed kept when an agent bounces off an edge (0–1). */
|
|
1408
|
+
wallRestitution: number
|
|
1409
|
+
name: string
|
|
1410
|
+
}): (i: number) => void` — A flock under summed steering, kept cruising, arcing off the canvas edges.
|
|
1411
|
+
- `integrator.forces3d(layout: VolumeSwarmLayout, cfg: {
|
|
1412
|
+
forces: AgentForce3[]
|
|
1413
|
+
maxSpeed: number
|
|
1414
|
+
posClamp: number
|
|
1415
|
+
name: string
|
|
1416
|
+
}): (i: number) => void` — A 3D swarm under summed forces, with drag, a speed limit and a position clamp.
|
|
1417
|
+
- `integrator.orientation2d(layout: OrientationLayout, cfg: {
|
|
1418
|
+
home: AgentHome2
|
|
1419
|
+
fieldAt: AgentFieldAt
|
|
1420
|
+
torques: AgentTorque[]
|
|
1421
|
+
maxOffset: number
|
|
1422
|
+
name: string
|
|
1423
|
+
}): (i: number) => void` — Agents that turn in place under summed torques and drift a little toward the field.
|
|
1424
|
+
- `integrator.drift2d(layout: DriftLayout, cfg: {
|
|
1425
|
+
drift: AgentDrift
|
|
1426
|
+
gust: (pos: d.v2f) => d.v2f
|
|
1427
|
+
name: string
|
|
1428
|
+
}): (i: number) => void` — Motes that glide on a built-in drift plus a fading gust, wrapping around the canvas.
|
|
1429
|
+
- `integrator.relief(layout: ReliefLayout, cfg: {
|
|
1430
|
+
channel: AgentChannel
|
|
1431
|
+
cursor: (homeW: d.v2f, off: d.v2f, z: number) => d.v3f
|
|
1432
|
+
stiffness: number
|
|
1433
|
+
maxSpeed: number
|
|
1434
|
+
/** Child alpha below which a particle is never latched. Match the render's `minAlpha`. */
|
|
1435
|
+
// Matches the splat's early-out.
|
|
1436
|
+
minAlpha: number
|
|
1437
|
+
name: string
|
|
1438
|
+
}): (x: number, y: number) => void` — Particles standing on the child's image, rising by a color channel, springing home.
|
|
1439
|
+
- `integrator.advect2d(layout: AdvectLayout, cfg: {
|
|
1440
|
+
gridN: number
|
|
1441
|
+
inertiaRate: number
|
|
1442
|
+
homeRate: number
|
|
1443
|
+
name: string
|
|
1444
|
+
}): (i: number) => void` — Particles carried by a fluid's velocity texture, easing back to an even spread.
|
|
1445
|
+
- `force.flocking(layout: SteeringLayout, cfg: {maxAgents: number}): AgentSteer2` — Separation, alignment and cohesion for a flock, with live weights and radii.
|
|
1446
|
+
- `force.cursorSteer(layout: SteeringLayout): AgentSteer2` — The cursor on a flock: attract, scatter like a predator, or nothing.
|
|
1447
|
+
- `force.wallTurn(layout: SteeringLayout): AgentSteer2` — A soft turn back toward the canvas near an edge, so a flock arcs instead of bouncing.
|
|
1448
|
+
- `force.pressure(layout: VolumeSwarmLayout, cfg: {
|
|
1449
|
+
gridDim: number
|
|
1450
|
+
/** The grid covers shape-local [−domain, domain]³. */
|
|
1451
|
+
domain: number
|
|
1452
|
+
names: {clear: string; splat: string}
|
|
1453
|
+
}): PressureForce` — Spread a 3D swarm evenly by pushing agents away from crowded cells of a density grid.
|
|
1454
|
+
- `force.containment(layout: VolumeSwarmLayout, cfg: {
|
|
1455
|
+
field: ShapeField3
|
|
1456
|
+
/** How far apart the two samples of the field's slope are taken. 0.02 is typical. */
|
|
1457
|
+
// Central-difference epsilon for the field gradient.
|
|
1458
|
+
gradEps: number
|
|
1459
|
+
/** The spring at the surface: fades in from `featherFrom` to `featherTo` (signed distance), `base` push plus `springK` per unit outside. */
|
|
1460
|
+
// Strong outside, diffuse inside (a sharp feather packs a coherent shell).
|
|
1461
|
+
wall: {featherFrom: number; featherTo: number; base: number; springK: number}
|
|
1462
|
+
/** The pull home once an agent is `from`..`to` from the origin, with strength `k`. */
|
|
1463
|
+
// A hard clamp piles strays into lines.
|
|
1464
|
+
recall: {from: number; to: number; k: number}
|
|
1465
|
+
/** The pull toward the middle where the signed distance is `from`..`to`, with strength `k`. */
|
|
1466
|
+
// SDF-VALUE-driven pull toward the origin — direction-safe where the gradient degenerates.
|
|
1467
|
+
homing: {from: number; to: number; k: number}
|
|
1468
|
+
/** How wide a band around the surface the rotation drag fades over. */
|
|
1469
|
+
// Drag toward the rotating container's feature velocity ω×r, feathered to inside.
|
|
1470
|
+
entrainment: {featherHalf: number}
|
|
1471
|
+
}): AgentForce3` — Keep a 3D swarm inside a shape: a spring at the surface, a pull back from far away, and a drag when the shape rotates.
|
|
1472
|
+
- `force.cursorXY(layout: VolumeSwarmLayout): AgentForce3` — The cursor as a magnet on a 3D swarm, pushing away (or pulling in when the force is negative).
|
|
1473
|
+
- `force.gravity(layout: VolumeSwarmLayout): AgentForce3` — A constant pull on a 3D swarm in the direction of `params.gravX, gravY`.
|
|
1474
|
+
- `force.turbulence(layout: VolumeSwarmLayout, cfg: {posScale: number; timeX: number; timeY: number; seedScale: number; gain: number}): AgentForce3` — A per-agent jitter that keeps a 3D swarm alive, scaled by `params.agitation`.
|
|
1475
|
+
- `force.cursorGust(layout: DriftLayout): (pos: d.v2f) => d.v2f` — A puff from the cursor on drifting motes, zero while the force slider sits at 0.
|
|
1476
|
+
- `force.cursorInView(layout: ReliefLayout, cfg: {perspK: number}): (homeW: d.v2f, off: d.v2f, z: number) => d.v3f` — The cursor on an image relief, applied where each particle appears on screen.
|
|
1477
|
+
- `torque.alignToField(layout: OrientationLayout): AgentTorque` — Swing onto the field's line like a compass needle.
|
|
1478
|
+
- `torque.rest: (layout: OrientationLayout) => AgentTorque` — A weak swing back to each agent's rest angle, felt only where the field is faint.
|
|
1479
|
+
- `field.dipoleOrRadial(layout: OrientationLayout): AgentFieldAt` — The field of a magnet at the cursor: a bar magnet along its travel, or a single pole.
|
|
1480
|
+
- `field.jitteredGridHome(layout: OrientationLayout, cfg: {overscan: number}): AgentHome2` — Each agent's resting position on a jittered grid that runs past the canvas edges.
|
|
1481
|
+
- `drift.variedHeading(layout: {readonly $: {readonly params: HeadingDriftParamsView}}): AgentDrift` — One shared heading and speed, each varied a little per mote.
|
|
1482
|
+
- `FieldSample(props: { rhat: v2f; strength: number; phi: number; }): { rhat: v2f; strength: number; phi: number; }` — What a field sample carries: the direction away from the source (`rhat`), the `strength`, and the line angle `phi` in radians.
|
|
1483
|
+
- `channel.alpha: AgentChannel` — The pixel's alpha.
|
|
1484
|
+
- `channel.blue: AgentChannel` — The blue channel.
|
|
1485
|
+
- `channel.byMode: Record<number, AgentChannel>` — The same seven by a select prop's number: 0 luminance, 1 inverted, 2 red, 3 green, 4 blue, 5 saturation, 6 alpha.
|
|
1486
|
+
- `channel.green: AgentChannel` — The green channel.
|
|
1487
|
+
- `channel.luminance: AgentChannel` — The color's brightness, 0 black to 1 white.
|
|
1488
|
+
- `channel.luminanceInverted: AgentChannel` — One minus the brightness, so dark areas rise.
|
|
1489
|
+
- `channel.red: AgentChannel` — The red channel.
|
|
1490
|
+
- `channel.saturation: AgentChannel` — How colorful the pixel is, 0 grey to 1 pure.
|
|
1491
|
+
|
|
1492
|
+
### Agent frame (`import {sim} from 'shaders/std'`) — https://shaders.com/docs/primitives/sim.agentFrame
|
|
1493
|
+
|
|
1494
|
+
The once-per-frame arithmetic an agent simulation writes into its values. Inside `agentSim`'s
|
|
1495
|
+
`frame` callback you turn props and the pointer into the numbers the GPU steps read. These are
|
|
1496
|
+
the recipes that come up in every agent layer, as plain functions with no GPU in them: a drag
|
|
1497
|
+
factor that does not depend on frame rate (`expDecay`), the pointer in the shape's own
|
|
1498
|
+
coordinates (`pointerToShapeLocal`), a grid that fits the agent count (`fitJitteredGrid`,
|
|
1499
|
+
`fitIsoGrid`), a direction that follows the cursor's travel (`createMotionAxis`), camera rows
|
|
1500
|
+
for a 3D view (`cameraRowsYDown`), and the rotation bookkeeping a spinning shape needs to
|
|
1501
|
+
carry its swarm along (`omegaFromRotationDeltas`, `entrainmentFromOmega`, `r3SubCellOffset`).
|
|
1502
|
+
|
|
1503
|
+
- `expDecay(rate: number, dt: number): number` — The per-frame multiplier that decays a value at `rate` per second, whatever the frame rate.
|
|
1504
|
+
- `pointerToShapeLocal(opts: {
|
|
1505
|
+
pointerX: number
|
|
1506
|
+
pointerY: number
|
|
1507
|
+
centerX: number
|
|
1508
|
+
centerYv: number
|
|
1509
|
+
scale: number
|
|
1510
|
+
rotC: number
|
|
1511
|
+
rotS: number
|
|
1512
|
+
aspect: number
|
|
1513
|
+
}): {x: number; y: number}` — The pointer in the shape's own coordinates: undo the layer's center, scale and rotation so a cursor force can act in the same space the swarm lives in (y up, isotropic).
|
|
1514
|
+
- `createMotionAxis(opts?: {smoothing?: number; teleport?: number}): { update(x: number, y: number): { x: number; y: number; }; }` — A unit direction that follows where the pointer has been travelling, smoothed frame to frame.
|
|
1515
|
+
- `fitJitteredGrid(count: number, domainX: number, overscan: number): { cols: number; cellW: number; cellH: number; }` — A grid of about `count` roughly square cells over the canvas plus an `overscan` border on every side, for agents that rest on a jittered grid.
|
|
1516
|
+
- `fitIsoGrid(count: number, aspect: number, min: number, max: number): { w: number; h: number; }` — A W×H grid of square cells holding about `count` agents at the canvas `aspect`, each side clamped to `[min, max]`.
|
|
1517
|
+
- `cameraRowsYDown(rx: number, ry: number, rz: number): {
|
|
1518
|
+
rowX: [number, number, number]
|
|
1519
|
+
rowY: [number, number, number]
|
|
1520
|
+
rowZ: [number, number, number]
|
|
1521
|
+
}` — The three rows of a camera rotation for a 3D view drawn on a y-down canvas.
|
|
1522
|
+
- `omegaFromRotationDeltas(prev: {x: number; y: number; z: number} | null, next: {x: number; y: number; z: number}, dt: number): {x: number; y: number; z: number} | null` — How fast a rotating shape's surface moves, from its rotation this frame and last frame, so a swarm inside it can be dragged along.
|
|
1523
|
+
- `entrainmentFromOmega(om: {x: number; y: number; z: number}, opts: {cap: number; gainRate: number; gainMax: number}): { omegaX: number; omegaY: number; omegaZ: number; entrain: number; }` — The values `force.containment` reads for a rotating shape: the rotation rate capped at `cap`, and an `entrain` gain that grows with the rate up to `gainMax`.
|
|
1524
|
+
- `r3SubCellOffset(frameIdx: number, cell: number): {x: number; y: number; z: number}` — A tiny offset for frame `frameIdx`, within one grid `cell`, that `force.pressure` reads to keep its density grid from lining up with the shape.
|
|
1525
|
+
|
|
1526
|
+
### Agent rendering (`import {sim} from 'shaders/std'`) — https://shaders.com/docs/primitives/sim.agentRender
|
|
1527
|
+
|
|
1528
|
+
How agents become a picture. Every agent frame ends the same way: each agent stamps its shape
|
|
1529
|
+
into a shared canvas (the **splat**), then one pass turns the canvas into the output picture
|
|
1530
|
+
and clears it for the next frame (the **resolve**). `renderAgents` in `sim.agents` pairs a
|
|
1531
|
+
splat with its resolve for you; reach into this module when you need another pairing, or for
|
|
1532
|
+
the `pointSlot` parts that give round motes their placement, brightness and size.
|
|
1533
|
+
|
|
1534
|
+
- `pointSlot.orbitalPlace(layout: {readonly $: {readonly params: {readonly time: number; readonly randomness: number}}}, cfg: {radius: number; rate: number}): PointWorldSplatConfig['place']` — The mote's drawn position: its stored position plus a slow circle of `radius` (canvas heights) at `rate` turns per second, both scaled by `params.randomness` and varied per mote.
|
|
1535
|
+
- `pointSlot.twinkleBrightness(layout: {readonly $: {readonly params: {readonly time: number; readonly twinkle: number}}}, cfg: {freq: number}): PointWorldSplatConfig['brightness']` — The mote's brightness: a twinkle at `freq` cycles per second, blended in by `params.twinkle` (0 steady, 1 full shimmer), times a per-mote presence so some motes read nearer than others.
|
|
1536
|
+
- `pointSlot.presenceRadius(layout: {readonly $: {readonly params: {readonly bodyR: number}}}): PointWorldSplatConfig['bodyRadius']` — The mote's size: `params.bodyR` scaled by the same per-mote presence as the brightness, so the motes that read nearer are bigger and brighter together.
|
|
1537
|
+
- `splat.orientedWorld: (layout: WorldSplatLayout, cfg: OrientedWorldSplatConfig) => (i: number) => void` — Agents with a heading: arrows, streaks, squares, dots or comets drawn along the way they point.
|
|
1538
|
+
- `splat.pointWorld: (layout: PointWorldSplatLayout, cfg: PointWorldSplatConfig) => (i: number) => void` — Round motes with a live softness, placed, brightened and sized by `pointSlot` parts.
|
|
1539
|
+
- `splat.volume: (layout: VolumeRenderLayout, cfg: VolumeSplatConfig) => (i: number) => void` — A 3D swarm in perspective, recording speed for the ramp resolve.
|
|
1540
|
+
- `splat.relief: (layout: ReliefRenderLayout, cfg: ReliefSplatConfig) => (x: number, y: number) => void` — Particles standing on an image, drawn in the child's color through a camera.
|
|
1541
|
+
- `resolve.ramp: (layout: RampResolveLayout, cfg: RampResolveConfig) => (x: number, y: number) => void` — Rest-to-excited color from two colors, with optional motion trails.
|
|
1542
|
+
- `resolve.tint: (layout: { readonly $: { readonly accumE: atomicU32[]; readonly outTex: StorageTex; readonly params: { readonly color: v4f; }; }; }, cfg: { res: number; name: string; }) => (x: number, y: number) => void` — One color, with an alpha from coverage.
|
|
1543
|
+
- `resolve.weightedColor: (layout: ReliefRenderLayout, cfg: { fp: number; alphaK: number; name: string; }) => (x: number, y: number) => void` — The average of the colors that landed, nearer particles first.
|
|
1544
|
+
|
|
1545
|
+
### Shape fields (`import {sim} from 'shaders/std'`) — https://shaders.com/docs/primitives/sim.shapeFields
|
|
1546
|
+
|
|
1547
|
+
The shape a swarm is held inside. `force.containment` needs one thing from a shape: the signed
|
|
1548
|
+
distance to its surface at any 3D point, negative inside and positive outside. `shapeField`
|
|
1549
|
+
builds that distance function from whatever shape the layer was given, so one integrator serves
|
|
1550
|
+
every shape kind: `analyticExtruded` gives a flat shape (circle, polygon, star) a depth;
|
|
1551
|
+
`svgExtruded` does the same for an SVG outline uploaded as a distance texture; `analytic3d`
|
|
1552
|
+
wraps a true 3D solid; `svgLifted3d` wraps an SVG lifted into 3D. The last two rotate with the
|
|
1553
|
+
shape's live rotation, so the swarm follows the surface as it turns.
|
|
1554
|
+
|
|
1555
|
+
- `shapeField.analyticExtruded(layout: {readonly $: {readonly params: ExtrudedAnalyticParamsView}}, sdf2d: AnalyticSdf2d): ShapeField3` — A flat shape given depth: the 2D distance of a circle, polygon or star, extruded in z by `params.halfDepth`.
|
|
1556
|
+
- `shapeField.svgExtruded(layout: {readonly $: {readonly params: {readonly halfDepth: number}}}, svgLayout: {readonly $: {readonly sdfSource: d.Infer<d.WgslTexture2d<d.F32>>}}, cfg: {size: number}): ShapeField3` — An SVG outline given depth: the outline's distance texture, extruded in z by `params.halfDepth`.
|
|
1557
|
+
- `shapeField.analytic3d(layout: RotatedFieldLayout, baked: ShapeField3): ShapeField3` — A true 3D solid (sphere, torus, knot…) from its baked distance function, rotated by the shape's live rotation so the swarm follows the surface as it turns.
|
|
1558
|
+
- `shapeField.svgLifted3d(layout: RotatedFieldLayout, baked: ShapeField3): ShapeField3` — An SVG outline lifted into a 3D solid, rotated by the shape's live rotation.
|