shaders 2.5.128 → 2.5.130
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/dist/core/{Blur-5_t3tR_g.js → Blur-1GcG1L1y.js} +1 -1
- package/dist/core/{ChannelBlur-DWgS3nhn.js → ChannelBlur-CxlVaYGM.js} +1 -1
- package/dist/core/Exposure-CFn2J_t3.js +29 -0
- package/dist/core/{Glass-CXT1jdLw.js → Glass-D8DayF1P.js} +1 -1
- package/dist/core/{Glow-5PP4-rM9.js → Glow-chsUpCyj.js} +25 -8
- package/dist/core/{ProgressiveBlur-BJwJ5mE0.js → ProgressiveBlur-By_PgPtK.js} +1 -1
- package/dist/core/{ReflectivePlane-UIT4xlmn.js → ReflectivePlane-VjZ1E5B0.js} +1 -1
- package/dist/core/ThinFilm-CUsi8eSg.js +305 -0
- package/dist/core/{TiltShift-DtQ3dRL-.js → TiltShift-vG90NlLr.js} +1 -1
- package/dist/core/{VideoTexture-ClutlOqj.js → VideoTexture-FmV1l91c.js} +1 -1
- package/dist/core/{WebcamTexture-D4e06ajM.js → WebcamTexture-DlS4MCDm.js} +1 -1
- package/dist/core/blendModes/linearDodge.d.ts.map +1 -1
- package/dist/core/{computeBlur-CprKe0xa.js → computeBlur-oxyhoztH.js} +14 -7
- package/dist/core/effects/thinFilm.d.ts +81 -0
- package/dist/core/effects/thinFilm.d.ts.map +1 -0
- package/dist/core/index.js +90 -88
- package/dist/core/registry.js +89 -87
- package/dist/core/shaderRegistry-BVFBmRN3.js +276 -0
- package/dist/core/shaderRegistry.d.ts.map +1 -1
- package/dist/core/shaders/Blur/index.js +2 -2
- package/dist/core/shaders/ChannelBlur/index.js +2 -2
- package/dist/core/shaders/Exposure/index.d.ts +13 -0
- package/dist/core/shaders/Exposure/index.d.ts.map +1 -0
- package/dist/core/shaders/Exposure/index.js +2 -0
- package/dist/core/shaders/FallingLines/index.js +1 -1
- package/dist/core/shaders/FilmGrain/index.js +1 -1
- package/dist/core/shaders/FloatingParticles/index.js +1 -1
- package/dist/core/shaders/FlowField/index.js +1 -1
- package/dist/core/shaders/Flower/index.js +1 -1
- package/dist/core/shaders/FlowingGradient/index.js +1 -1
- package/dist/core/shaders/FlutedGlass/index.js +1 -1
- package/dist/core/shaders/Fog/index.js +1 -1
- package/dist/core/shaders/Form3D/index.js +1 -1
- package/dist/core/shaders/FractalNoise/index.js +1 -1
- package/dist/core/shaders/Glass/index.js +2 -2
- package/dist/core/shaders/GlassTiles/index.js +1 -1
- package/dist/core/shaders/Glitch/index.js +1 -1
- package/dist/core/shaders/Glow/index.d.ts.map +1 -1
- package/dist/core/shaders/Glow/index.js +2 -2
- package/dist/core/shaders/Godrays/index.js +1 -1
- package/dist/core/shaders/Grayscale/index.js +1 -1
- package/dist/core/shaders/Grid/index.js +1 -1
- package/dist/core/shaders/GridDistortion/index.js +1 -1
- package/dist/core/shaders/Group/index.js +1 -1
- package/dist/core/shaders/Halftone/index.js +1 -1
- package/dist/core/shaders/HexGrid/index.js +1 -1
- package/dist/core/shaders/HueShift/index.js +1 -1
- package/dist/core/shaders/ImageTexture/index.js +1 -1
- package/dist/core/shaders/Invert/index.js +1 -1
- package/dist/core/shaders/Kaleidoscope/index.js +1 -1
- package/dist/core/shaders/LensFlare/index.js +1 -1
- package/dist/core/shaders/LinearBlur/index.js +1 -1
- package/dist/core/shaders/LinearGradient/index.js +1 -1
- package/dist/core/shaders/Liquify/index.js +1 -1
- package/dist/core/shaders/Marble/index.js +1 -1
- package/dist/core/shaders/Mirror/index.js +1 -1
- package/dist/core/shaders/MultiPointGradient/index.js +1 -1
- package/dist/core/shaders/Neon/index.js +1 -1
- package/dist/core/shaders/Paper/index.js +1 -1
- package/dist/core/shaders/Perspective/index.js +1 -1
- package/dist/core/shaders/Pixelate/index.js +1 -1
- package/dist/core/shaders/Plasma/index.js +1 -1
- package/dist/core/shaders/PolarCoordinates/index.js +1 -1
- package/dist/core/shaders/Polygon/index.js +1 -1
- package/dist/core/shaders/Posterize/index.js +1 -1
- package/dist/core/shaders/ProgressiveBlur/index.js +2 -2
- package/dist/core/shaders/RadialGradient/index.js +1 -1
- package/dist/core/shaders/RectangularCoordinates/index.js +1 -1
- package/dist/core/shaders/ReflectivePlane/index.js +2 -2
- package/dist/core/shaders/Ring/index.js +1 -1
- package/dist/core/shaders/Ripples/index.js +1 -1
- package/dist/core/shaders/RoundedRect/index.js +1 -1
- package/dist/core/shaders/Saturation/index.js +1 -1
- package/dist/core/shaders/Sharpness/index.js +1 -1
- package/dist/core/shaders/Shatter/index.js +1 -1
- package/dist/core/shaders/SimplexNoise/index.js +1 -1
- package/dist/core/shaders/SineWave/index.js +1 -1
- package/dist/core/shaders/Smoke/index.js +1 -1
- package/dist/core/shaders/SmokeFill/index.js +1 -1
- package/dist/core/shaders/Solarize/index.js +1 -1
- package/dist/core/shaders/SolidColor/index.js +1 -1
- package/dist/core/shaders/Spherize/index.js +1 -1
- package/dist/core/shaders/Spiral/index.js +1 -1
- package/dist/core/shaders/Star/index.js +1 -1
- package/dist/core/shaders/Strands/index.js +1 -1
- package/dist/core/shaders/Stretch/index.js +1 -1
- package/dist/core/shaders/Stripes/index.js +1 -1
- package/dist/core/shaders/StudioBackground/index.js +1 -1
- package/dist/core/shaders/SunBurst/index.js +1 -1
- package/dist/core/shaders/Swirl/index.js +1 -1
- package/dist/core/shaders/ThinFilm/index.d.ts +130 -0
- package/dist/core/shaders/ThinFilm/index.d.ts.map +1 -0
- package/dist/core/shaders/ThinFilm/index.js +6 -0
- package/dist/core/shaders/TiltShift/index.js +2 -2
- package/dist/core/shaders/Tint/index.js +1 -1
- package/dist/core/shaders/Trapezoid/index.js +1 -1
- package/dist/core/shaders/Tritone/index.js +1 -1
- package/dist/core/shaders/Truchet/index.js +1 -1
- package/dist/core/shaders/Twirl/index.js +1 -1
- package/dist/core/shaders/VHS/index.js +1 -1
- package/dist/core/shaders/Vesica/index.js +1 -1
- package/dist/core/shaders/Vibrance/index.js +1 -1
- package/dist/core/shaders/VideoTexture/index.js +2 -2
- package/dist/core/shaders/Vignette/index.js +1 -1
- package/dist/core/shaders/Voronoi/index.js +1 -1
- package/dist/core/shaders/WaveDistortion/index.js +1 -1
- package/dist/core/shaders/Weave/index.js +1 -1
- package/dist/core/shaders/WebcamTexture/index.js +2 -2
- package/dist/core/shaders/WorleyNoise/index.js +1 -1
- package/dist/core/shaders/ZoomBlur/index.js +1 -1
- package/dist/core/utilities/computeBlur.d.ts +3 -1
- package/dist/core/utilities/computeBlur.d.ts.map +1 -1
- package/dist/js/bundle.js +199 -199
- package/dist/js/createShader.js +1 -1
- package/dist/js/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/js/utils/generatePresetCode.js +31 -0
- package/dist/react/Exposure.js +217 -0
- package/dist/react/Preview.js +2 -0
- package/dist/react/Shader.js +1 -1
- package/dist/react/ThinFilm.js +217 -0
- package/dist/react/bundle.js +214 -214
- package/dist/react/components/Exposure.d.ts +33 -0
- package/dist/react/components/Exposure.d.ts.map +1 -0
- package/dist/react/components/ThinFilm.d.ts +41 -0
- package/dist/react/components/ThinFilm.d.ts.map +1 -0
- package/dist/react/engine/Preview.d.ts.map +1 -1
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +3 -1
- package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/react/utils/generatePresetCode.js +31 -0
- package/dist/registry.js +590 -0
- package/dist/solid/components/Exposure.d.ts +30 -0
- package/dist/solid/components/Exposure.d.ts.map +1 -0
- package/dist/solid/components/Exposure.js +228 -0
- package/dist/solid/components/ThinFilm.d.ts +38 -0
- package/dist/solid/components/ThinFilm.d.ts.map +1 -0
- package/dist/solid/components/ThinFilm.js +228 -0
- package/dist/solid/engine/Preview.d.ts.map +1 -1
- package/dist/solid/engine/Preview.js +204 -200
- package/dist/solid/engine/Shader.js +1 -1
- package/dist/solid/index.d.ts +2 -0
- package/dist/solid/index.d.ts.map +1 -1
- package/dist/solid/index.js +172 -168
- package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/solid/utils/generatePresetCode.js +31 -0
- package/dist/svelte/components/Exposure.svelte.d.ts +20 -0
- package/dist/svelte/components/ThinFilm.svelte.d.ts +28 -0
- package/dist/svelte/index.d.ts +2 -0
- package/dist/svelte/index.js +1033 -633
- package/dist/svelte/source/components/Exposure.svelte +326 -0
- package/dist/svelte/source/components/ThinFilm.svelte +334 -0
- package/dist/svelte/source/engine/Preview.svelte +4 -0
- package/dist/svelte/source/index.js +2 -0
- package/dist/svelte/utils/generatePresetCode.js +31 -0
- package/dist/vue/Exposure.js +3 -0
- package/dist/vue/Exposure.vue_vue_type_script_setup_true_lang.js +213 -0
- package/dist/vue/Preview.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/vue/ThinFilm.js +3 -0
- package/dist/vue/ThinFilm.vue_vue_type_script_setup_true_lang.js +231 -0
- package/dist/vue/components/Exposure.vue.d.ts +55 -0
- package/dist/vue/components/Exposure.vue.d.ts.map +1 -0
- package/dist/vue/components/ThinFilm.vue.d.ts +63 -0
- package/dist/vue/components/ThinFilm.vue.d.ts.map +1 -0
- package/dist/vue/index.d.ts +2 -0
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +3 -1
- package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/vue/utils/generatePresetCode.js +31 -0
- package/package.json +17 -1
- package/dist/core/shaderRegistry-Brvv9sO8.js +0 -272
- /package/dist/core/{FallingLines-DqIZ8wTH.js → FallingLines-9elMmSlj.js} +0 -0
- /package/dist/core/{FilmGrain-DdV7_b8g.js → FilmGrain-DIydVgOW.js} +0 -0
- /package/dist/core/{FloatingParticles-LMsFTJKp.js → FloatingParticles-B068TLIi.js} +0 -0
- /package/dist/core/{FlowField-D3CAHBBG.js → FlowField-CeZjhyEo.js} +0 -0
- /package/dist/core/{Flower-BbRNrXIa.js → Flower-DSr0JWa2.js} +0 -0
- /package/dist/core/{FlowingGradient-BRQ_K-k3.js → FlowingGradient-Bd8KBK5P.js} +0 -0
- /package/dist/core/{FlutedGlass-CyFWN_SM.js → FlutedGlass-BJtMfV2c.js} +0 -0
- /package/dist/core/{Fog-CLGVVVeo.js → Fog-BQuVDReH.js} +0 -0
- /package/dist/core/{Form3D-8tPyUgh4.js → Form3D-DOek31CJ.js} +0 -0
- /package/dist/core/{FractalNoise-Ccufnbw6.js → FractalNoise-Dyhbvx9a.js} +0 -0
- /package/dist/core/{GlassTiles-CXJHjEBe.js → GlassTiles-Bb3cuOkr.js} +0 -0
- /package/dist/core/{Glitch-Bg9W-KNm.js → Glitch-zqdbCc2E.js} +0 -0
- /package/dist/core/{Godrays-DHXKsw5B.js → Godrays-DdSLZtBs.js} +0 -0
- /package/dist/core/{Grayscale-DgXoUcmg.js → Grayscale-BC40hfXH.js} +0 -0
- /package/dist/core/{Grid-DwyhjFAT.js → Grid-Lc4S0Hmp.js} +0 -0
- /package/dist/core/{GridDistortion-DJ8S-96Y.js → GridDistortion-DQcPYbXS.js} +0 -0
- /package/dist/core/{Group-DmgNNlDd.js → Group-BeZhHbOT.js} +0 -0
- /package/dist/core/{Halftone-x9boWkFW.js → Halftone-CsblgxnY.js} +0 -0
- /package/dist/core/{HexGrid-BUsgyF8P.js → HexGrid-DWRNPMET.js} +0 -0
- /package/dist/core/{HueShift-D3_5D7jx.js → HueShift-C-p9W5sr.js} +0 -0
- /package/dist/core/{ImageTexture-6ZzBt79u.js → ImageTexture-bqgQxAt9.js} +0 -0
- /package/dist/core/{Invert-kXxY97QJ.js → Invert-D-RVP34v.js} +0 -0
- /package/dist/core/{Kaleidoscope-D4jRcZCt.js → Kaleidoscope-HQNQrRP_.js} +0 -0
- /package/dist/core/{LensFlare-D7vypE2Q.js → LensFlare-DtES749p.js} +0 -0
- /package/dist/core/{LinearBlur-2hspd2YP.js → LinearBlur-6mCJ9fY5.js} +0 -0
- /package/dist/core/{LinearGradient-glCc9IaB.js → LinearGradient-DIbCAHc7.js} +0 -0
- /package/dist/core/{Liquify-uZjs0wcu.js → Liquify-8dcdv2Sl.js} +0 -0
- /package/dist/core/{Marble-DkHLcqFD.js → Marble-DX29RG-p.js} +0 -0
- /package/dist/core/{Mirror-Dv5fOEp6.js → Mirror-BM2xf3Nr.js} +0 -0
- /package/dist/core/{MultiPointGradient-Dvt1GUiv.js → MultiPointGradient-BzM24vnR.js} +0 -0
- /package/dist/core/{Neon-DQDB7hAE.js → Neon-nPiMi3wt.js} +0 -0
- /package/dist/core/{Paper-DNP2-hPM.js → Paper-Ddpe8-EI.js} +0 -0
- /package/dist/core/{Perspective-CAIchX9p.js → Perspective-BIKpqd4H.js} +0 -0
- /package/dist/core/{Pixelate-BbT3Rrf2.js → Pixelate-Cp0-lwkG.js} +0 -0
- /package/dist/core/{Plasma-D9rhkH2y.js → Plasma-M--gLd1Q.js} +0 -0
- /package/dist/core/{PolarCoordinates-2RBCk-fo.js → PolarCoordinates-C42rlD2q.js} +0 -0
- /package/dist/core/{Polygon-C6_siOs0.js → Polygon-CKqH0ApY.js} +0 -0
- /package/dist/core/{Posterize-DNxTRgvF.js → Posterize-B6ZhRkH2.js} +0 -0
- /package/dist/core/{RadialGradient-CQIctl__.js → RadialGradient-SHxJ9ZNF.js} +0 -0
- /package/dist/core/{RectangularCoordinates-F2VzXmal.js → RectangularCoordinates-Dw6Xr9uV.js} +0 -0
- /package/dist/core/{Ring-UT__kmzY.js → Ring-V4sEHwwm.js} +0 -0
- /package/dist/core/{Ripples-CWVLSUP0.js → Ripples-DC1y3YuP.js} +0 -0
- /package/dist/core/{RoundedRect-BPWHTT1j.js → RoundedRect-JY2z6YEH.js} +0 -0
- /package/dist/core/{Saturation-DFOp2yD9.js → Saturation-ChJ9IWnl.js} +0 -0
- /package/dist/core/{Sharpness-PIWR4gYc.js → Sharpness-C1ufX8S-.js} +0 -0
- /package/dist/core/{Shatter-CUYQp-qy.js → Shatter-Du5THcwZ.js} +0 -0
- /package/dist/core/{SimplexNoise-LAxWw8fJ.js → SimplexNoise--vwIZVu0.js} +0 -0
- /package/dist/core/{SineWave-CEQWxC9Q.js → SineWave-BIVPG3oc.js} +0 -0
- /package/dist/core/{Smoke-DO4yylWk.js → Smoke-DSBQreo0.js} +0 -0
- /package/dist/core/{SmokeFill-Dm0sZS5F.js → SmokeFill-Dy-0kjsX.js} +0 -0
- /package/dist/core/{Solarize-mE7LU1li.js → Solarize-BymZlSu0.js} +0 -0
- /package/dist/core/{SolidColor-BljkSdvg.js → SolidColor-D8XC4aoJ.js} +0 -0
- /package/dist/core/{Spherize-DARagREe.js → Spherize-tRTB4WdO.js} +0 -0
- /package/dist/core/{Spiral-CumsIpkp.js → Spiral-CiDp2Tg2.js} +0 -0
- /package/dist/core/{Star-8fAlzR9L.js → Star-Cp4dt6Fl.js} +0 -0
- /package/dist/core/{Strands-BB4RIsFz.js → Strands-V3q8N-y1.js} +0 -0
- /package/dist/core/{Stretch-3S2atBkJ.js → Stretch-CTgtc3nG.js} +0 -0
- /package/dist/core/{Stripes-BGFVSZIt.js → Stripes-CZV6oGMy.js} +0 -0
- /package/dist/core/{StudioBackground-BtJ6b1Ki.js → StudioBackground-CWSHq6vE.js} +0 -0
- /package/dist/core/{SunBurst-BJRFFYhs.js → SunBurst-CskZwXc3.js} +0 -0
- /package/dist/core/{Swirl-fkUEZ2TQ.js → Swirl-CyGfVZ8n.js} +0 -0
- /package/dist/core/{Tint-W_EvzN1-.js → Tint-R7y5CJ4U.js} +0 -0
- /package/dist/core/{Trapezoid-cQzS6-bh.js → Trapezoid-BXzH--z9.js} +0 -0
- /package/dist/core/{Tritone-B3hI2nAi.js → Tritone-CF4Oj1sl.js} +0 -0
- /package/dist/core/{Truchet-s9PmowCP.js → Truchet-BL4jzZDX.js} +0 -0
- /package/dist/core/{Twirl-UDDXGkFl.js → Twirl-BVLPHKJD.js} +0 -0
- /package/dist/core/{VHS-DW1H7Wuy.js → VHS-B2IBdQgX.js} +0 -0
- /package/dist/core/{Vesica-ChQBYWuw.js → Vesica-DzIEa3aJ.js} +0 -0
- /package/dist/core/{Vibrance-DUj7hwzE.js → Vibrance-jrvT49Du.js} +0 -0
- /package/dist/core/{Vignette-F9yxi-UM.js → Vignette-ng_5gjXc.js} +0 -0
- /package/dist/core/{Voronoi-D8HHP_WR.js → Voronoi-C8iIU7AT.js} +0 -0
- /package/dist/core/{WaveDistortion-MbB-Kgjz.js → WaveDistortion-Crt9JSXN.js} +0 -0
- /package/dist/core/{Weave-ou5shgl3.js → Weave-CFmLkEaq.js} +0 -0
- /package/dist/core/{WorleyNoise-Uf6IPm7A.js → WorleyNoise-CEZiaVAN.js} +0 -0
- /package/dist/core/{ZoomBlur-DJ-RNKHM.js → ZoomBlur-DTVSwIvc.js} +0 -0
- /package/dist/core/{browser-NUM-x2tw.js → browser-CDogs09U.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
|
|
2
|
-
import { i as createVariableGaussianBlurCompute, r as createGaussianBlurCompute } from "./computeBlur-
|
|
2
|
+
import { i as createVariableGaussianBlurCompute, r as createGaussianBlurCompute } from "./computeBlur-oxyhoztH.js";
|
|
3
3
|
import { Fn, If, clamp, convertToTexture, dot, float, instanceIndex, int, mix, pow, screenUV, texture, textureLoad, textureStore, uint, uniform, uvec2, vec2, vec3, vec4, viewportSize } from "three/tsl";
|
|
4
4
|
const componentDefinition = {
|
|
5
5
|
name: "Blur",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
|
|
2
|
-
import { r as createGaussianBlurCompute } from "./computeBlur-
|
|
2
|
+
import { r as createGaussianBlurCompute } from "./computeBlur-oxyhoztH.js";
|
|
3
3
|
import { Fn, convertToTexture, float, mix, screenUV, texture, vec2, vec4, viewportSize } from "three/tsl";
|
|
4
4
|
const componentDefinition = {
|
|
5
5
|
name: "ChannelBlur",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { vec3, vec4 } from "three/tsl";
|
|
2
|
+
const componentDefinition = {
|
|
3
|
+
name: "Exposure",
|
|
4
|
+
category: "Adjustments",
|
|
5
|
+
description: "Multiplicative exposure (gain) on the child. Unlike additive brightness, it scales values around black — blacks stay black while highlights can be pushed past 1.0 to feed HDR bloom and tone-mapping roll-off. Pointwise, so no extra render pass is needed.",
|
|
6
|
+
requiresChild: true,
|
|
7
|
+
props: { exposure: {
|
|
8
|
+
default: 1,
|
|
9
|
+
description: "Brightness multiplier (gain). 1 = unchanged, >1 pushes highlights past white for HDR bloom, <1 darkens.",
|
|
10
|
+
ui: {
|
|
11
|
+
type: ["range", "map"],
|
|
12
|
+
min: 0,
|
|
13
|
+
max: 8,
|
|
14
|
+
step: .1,
|
|
15
|
+
label: "Exposure",
|
|
16
|
+
group: "Appearance"
|
|
17
|
+
}
|
|
18
|
+
} },
|
|
19
|
+
fragmentNode: ({ uniforms, childNode }) => {
|
|
20
|
+
if (!childNode) {
|
|
21
|
+
console.error("You must pass a child component into the Exposure shader.");
|
|
22
|
+
return vec4(0);
|
|
23
|
+
}
|
|
24
|
+
const gain = uniforms.exposure.uniform;
|
|
25
|
+
return vec4(vec3(childNode.r, childNode.g, childNode.b).mul(gain), childNode.a);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var Exposure_default = componentDefinition;
|
|
29
|
+
export { componentDefinition as n, Exposure_default as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as transformColor, l as transformPosition } from "./transformations-CJcUeZIC.js";
|
|
2
|
-
import { r as createGaussianBlurCompute } from "./computeBlur-
|
|
2
|
+
import { r as createGaussianBlurCompute } from "./computeBlur-oxyhoztH.js";
|
|
3
3
|
import { n as createAnalyticSdfSampler, r as createSvgSdfSampler } from "./sdf-D_EAGXhN.js";
|
|
4
4
|
import { Fn, If, clamp, convertToTexture, dot, exp2, float, max, mix, pow, screenUV, smoothstep, sqrt, texture, uniform, vec2, vec3, vec4, viewportSize } from "three/tsl";
|
|
5
5
|
var GOLDEN_ANGLE = 2.3999632297286535;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
|
|
2
|
-
import { i as createVariableGaussianBlurCompute, n as DEFAULT_COMPUTE_WIDTH, t as DEFAULT_COMPUTE_HEIGHT } from "./computeBlur-
|
|
2
|
+
import { i as createVariableGaussianBlurCompute, n as DEFAULT_COMPUTE_WIDTH, t as DEFAULT_COMPUTE_HEIGHT } from "./computeBlur-oxyhoztH.js";
|
|
3
3
|
import { StorageTexture } from "three/webgpu";
|
|
4
4
|
import { FloatType } from "three";
|
|
5
5
|
import { Fn, If, clamp, convertToTexture, dot, float, instanceIndex, int, max, mix, pow, screenUV, storageTexture, texture, textureLoad, textureStore, uint, uniform, uvec2, vec2, vec3, vec4, viewportSize } from "three/tsl";
|
|
@@ -58,8 +58,10 @@ const componentDefinition = {
|
|
|
58
58
|
const dpr = renderer?.getPixelRatio?.() ?? 1;
|
|
59
59
|
const texWidth = Math.round(dimensions.width * dpr);
|
|
60
60
|
const texHeight = Math.round(dimensions.height * dpr);
|
|
61
|
-
const
|
|
62
|
-
const
|
|
61
|
+
const LONG_EDGE = Math.max(DEFAULT_COMPUTE_WIDTH, 640);
|
|
62
|
+
const aspect = texHeight > 0 ? texWidth / texHeight : 1;
|
|
63
|
+
const computeWidth = Math.max(8, aspect >= 1 ? LONG_EDGE : Math.round(LONG_EDGE * aspect));
|
|
64
|
+
const computeHeight = Math.max(8, aspect >= 1 ? Math.round(LONG_EDGE / aspect) : LONG_EDGE);
|
|
63
65
|
const brightTex = new StorageTexture(computeWidth, computeHeight);
|
|
64
66
|
brightTex.type = FloatType;
|
|
65
67
|
const brightWriteNode = storageTexture(brightTex);
|
|
@@ -67,7 +69,7 @@ const componentDefinition = {
|
|
|
67
69
|
onCleanup(() => {
|
|
68
70
|
brightTex.dispose();
|
|
69
71
|
});
|
|
70
|
-
const { computeNodes: blurNodes, outputTexture: blurredTex, blurMapWriteNode } = createVariableGaussianBlurCompute(brightReadNode, computeWidth, computeHeight, onCleanup);
|
|
72
|
+
const { computeNodes: blurNodes, outputTexture: blurredTex, blurMapWriteNode } = createVariableGaussianBlurCompute(brightReadNode, computeWidth, computeHeight, onCleanup, void 0, computeWidth, computeHeight, { jitterTaps: true });
|
|
71
73
|
const inputWidthU = uniform(texWidth);
|
|
72
74
|
const inputHeightU = uniform(texHeight);
|
|
73
75
|
const cw = uint(computeWidth);
|
|
@@ -82,10 +84,23 @@ const componentDefinition = {
|
|
|
82
84
|
const v = cy.toFloat().add(float(.5)).div(float(computeHeight));
|
|
83
85
|
const srcX = u.mul(inputWidthU).round().toInt().clamp(int(0), int(inputWidthU.sub(1))).toUint();
|
|
84
86
|
const srcY = v.mul(inputHeightU).round().toInt().clamp(int(0), int(inputHeightU.sub(1))).toUint();
|
|
85
|
-
const
|
|
87
|
+
const inputWm1 = int(inputWidthU.sub(1));
|
|
88
|
+
const inputHm1 = int(inputHeightU.sub(1));
|
|
89
|
+
const sample = vec4(0).toVar();
|
|
90
|
+
for (let ty = 0; ty < 4; ty++) for (let tx = 0; tx < 4; tx++) {
|
|
91
|
+
const su = cx.toFloat().add(float((tx + .5) / 4)).div(float(computeWidth));
|
|
92
|
+
const sv = cy.toFloat().add(float((ty + .5) / 4)).div(float(computeHeight));
|
|
93
|
+
const sx = su.mul(inputWidthU).toInt().clamp(int(0), inputWm1).toUint();
|
|
94
|
+
const sy = sv.mul(inputHeightU).toInt().clamp(int(0), inputHm1).toUint();
|
|
95
|
+
sample.assign(sample.add(textureLoad(childTexture, uvec2(sx, sy), int(0))));
|
|
96
|
+
}
|
|
97
|
+
sample.assign(sample.mul(float(1 / 16)));
|
|
98
|
+
const threshold = uniforms.threshold.uniform;
|
|
99
|
+
const knee = threshold.mul(float(.5)).add(float(1e-4));
|
|
86
100
|
const lum = dot(sample.rgb, vec3(.2126, .7152, .0722));
|
|
87
|
-
const
|
|
88
|
-
|
|
101
|
+
const soft = clamp(lum.sub(threshold).add(knee), float(0), knee.mul(float(2)));
|
|
102
|
+
const mask = max(soft.mul(soft).div(knee.mul(float(4))), lum.sub(threshold)).div(max(lum, float(1e-4)));
|
|
103
|
+
textureStore(brightWriteNode, uvec2(cx, cy), vec4(sample.rgb.mul(mask), sample.a.mul(mask))).toWriteOnly();
|
|
89
104
|
let radius;
|
|
90
105
|
if (sizeMapInfo) {
|
|
91
106
|
const { sourceTexture, channel, inputMin, inputMax, outputMin, outputMax, curve } = sizeMapInfo;
|
|
@@ -123,7 +138,9 @@ const componentDefinition = {
|
|
|
123
138
|
const bloom = texture(computeOutputs.blurredTexture).sample(screenUV);
|
|
124
139
|
const sizePin = uniforms.size.uniform.mul(float(0));
|
|
125
140
|
const intensity$1 = uniforms.intensity.uniform;
|
|
126
|
-
|
|
141
|
+
const finalColor = original.rgb.add(bloom.rgb.mul(intensity$1)).add(sizePin);
|
|
142
|
+
const glowAlpha = clamp(bloom.a.mul(intensity$1), float(0), float(1));
|
|
143
|
+
return unpremultiplyAlpha(vec4(finalColor, original.a.add(glowAlpha.mul(original.a.oneMinus()))));
|
|
127
144
|
}
|
|
128
145
|
const childTexture = convertToTexture(childNode);
|
|
129
146
|
onCleanup(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { l as transformPosition, r as transformAngle } from "./transformations-CJcUeZIC.js";
|
|
2
2
|
import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
|
|
3
|
-
import { i as createVariableGaussianBlurCompute } from "./computeBlur-
|
|
3
|
+
import { i as createVariableGaussianBlurCompute } from "./computeBlur-oxyhoztH.js";
|
|
4
4
|
import { Fn, If, clamp, convertToTexture, cos, dot, float, instanceIndex, int, max, mix, pow, radians, screenUV, sin, smoothstep, texture, textureLoad, textureStore, uint, uniform, uvec2, vec2, vec3, vec4, viewportSize } from "three/tsl";
|
|
5
5
|
const componentDefinition = {
|
|
6
6
|
name: "ProgressiveBlur",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as applyEdgeHandling } from "./edges-CX_lJB9R.js";
|
|
2
2
|
import { c as transformEdges } from "./transformations-CJcUeZIC.js";
|
|
3
3
|
import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
|
|
4
|
-
import { i as createVariableGaussianBlurCompute } from "./computeBlur-
|
|
4
|
+
import { i as createVariableGaussianBlurCompute } from "./computeBlur-oxyhoztH.js";
|
|
5
5
|
import { Fn, If, convertToTexture, float, instanceIndex, mix, screenUV, smoothstep, step, texture, textureStore, uint, uniform, uvec2, vec2, vec4, viewportSize } from "three/tsl";
|
|
6
6
|
var HALF_KERNEL = 30;
|
|
7
7
|
var BLUR_TO_RADIUS_PX = 12;
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { a as transformColor, l as transformPosition, o as transformColorSpace, t as colorSpaceOptions } from "./transformations-CJcUeZIC.js";
|
|
2
|
+
import { t as mixColors } from "./colorMixing-BPpDnR5I.js";
|
|
3
|
+
import { t as createAnimatedTime } from "./time-DUqSFWvT.js";
|
|
4
|
+
import { n as createAnalyticSdfSampler, r as createSvgSdfSampler } from "./sdf-D_EAGXhN.js";
|
|
5
|
+
import { Fn, clamp, cos, float, floor, fract, mix, screenUV, sin, sqrt, step, uniform, vec2, vec3, vec4, viewportSize } from "three/tsl";
|
|
6
|
+
var TWO_PI = Math.PI * 2;
|
|
7
|
+
function applyThinFilmEffect(sdfSampler, params) {
|
|
8
|
+
const uniforms = params.uniforms;
|
|
9
|
+
const lx = uniform(0);
|
|
10
|
+
const ly = uniform(0);
|
|
11
|
+
const updateLightAngle = () => {
|
|
12
|
+
const rad = uniforms.lightAngle.uniform.value * Math.PI / 180;
|
|
13
|
+
lx.value = Math.cos(rad);
|
|
14
|
+
ly.value = Math.sin(rad);
|
|
15
|
+
};
|
|
16
|
+
updateLightAngle();
|
|
17
|
+
params.onBeforeRender(updateLightAngle);
|
|
18
|
+
const animTime = createAnimatedTime(params, uniforms.speed);
|
|
19
|
+
const mode = uniforms.mode.uniform.value;
|
|
20
|
+
return Fn(() => {
|
|
21
|
+
const uv$1 = screenUV;
|
|
22
|
+
const aspect = viewportSize.x.div(viewportSize.y);
|
|
23
|
+
const sharp = uniforms.edgeSoftness.uniform.mul(float(.5)).max(float(.001));
|
|
24
|
+
const centerPos = vec2(uniforms.center.uniform.x, uniforms.center.uniform.y.oneMinus());
|
|
25
|
+
const scale = uniforms.scale.uniform;
|
|
26
|
+
const sdfUV = vec2(uv$1.x.sub(centerPos.x).mul(aspect).div(scale).add(float(.5)), uv$1.y.sub(centerPos.y).div(scale).add(float(.5)));
|
|
27
|
+
const sdfRaw = sdfSampler(sdfUV).r;
|
|
28
|
+
const sdf = sdfRaw.div(scale);
|
|
29
|
+
const EPS = float(.01);
|
|
30
|
+
const gradX = sdfSampler(sdfUV.add(vec2(EPS, float(0)))).r.sub(sdfRaw).div(EPS);
|
|
31
|
+
const gradY = sdfSampler(sdfUV.add(vec2(float(0), EPS))).r.sub(sdfRaw).div(EPS);
|
|
32
|
+
const gLen = sqrt(gradX.mul(gradX).add(gradY.mul(gradY))).max(float(1e-4));
|
|
33
|
+
const nx = gradX.div(gLen);
|
|
34
|
+
const ny = gradY.div(gLen);
|
|
35
|
+
const rb1 = clamp(sdf.negate().div(sharp).mul(float(32)), float(0), float(1));
|
|
36
|
+
const rimWidth = uniforms.rimWidth.uniform.mul(float(.1)).max(float(.001));
|
|
37
|
+
const depth = clamp(sdf.negate().div(rimWidth), float(0), float(1));
|
|
38
|
+
const rim = float(1).sub(depth).mul(float(1).sub(depth)).mul(rb1);
|
|
39
|
+
const baseCos = nx.mul(lx).add(ny.mul(ly));
|
|
40
|
+
const baseSin = ny.mul(lx).sub(nx.mul(ly));
|
|
41
|
+
const theta = animTime.mul(float(TWO_PI));
|
|
42
|
+
const rotatedDot = baseCos.mul(cos(theta)).add(baseSin.mul(sin(theta)));
|
|
43
|
+
const phase = uniforms.hueShift.uniform.add(uniforms.dispersion.uniform.mul(rotatedDot)).add(uniforms.thickness.uniform.mul(depth).mul(float(2)));
|
|
44
|
+
let baseColor;
|
|
45
|
+
if (mode === "custom") {
|
|
46
|
+
const t3 = fract(phase).mul(float(3));
|
|
47
|
+
const si = fract(t3);
|
|
48
|
+
const floorT3 = floor(t3);
|
|
49
|
+
const cs = uniforms.colorSpace.uniform.value;
|
|
50
|
+
const c01 = mixColors(uniforms.colorA.uniform, uniforms.colorB.uniform, si, cs);
|
|
51
|
+
const c12 = mixColors(uniforms.colorB.uniform, uniforms.colorC.uniform, si, cs);
|
|
52
|
+
let res = mixColors(uniforms.colorC.uniform, uniforms.colorA.uniform, si, cs);
|
|
53
|
+
res = mix(res, c12, step(floorT3, float(1.5)));
|
|
54
|
+
res = mix(res, c01, step(floorT3, float(.5)));
|
|
55
|
+
baseColor = res.rgb;
|
|
56
|
+
} else baseColor = vec3(cos(phase.add(float(0)).mul(float(TWO_PI))), cos(phase.add(float(.3333)).mul(float(TWO_PI))), cos(phase.add(float(.6667)).mul(float(TWO_PI)))).mul(float(.5)).add(float(.5));
|
|
57
|
+
return vec4(mix(vec3(1), baseColor, uniforms.saturation.uniform).mul(rim).mul(uniforms.intensity.uniform), clamp(rim, float(0), float(1)));
|
|
58
|
+
})();
|
|
59
|
+
}
|
|
60
|
+
var DEFAULT_SHAPE_CONFIG = JSON.stringify({
|
|
61
|
+
type: "circleSDF",
|
|
62
|
+
radius: .35
|
|
63
|
+
});
|
|
64
|
+
const componentDefinition = {
|
|
65
|
+
name: "ThinFilm",
|
|
66
|
+
category: "Shape Effects",
|
|
67
|
+
description: "Iridescent thin-film edge",
|
|
68
|
+
props: {
|
|
69
|
+
center: {
|
|
70
|
+
default: {
|
|
71
|
+
x: .5,
|
|
72
|
+
y: .5
|
|
73
|
+
},
|
|
74
|
+
transform: transformPosition,
|
|
75
|
+
description: "Center position of the shape",
|
|
76
|
+
ui: {
|
|
77
|
+
type: "position",
|
|
78
|
+
label: "Center",
|
|
79
|
+
group: "Position"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
scale: {
|
|
83
|
+
default: 1,
|
|
84
|
+
description: "Scale of the shape (1 = default size)",
|
|
85
|
+
ui: {
|
|
86
|
+
type: ["range", "map"],
|
|
87
|
+
min: .1,
|
|
88
|
+
max: 3,
|
|
89
|
+
step: .05,
|
|
90
|
+
label: "Scale",
|
|
91
|
+
group: "Position"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
intensity: {
|
|
95
|
+
default: 1,
|
|
96
|
+
description: "Rim brightness — values above 1 push the edge past white for HDR bloom",
|
|
97
|
+
ui: {
|
|
98
|
+
type: ["range", "map"],
|
|
99
|
+
min: 0,
|
|
100
|
+
max: 4,
|
|
101
|
+
step: .05,
|
|
102
|
+
label: "Intensity",
|
|
103
|
+
group: "Film"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
rimWidth: {
|
|
107
|
+
default: 1,
|
|
108
|
+
description: "How far inward from the edge the iridescence reaches",
|
|
109
|
+
ui: {
|
|
110
|
+
type: ["range", "map"],
|
|
111
|
+
min: 0,
|
|
112
|
+
max: 3,
|
|
113
|
+
step: .01,
|
|
114
|
+
label: "Rim Width",
|
|
115
|
+
group: "Film"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
edgeSoftness: {
|
|
119
|
+
default: .3,
|
|
120
|
+
description: "Softness of the shape boundary",
|
|
121
|
+
ui: {
|
|
122
|
+
type: ["range", "map"],
|
|
123
|
+
min: 0,
|
|
124
|
+
max: 1,
|
|
125
|
+
step: .05,
|
|
126
|
+
label: "Edge Softness",
|
|
127
|
+
group: "Film"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
thickness: {
|
|
131
|
+
default: .5,
|
|
132
|
+
description: "Film thickness — higher values pack more spectral bands across the rim",
|
|
133
|
+
ui: {
|
|
134
|
+
type: ["range", "map"],
|
|
135
|
+
min: 0,
|
|
136
|
+
max: 1,
|
|
137
|
+
step: .01,
|
|
138
|
+
label: "Thickness",
|
|
139
|
+
group: "Film"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
dispersion: {
|
|
143
|
+
default: .5,
|
|
144
|
+
description: "How strongly colour separates around the perimeter (warm vs cool sides)",
|
|
145
|
+
ui: {
|
|
146
|
+
type: ["range", "map"],
|
|
147
|
+
min: 0,
|
|
148
|
+
max: 1,
|
|
149
|
+
step: .01,
|
|
150
|
+
label: "Dispersion",
|
|
151
|
+
group: "Film"
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
saturation: {
|
|
155
|
+
default: 1,
|
|
156
|
+
description: "Spectral saturation — 0 = white rim, 1 = full iridescence",
|
|
157
|
+
ui: {
|
|
158
|
+
type: ["range", "map"],
|
|
159
|
+
min: 0,
|
|
160
|
+
max: 1,
|
|
161
|
+
step: .01,
|
|
162
|
+
label: "Saturation",
|
|
163
|
+
group: "Film"
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
hueShift: {
|
|
167
|
+
default: 0,
|
|
168
|
+
description: "Rotate the spectrum to reposition the colours",
|
|
169
|
+
ui: {
|
|
170
|
+
type: ["range", "map"],
|
|
171
|
+
min: 0,
|
|
172
|
+
max: 1,
|
|
173
|
+
step: .01,
|
|
174
|
+
label: "Hue Shift",
|
|
175
|
+
group: "Film"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
lightAngle: {
|
|
179
|
+
default: 300,
|
|
180
|
+
description: "Light angle in degrees — sets which side of the rim runs warm vs cool",
|
|
181
|
+
ui: {
|
|
182
|
+
type: "range",
|
|
183
|
+
min: 0,
|
|
184
|
+
max: 360,
|
|
185
|
+
step: 1,
|
|
186
|
+
label: "Light Angle",
|
|
187
|
+
group: "Film"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
mode: {
|
|
191
|
+
default: "rainbow",
|
|
192
|
+
compileTime: true,
|
|
193
|
+
description: "Rainbow uses the full iridescent spectrum; Custom cycles through your three chosen colours",
|
|
194
|
+
ui: {
|
|
195
|
+
type: "select",
|
|
196
|
+
options: [{
|
|
197
|
+
label: "Rainbow",
|
|
198
|
+
value: "rainbow"
|
|
199
|
+
}, {
|
|
200
|
+
label: "Custom",
|
|
201
|
+
value: "custom"
|
|
202
|
+
}],
|
|
203
|
+
label: "Mode",
|
|
204
|
+
group: "Colors"
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
colorA: {
|
|
208
|
+
default: "#2b6fff",
|
|
209
|
+
transform: transformColor,
|
|
210
|
+
description: "First colour in the rim cycle",
|
|
211
|
+
ui: {
|
|
212
|
+
type: "color",
|
|
213
|
+
label: "Color 1",
|
|
214
|
+
group: "Colors",
|
|
215
|
+
condition: { mode: "custom" }
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
colorB: {
|
|
219
|
+
default: "#ffffff",
|
|
220
|
+
transform: transformColor,
|
|
221
|
+
description: "Second colour in the rim cycle",
|
|
222
|
+
ui: {
|
|
223
|
+
type: "color",
|
|
224
|
+
label: "Color 2",
|
|
225
|
+
group: "Colors",
|
|
226
|
+
condition: { mode: "custom" }
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
colorC: {
|
|
230
|
+
default: "#ff7a21",
|
|
231
|
+
transform: transformColor,
|
|
232
|
+
description: "Third colour in the rim cycle",
|
|
233
|
+
ui: {
|
|
234
|
+
type: "color",
|
|
235
|
+
label: "Color 3",
|
|
236
|
+
group: "Colors",
|
|
237
|
+
condition: { mode: "custom" }
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
colorSpace: {
|
|
241
|
+
default: "oklch",
|
|
242
|
+
transform: transformColorSpace,
|
|
243
|
+
compileTime: true,
|
|
244
|
+
description: "Colour space used to blend between custom colours",
|
|
245
|
+
ui: {
|
|
246
|
+
type: "select",
|
|
247
|
+
options: colorSpaceOptions,
|
|
248
|
+
label: "Color Space",
|
|
249
|
+
group: "Colors",
|
|
250
|
+
condition: { mode: "custom" }
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
speed: {
|
|
254
|
+
default: .1,
|
|
255
|
+
description: "Speed at which the colours rotate around the rim (0 = static)",
|
|
256
|
+
ui: {
|
|
257
|
+
type: "range",
|
|
258
|
+
min: -1,
|
|
259
|
+
max: 1,
|
|
260
|
+
step: .01,
|
|
261
|
+
label: "Speed",
|
|
262
|
+
group: "Animation"
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
shape: {
|
|
266
|
+
default: DEFAULT_SHAPE_CONFIG,
|
|
267
|
+
description: "Serialized shape configuration (JSON)",
|
|
268
|
+
ui: {
|
|
269
|
+
type: "shape",
|
|
270
|
+
label: "Shape",
|
|
271
|
+
group: "Shape"
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
shapeSdfUrl: {
|
|
275
|
+
default: "",
|
|
276
|
+
compileTime: true,
|
|
277
|
+
description: "URL to a pre-generated SDF .bin file — when non-empty, activates SVG mode and triggers a shader recompile"
|
|
278
|
+
},
|
|
279
|
+
shapeType: {
|
|
280
|
+
default: "",
|
|
281
|
+
compileTime: true,
|
|
282
|
+
description: "Active SDF shape type — triggers recompile when shape is switched. When empty, derived from shape JSON at mount time."
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
fragmentNode: (params) => {
|
|
286
|
+
const { uniforms, onCleanup, onBeforeRender } = params;
|
|
287
|
+
const shapeSdfUrl = uniforms.shapeSdfUrl.uniform.value;
|
|
288
|
+
const initialConfig = (() => {
|
|
289
|
+
const val = uniforms.shape.uniform.value;
|
|
290
|
+
if (typeof val === "object" && val !== null) return val;
|
|
291
|
+
try {
|
|
292
|
+
return JSON.parse(val);
|
|
293
|
+
} catch {
|
|
294
|
+
return {
|
|
295
|
+
type: "circleSDF",
|
|
296
|
+
radius: .35
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
})();
|
|
300
|
+
if (shapeSdfUrl) return applyThinFilmEffect(createSvgSdfSampler(shapeSdfUrl, onBeforeRender, onCleanup), params);
|
|
301
|
+
else return applyThinFilmEffect(createAnalyticSdfSampler(uniforms.shapeType.uniform.value || initialConfig.type || "circleSDF", initialConfig, uniforms.shape, onBeforeRender), params);
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
var ThinFilm_default = componentDefinition;
|
|
305
|
+
export { componentDefinition as n, ThinFilm_default as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { l as transformPosition, r as transformAngle } from "./transformations-CJcUeZIC.js";
|
|
2
2
|
import { t as unpremultiplyAlpha } from "./alpha-C4ptedXe.js";
|
|
3
|
-
import { i as createVariableGaussianBlurCompute } from "./computeBlur-
|
|
3
|
+
import { i as createVariableGaussianBlurCompute } from "./computeBlur-oxyhoztH.js";
|
|
4
4
|
import { Fn, If, abs, clamp, convertToTexture, cos, dot, float, instanceIndex, int, mix, pow, radians, screenUV, sin, smoothstep, texture, textureLoad, textureStore, uint, uniform, uvec2, vec2, vec3, vec4, viewportSize } from "three/tsl";
|
|
5
5
|
const componentDefinition = {
|
|
6
6
|
name: "TiltShift",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as needsVideoCanvasWorkaround } from "./browser-
|
|
1
|
+
import { t as needsVideoCanvasWorkaround } from "./browser-CDogs09U.js";
|
|
2
2
|
import { CanvasTexture, SRGBColorSpace, VideoTexture } from "three/webgpu";
|
|
3
3
|
import { float, max, min, or, screenUV, select, texture, uniform, vec2, vec4, viewportSize } from "three/tsl";
|
|
4
4
|
const componentDefinition = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as needsVideoCanvasWorkaround } from "./browser-
|
|
1
|
+
import { t as needsVideoCanvasWorkaround } from "./browser-CDogs09U.js";
|
|
2
2
|
import { CanvasTexture, SRGBColorSpace, VideoTexture } from "three/webgpu";
|
|
3
3
|
import { float, max, min, or, screenUV, select, texture, uniform, vec2, vec4, viewportSize } from "three/tsl";
|
|
4
4
|
const componentDefinition = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linearDodge.d.ts","sourceRoot":"","sources":["../../src/blendModes/linearDodge.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAA;AAEjC,MAAM,CAAC,OAAO,WAAU,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAE,MAAM,GAAG,IAAU,
|
|
1
|
+
{"version":3,"file":"linearDodge.d.ts","sourceRoot":"","sources":["../../src/blendModes/linearDodge.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAA;AAEjC,MAAM,CAAC,OAAO,WAAU,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAE,MAAM,GAAG,IAAU,mCAqB9E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StorageTexture } from "three/webgpu";
|
|
2
|
-
import { FloatType } from "three";
|
|
3
|
-
import { Fn, If, float, instanceIndex, int, storageTexture, textureLoad, textureStore, uint, uniform, uniformArray, uvec2, vec4 } from "three/tsl";
|
|
2
|
+
import { FloatType, HalfFloatType, LinearFilter as LinearFilter$1 } from "three";
|
|
3
|
+
import { Fn, If, float, fract, instanceIndex, int, storageTexture, textureLoad, textureStore, uint, uniform, uniformArray, uvec2, vec4 } from "three/tsl";
|
|
4
4
|
var DEFAULT_HALF_KERNEL = 24;
|
|
5
5
|
const DEFAULT_COMPUTE_WIDTH = 1024;
|
|
6
6
|
const DEFAULT_COMPUTE_HEIGHT = 640;
|
|
@@ -24,7 +24,9 @@ function createGaussianBlurCompute(inputTexture, inputWidth, inputHeight, onClea
|
|
|
24
24
|
const intermediateTex = new StorageTexture(computeWidth, computeHeight);
|
|
25
25
|
intermediateTex.type = FloatType;
|
|
26
26
|
const outputTex = new StorageTexture(computeWidth, computeHeight);
|
|
27
|
-
outputTex.type =
|
|
27
|
+
outputTex.type = HalfFloatType;
|
|
28
|
+
outputTex.minFilter = LinearFilter$1;
|
|
29
|
+
outputTex.magFilter = LinearFilter$1;
|
|
28
30
|
onCleanup(() => {
|
|
29
31
|
intermediateTex.dispose();
|
|
30
32
|
outputTex.dispose();
|
|
@@ -118,7 +120,8 @@ function createGaussianBlurCompute(inputTexture, inputWidth, inputHeight, onClea
|
|
|
118
120
|
}
|
|
119
121
|
};
|
|
120
122
|
}
|
|
121
|
-
function createVariableGaussianBlurCompute(inputTexture, inputWidth, inputHeight, onCleanup, halfKernel = DEFAULT_HALF_KERNEL, computeWidth = DEFAULT_COMPUTE_WIDTH, computeHeight = 640) {
|
|
123
|
+
function createVariableGaussianBlurCompute(inputTexture, inputWidth, inputHeight, onCleanup, halfKernel = DEFAULT_HALF_KERNEL, computeWidth = DEFAULT_COMPUTE_WIDTH, computeHeight = 640, options) {
|
|
124
|
+
const jitterTaps = options?.jitterTaps === true;
|
|
122
125
|
const HALF_KERNEL = halfKernel;
|
|
123
126
|
const FIXED_WEIGHTS = buildFixedWeights(HALF_KERNEL);
|
|
124
127
|
const blurMapTex = new StorageTexture(computeWidth, computeHeight);
|
|
@@ -128,7 +131,9 @@ function createVariableGaussianBlurCompute(inputTexture, inputWidth, inputHeight
|
|
|
128
131
|
const intermediateTex = new StorageTexture(computeWidth, computeHeight);
|
|
129
132
|
intermediateTex.type = FloatType;
|
|
130
133
|
const outputTex = new StorageTexture(computeWidth, computeHeight);
|
|
131
|
-
outputTex.type =
|
|
134
|
+
outputTex.type = HalfFloatType;
|
|
135
|
+
outputTex.minFilter = LinearFilter$1;
|
|
136
|
+
outputTex.magFilter = LinearFilter$1;
|
|
132
137
|
onCleanup(() => {
|
|
133
138
|
blurMapTex.dispose();
|
|
134
139
|
intermediateTex.dispose();
|
|
@@ -164,8 +169,9 @@ function createVariableGaussianBlurCompute(inputTexture, inputWidth, inputHeight
|
|
|
164
169
|
textureStore(intermediateWriteNode, uvec2(cx, cy), texel).toWriteOnly();
|
|
165
170
|
}).Else(() => {
|
|
166
171
|
const sum = vec4(0).toVar();
|
|
172
|
+
const jitterH = jitterTaps ? fract(float(52.9829189).mul(fract(cx.toFloat().mul(float(.06711056)).add(cy.toFloat().mul(float(.00583715)))))).sub(float(.5)) : float(0);
|
|
167
173
|
for (let i = -HALF_KERNEL; i <= HALF_KERNEL; i++) {
|
|
168
|
-
const offset = float(i).mul(invHalf).mul(blurRadius);
|
|
174
|
+
const offset = float(i).add(jitterH).mul(invHalf).mul(blurRadius);
|
|
169
175
|
const texel = textureLoad(inputTexture, uvec2(inputCxF.add(offset).round().toInt().clamp(int(0), inputWm1).toUint(), inputCyI.toUint()), int(0));
|
|
170
176
|
sum.assign(sum.add(texel.mul(weights.element(int(i + HALF_KERNEL)))));
|
|
171
177
|
}
|
|
@@ -185,8 +191,9 @@ function createVariableGaussianBlurCompute(inputTexture, inputWidth, inputHeight
|
|
|
185
191
|
const sum = vec4(0).toVar();
|
|
186
192
|
const yi = cy.toInt();
|
|
187
193
|
const radiusComputeY = blurRadius.div(scaleYU);
|
|
194
|
+
const jitterV = jitterTaps ? fract(float(52.9829189).mul(fract(cx.toFloat().mul(float(.00583715)).add(cy.toFloat().mul(float(.06711056)))))).sub(float(.5)) : float(0);
|
|
188
195
|
for (let i = -HALF_KERNEL; i <= HALF_KERNEL; i++) {
|
|
189
|
-
const offset = float(i).mul(invHalf).mul(radiusComputeY);
|
|
196
|
+
const offset = float(i).add(jitterV).mul(invHalf).mul(radiusComputeY);
|
|
190
197
|
const texel = textureLoad(intermediateReadNode, uvec2(cx, yi.add(offset.round().toInt()).clamp(int(0), computeHm1).toUint()), int(0));
|
|
191
198
|
sum.assign(sum.add(texel.mul(weights.element(int(i + HALF_KERNEL)))));
|
|
192
199
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Node } from 'three/webgpu';
|
|
2
|
+
import { FragmentNodeParams } from '../types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Iridescent thin-film rim around an SDF-defined shape.
|
|
6
|
+
*
|
|
7
|
+
* Reuses the same shape pipeline as Glass: an SDF sampler (analytic or .bin texture)
|
|
8
|
+
* provides a signed distance, and three samples build a finite-difference gradient that
|
|
9
|
+
* serves as the boundary normal. From that we derive a rim band (peaks at the edge,
|
|
10
|
+
* falls off inward) and shade it with a thin-film interference spectrum.
|
|
11
|
+
*
|
|
12
|
+
* Thin-film colour shifts with the optical path through the film, which here is driven by
|
|
13
|
+
* two terms: a directional component (normal · light) that runs the spectrum warm→cool
|
|
14
|
+
* around the perimeter — exactly the blue-on-one-side / orange-on-the-other signature —
|
|
15
|
+
* and a depth component that packs finer spectral bands across the rim width.
|
|
16
|
+
*
|
|
17
|
+
* Two colour modes mirror ColorWheel: `rainbow` uses a procedural iridescent spectrum,
|
|
18
|
+
* `custom` cycles through three user colours (A→B→C→A) blended in the chosen colour space.
|
|
19
|
+
* `speed` rotates the directional axis over time, sweeping the colours around the rim
|
|
20
|
+
* (at speed 0 the result is identical to the static look).
|
|
21
|
+
*
|
|
22
|
+
* Output is a transparent-interior generator (no child): RGB is the rim colour, alpha is
|
|
23
|
+
* the band mask. Intensity is unclamped so the rim can exceed 1.0 and blow out via the
|
|
24
|
+
* renderer's tone mapping. Composite it over a shape (e.g. Glass) with `screen` or the
|
|
25
|
+
* (unclamped) `linearDodge` blend mode.
|
|
26
|
+
*
|
|
27
|
+
* @param sdfSampler - (uv) → vec4; R channel = signed distance (negative inside)
|
|
28
|
+
* @param params - the component's FragmentNodeParams (uniforms, onBeforeRender, time)
|
|
29
|
+
*/
|
|
30
|
+
export interface ThinFilmEffectUniforms {
|
|
31
|
+
center: {
|
|
32
|
+
uniform: any;
|
|
33
|
+
};
|
|
34
|
+
scale: {
|
|
35
|
+
uniform: any;
|
|
36
|
+
};
|
|
37
|
+
intensity: {
|
|
38
|
+
uniform: any;
|
|
39
|
+
};
|
|
40
|
+
rimWidth: {
|
|
41
|
+
uniform: any;
|
|
42
|
+
};
|
|
43
|
+
edgeSoftness: {
|
|
44
|
+
uniform: any;
|
|
45
|
+
};
|
|
46
|
+
thickness: {
|
|
47
|
+
uniform: any;
|
|
48
|
+
};
|
|
49
|
+
dispersion: {
|
|
50
|
+
uniform: any;
|
|
51
|
+
};
|
|
52
|
+
saturation: {
|
|
53
|
+
uniform: any;
|
|
54
|
+
};
|
|
55
|
+
hueShift: {
|
|
56
|
+
uniform: any;
|
|
57
|
+
};
|
|
58
|
+
lightAngle: {
|
|
59
|
+
uniform: any;
|
|
60
|
+
};
|
|
61
|
+
speed: {
|
|
62
|
+
uniform: any;
|
|
63
|
+
};
|
|
64
|
+
mode: {
|
|
65
|
+
uniform: any;
|
|
66
|
+
};
|
|
67
|
+
colorA: {
|
|
68
|
+
uniform: any;
|
|
69
|
+
};
|
|
70
|
+
colorB: {
|
|
71
|
+
uniform: any;
|
|
72
|
+
};
|
|
73
|
+
colorC: {
|
|
74
|
+
uniform: any;
|
|
75
|
+
};
|
|
76
|
+
colorSpace: {
|
|
77
|
+
uniform: any;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export declare function applyThinFilmEffect(sdfSampler: (uv: any) => any, params: FragmentNodeParams): Node;
|
|
81
|
+
//# sourceMappingURL=thinFilm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thinFilm.d.ts","sourceRoot":"","sources":["../../src/effects/thinFilm.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,EAAC,kBAAkB,EAAc,MAAM,UAAU,CAAA;AAI7D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,sBAAsB;IACnC,MAAM,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAA;IACxB,KAAK,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAA;IACvB,SAAS,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAA;IAC3B,QAAQ,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAA;IAC1B,YAAY,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAA;IAC9B,SAAS,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAA;IAC3B,UAAU,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAA;IAC5B,UAAU,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAA;IAC5B,QAAQ,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAA;IAC1B,UAAU,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAA;IAC5B,KAAK,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAA;IACvB,IAAI,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAA;IACtB,MAAM,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAA;IACxB,MAAM,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAA;IACxB,MAAM,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAA;IACxB,UAAU,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAA;CAC/B;AAID,wBAAgB,mBAAmB,CAC/B,UAAU,EAAE,CAAC,EAAE,EAAE,GAAG,KAAK,GAAG,EAC5B,MAAM,EAAE,kBAAkB,GAC3B,IAAI,CA2GN"}
|