shaders 2.2.23 → 2.2.25
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/AngularBlur-Dl2gwk68.js +64 -0
- package/dist/core/Ascii-Dha_QpT3.js +286 -0
- package/dist/core/Beam-CTN9Ni43.js +139 -0
- package/dist/core/Blob-CxFDZovO.js +218 -0
- package/dist/core/Blur-Y2FsmFk_.js +77 -0
- package/dist/core/Bulge-Cb-t0xqI.js +132 -0
- package/dist/core/CRTScreen-CtERsenz.js +112 -0
- package/dist/core/ChannelBlur-CvM6GJgZ.js +118 -0
- package/dist/core/Checkerboard-CgB-egNY.js +83 -0
- package/dist/core/ChromaFlow-vRCwhQpN.js +222 -0
- package/dist/core/ChromaticAberration-FTquTQIL.js +88 -0
- package/dist/core/Circle-Daziv5d7.js +67 -0
- package/dist/core/CursorTrail-Bsz9e6Fn.js +145 -0
- package/dist/core/DiffuseBlur-Cj2PtRNd.js +83 -0
- package/dist/core/Dither-D2Nf4p3w.js +66 -0
- package/dist/core/DotGrid-CzOwquo4.js +75 -0
- package/dist/core/Duotone-XuTN9tI7.js +65 -0
- package/dist/core/FilmGrain-D3-nbi12.js +28 -0
- package/dist/core/FloatingParticles-D9Nnu1qg.js +217 -0
- package/dist/core/GlassTiles-CnjCvajI.js +69 -0
- package/dist/core/Glow-BluFc9be.js +75 -0
- package/dist/core/Godrays-ChLh_vGl.js +144 -0
- package/dist/core/Grayscale-DRny75A9.js +20 -0
- package/dist/core/Grid-DgyDa4H1.js +58 -0
- package/dist/core/GridDistortion-BAspCYvp.js +188 -0
- package/dist/core/Group-Dul7PUBl.js +14 -0
- package/dist/core/Halftone-Ifv5F_FT.js +65 -0
- package/dist/core/HueShift-De8ukMWs.js +31 -0
- package/dist/core/ImageTexture-DvYcQgJB.js +143 -0
- package/dist/core/Invert-Fz0NtIJc.js +21 -0
- package/dist/core/LinearBlur-LmhnQoA4.js +62 -0
- package/dist/core/LinearGradient-xbloQjzt.js +133 -0
- package/dist/core/Liquify-DMe1V5-O.js +175 -0
- package/dist/core/Pixelate-Cv8537Pj.js +37 -0
- package/dist/core/PolarCoordinates-DDvDhBE-.js +112 -0
- package/dist/core/Posterize-3m3xkWOz.js +29 -0
- package/dist/core/ProgressiveBlur-EGkevObV.js +121 -0
- package/dist/core/RadialGradient-B7ZZB_VJ.js +71 -0
- package/dist/core/RectangularCoordinates-muWR8mZS.js +101 -0
- package/dist/core/Ripples-8XaZaXQF.js +117 -0
- package/dist/core/Saturation-CYFI1jzN.js +30 -0
- package/dist/core/SimplexNoise-DJUe0wz_.js +99 -0
- package/dist/core/SineWave-Dl3nFO1W.js +120 -0
- package/dist/core/SolidColor-CWGq_Bjq.js +21 -0
- package/dist/core/Spherize-C-jZEUsN.js +128 -0
- package/dist/core/Spiral-BSB_R39p.js +132 -0
- package/dist/core/Strands-0stO5BMy.js +161 -0
- package/dist/core/Stretch-B645paha.js +133 -0
- package/dist/core/Swirl-CVnbawit.js +173 -0
- package/dist/core/TiltShift-0CxNRI6L.js +134 -0
- package/dist/core/Tritone-Daa-I5UD.js +76 -0
- package/dist/core/Twirl-2CJVZEtk.js +96 -0
- package/dist/core/Vibrance-DRtecEvb.js +30 -0
- package/dist/core/WaveDistortion-BscXN2rs.js +173 -0
- package/dist/core/ZoomBlur-CAqK0Kju.js +62 -0
- package/dist/core/colorMixing-BXiTAqJU.js +69 -0
- package/dist/core/edges-Bn_OIa_h.js +26 -0
- package/dist/core/index.js +2257 -1604
- package/dist/core/shaderRegistry.d.ts.map +1 -1
- package/dist/core/shaders/AngularBlur/index.js +3 -7
- package/dist/core/shaders/Ascii/index.js +2 -6
- package/dist/core/shaders/Beam/index.d.ts +71 -0
- package/dist/core/shaders/Beam/index.d.ts.map +1 -0
- package/dist/core/shaders/Beam/index.js +4 -0
- package/dist/core/shaders/Blob/index.js +5 -9
- package/dist/core/shaders/Blur/index.js +2 -6
- package/dist/core/shaders/Bulge/index.js +4 -8
- package/dist/core/shaders/CRTScreen/index.js +2 -6
- package/dist/core/shaders/ChannelBlur/index.js +2 -6
- package/dist/core/shaders/Checkerboard/index.js +4 -8
- package/dist/core/shaders/ChromaFlow/index.js +3 -7
- package/dist/core/shaders/ChromaticAberration/index.js +3 -7
- package/dist/core/shaders/Circle/index.js +3 -7
- package/dist/core/shaders/CursorTrail/index.js +4 -8
- package/dist/core/shaders/DiffuseBlur/index.js +4 -8
- package/dist/core/shaders/Dither/index.js +3 -7
- package/dist/core/shaders/DotGrid/index.js +3 -7
- package/dist/core/shaders/Duotone/index.js +4 -8
- package/dist/core/shaders/FilmGrain/index.js +2 -6
- package/dist/core/shaders/FloatingParticles/index.js +3 -7
- package/dist/core/shaders/GlassTiles/index.js +2 -6
- package/dist/core/shaders/Glow/index.js +2 -6
- package/dist/core/shaders/Godrays/index.js +3 -7
- package/dist/core/shaders/Grayscale/index.js +2 -8
- package/dist/core/shaders/Grid/index.js +3 -7
- package/dist/core/shaders/GridDistortion/index.js +4 -8
- package/dist/core/shaders/Group/index.js +2 -6
- package/dist/core/shaders/Halftone/index.js +3 -7
- package/dist/core/shaders/HueShift/index.js +2 -8
- package/dist/core/shaders/ImageTexture/index.js +2 -6
- package/dist/core/shaders/Invert/index.js +2 -6
- package/dist/core/shaders/LinearBlur/index.js +3 -7
- package/dist/core/shaders/LinearGradient/index.js +4 -8
- package/dist/core/shaders/Liquify/index.js +4 -8
- package/dist/core/shaders/Pixelate/index.js +2 -6
- package/dist/core/shaders/PolarCoordinates/index.js +4 -8
- package/dist/core/shaders/Posterize/index.js +2 -7
- package/dist/core/shaders/ProgressiveBlur/index.js +3 -7
- package/dist/core/shaders/RadialGradient/index.js +4 -8
- package/dist/core/shaders/RectangularCoordinates/index.js +4 -8
- package/dist/core/shaders/Ripples/index.js +5 -9
- package/dist/core/shaders/Saturation/index.js +2 -8
- package/dist/core/shaders/SimplexNoise/index.js +5 -9
- package/dist/core/shaders/SineWave/index.js +3 -7
- package/dist/core/shaders/SolidColor/index.js +3 -7
- package/dist/core/shaders/Spherize/index.js +3 -7
- package/dist/core/shaders/Spiral/index.js +4 -8
- package/dist/core/shaders/Strands/index.js +4 -8
- package/dist/core/shaders/Stretch/index.js +4 -8
- package/dist/core/shaders/Swirl/index.js +5 -9
- package/dist/core/shaders/TiltShift/index.js +3 -7
- package/dist/core/shaders/Tritone/index.js +4 -8
- package/dist/core/shaders/Twirl/index.js +4 -8
- package/dist/core/shaders/Vibrance/index.js +2 -8
- package/dist/core/shaders/WaveDistortion/index.js +4 -8
- package/dist/core/shaders/ZoomBlur/index.js +3 -7
- package/dist/core/telemetry/index.js +189 -157
- package/dist/core/time-CTJvRUZ4.js +10 -0
- package/dist/core/transformations-DxfQXZWi.js +4715 -0
- package/dist/react/components/Beam.d.ts +31 -0
- package/dist/react/components/Beam.d.ts.map +1 -0
- package/dist/react/generatePresetCode-CCibXbtZ.js +645 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +7649 -104600
- package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/react/utils/generatePresetCode.js +2 -5
- package/dist/registry.js +224 -0
- package/dist/solid/components/Beam.d.ts +28 -0
- package/dist/solid/components/Beam.d.ts.map +1 -0
- package/dist/solid/index.d.ts +1 -0
- package/dist/solid/index.d.ts.map +1 -1
- package/dist/solid/index.js +6691 -102524
- package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/solid/utils/generatePresetCode.js +586 -537
- package/dist/svelte/components/Beam.svelte.d.ts +19 -0
- package/dist/svelte/generatePresetCode-CymgoDq_.js +645 -0
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +6175 -102455
- package/dist/svelte/utils/generatePresetCode.js +2 -5
- package/dist/vue/components/Beam.vue.d.ts +57 -0
- package/dist/vue/components/Beam.vue.d.ts.map +1 -0
- package/dist/vue/generatePresetCode-CRJmU8iF.js +649 -0
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +6929 -103492
- package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/vue/utils/generatePresetCode.js +2 -5
- package/package.json +12 -1
- package/dist/core/AngularBlur-ClvtyURQ.js +0 -56
- package/dist/core/Ascii-BT0-K_vw.js +0 -196
- package/dist/core/Blob-BlQ_1T_8.js +0 -169
- package/dist/core/Blur-421AjWLH.js +0 -64
- package/dist/core/Bulge-CZRVoR6C.js +0 -103
- package/dist/core/CRTScreen-C_U9g_IR.js +0 -91
- package/dist/core/ChannelBlur-5pzcB6Zv.js +0 -89
- package/dist/core/Checkerboard-CrQkqXhD.js +0 -75
- package/dist/core/ChromaFlow-CNrQdL8f.js +0 -134
- package/dist/core/ChromaticAberration-D9H7O17Y.js +0 -82
- package/dist/core/Circle-DnLaDn8V.js +0 -62
- package/dist/core/ColorAdjustment-CKwpE_4M.js +0 -14
- package/dist/core/CursorTrail-NY6n97VG.js +0 -105
- package/dist/core/DiffuseBlur-C_n01ABk.js +0 -69
- package/dist/core/Dither-4s-c4zh4.js +0 -61
- package/dist/core/DotGrid-BYl8XdMi.js +0 -61
- package/dist/core/Duotone-DbewOoB4.js +0 -66
- package/dist/core/FilmGrain-zA_-knOw.js +0 -28
- package/dist/core/FloatingParticles-BhVnqMsE.js +0 -160
- package/dist/core/GlassTiles-CFI57glh.js +0 -52
- package/dist/core/Glow-CQgl3IoS.js +0 -66
- package/dist/core/Godrays-BHMix_Bh.js +0 -105
- package/dist/core/Grayscale-CAEFLteL.js +0 -21
- package/dist/core/Grid-DlM-rVbZ.js +0 -50
- package/dist/core/GridDistortion-ZOZphSAT.js +0 -147
- package/dist/core/Group-BQAs3RiH.js +0 -17
- package/dist/core/Halftone-ci4ga-_J.js +0 -55
- package/dist/core/HueShift-CyxzPcJV.js +0 -32
- package/dist/core/ImageTexture-CdAGsPuH.js +0 -105
- package/dist/core/Invert-iPsiIqNZ.js +0 -20
- package/dist/core/LinearBlur-BEaaoIk-.js +0 -56
- package/dist/core/LinearGradient-DR_7RxLX.js +0 -111
- package/dist/core/Liquify-Bi02_ugh.js +0 -139
- package/dist/core/Pixelate-CSsdT1rr.js +0 -38
- package/dist/core/PolarCoordinates-D626ml58.js +0 -103
- package/dist/core/Posterize-DhZkMaC7.js +0 -46
- package/dist/core/ProgressiveBlur-CGtCfLF8.js +0 -102
- package/dist/core/RadialGradient-C0_WzmbH.js +0 -71
- package/dist/core/RectangularCoordinates-DfXw7fhI.js +0 -92
- package/dist/core/Ripples-DkemN3eh.js +0 -106
- package/dist/core/Saturation-Dup81Pnq.js +0 -31
- package/dist/core/SimplexNoise-BYEiCjDj.js +0 -94
- package/dist/core/SineWave-C6MRPtsy.js +0 -107
- package/dist/core/SolidColor-BZHRczgb.js +0 -22
- package/dist/core/Spherize-DOAnDx2l.js +0 -103
- package/dist/core/Spiral-BMjnWXh1.js +0 -115
- package/dist/core/Strands-BOVsuJLe.js +0 -125
- package/dist/core/Stretch-D6bHc6yp.js +0 -103
- package/dist/core/Swirl-BFoc0ImG.js +0 -148
- package/dist/core/TSLBase-BFMvTOak.js +0 -8053
- package/dist/core/TiltShift-BiNvvhzj.js +0 -114
- package/dist/core/Tritone-gdx2AA0m.js +0 -75
- package/dist/core/Twirl-BsV8YbqC.js +0 -82
- package/dist/core/Vibrance-C182fbSw.js +0 -31
- package/dist/core/WaveDistortion-CmaS2zDB.js +0 -132
- package/dist/core/ZoomBlur-DLf5xQ16.js +0 -56
- package/dist/core/colorMixing--dhzx0ch.js +0 -21
- package/dist/core/edges-CDzKsauJ.js +0 -15
- package/dist/core/three.tsl-Btj1hLsf.js +0 -43845
- package/dist/core/time-DbRMw6Jm.js +0 -10
- package/dist/core/transformations-CsrIJXh-.js +0 -3992
- package/dist/react/generatePresetCode-DaS7jkcT.js +0 -626
- package/dist/svelte/generatePresetCode-DaS7jkcT.js +0 -626
- package/dist/vue/generatePresetCode-Cd1B-Y9j.js +0 -632
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { i as transformColorSpace, o as transformPosition, r as transformColor, t as colorSpaceOptions } from "./transformations-DxfQXZWi.js";
|
|
2
|
+
import { t as mixColors } from "./colorMixing-BXiTAqJU.js";
|
|
3
|
+
import * as TSL from "three/tsl";
|
|
4
|
+
const componentDefinition = {
|
|
5
|
+
name: "RadialGradient",
|
|
6
|
+
category: "Base Layers",
|
|
7
|
+
description: "Radial gradient radiating from a center point",
|
|
8
|
+
acceptsUVContext: true,
|
|
9
|
+
props: {
|
|
10
|
+
colorA: {
|
|
11
|
+
default: "#ff0000",
|
|
12
|
+
transform: transformColor,
|
|
13
|
+
description: "The starting color at the center of the gradient",
|
|
14
|
+
ui: {
|
|
15
|
+
type: "color",
|
|
16
|
+
label: "Color A"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
colorB: {
|
|
20
|
+
default: "#0000ff",
|
|
21
|
+
transform: transformColor,
|
|
22
|
+
description: "The ending color at the edge of the gradient",
|
|
23
|
+
ui: {
|
|
24
|
+
type: "color",
|
|
25
|
+
label: "Color B"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
center: {
|
|
29
|
+
default: {
|
|
30
|
+
x: .5,
|
|
31
|
+
y: .5
|
|
32
|
+
},
|
|
33
|
+
transform: transformPosition,
|
|
34
|
+
description: "The center point of the radial gradient",
|
|
35
|
+
ui: {
|
|
36
|
+
type: "position",
|
|
37
|
+
label: "Center"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
radius: {
|
|
41
|
+
default: 1,
|
|
42
|
+
description: "The radius of the gradient (normalized, 0.0-1.0)",
|
|
43
|
+
ui: {
|
|
44
|
+
type: "range",
|
|
45
|
+
min: 0,
|
|
46
|
+
max: 2,
|
|
47
|
+
step: .01,
|
|
48
|
+
label: "Radius"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
colorSpace: {
|
|
52
|
+
default: "linear",
|
|
53
|
+
transform: transformColorSpace,
|
|
54
|
+
description: "Color space for color interpolation",
|
|
55
|
+
ui: {
|
|
56
|
+
type: "select",
|
|
57
|
+
options: colorSpaceOptions,
|
|
58
|
+
label: "Color Space"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
fragmentNode: ({ uniforms, uvContext }) => {
|
|
63
|
+
const { vec2: vec2$1, float: float$1, distance, screenUV: screenUV$1, viewportSize: viewportSize$1 } = TSL;
|
|
64
|
+
const uv = uvContext ?? screenUV$1;
|
|
65
|
+
const aspect = viewportSize$1.x.div(viewportSize$1.y);
|
|
66
|
+
const t = distance(vec2$1(uv.x.mul(aspect), uv.y), vec2$1(uniforms.center.uniform.x.mul(aspect), uniforms.center.uniform.y.oneMinus())).div(uniforms.radius.uniform).clamp(float$1(0), float$1(1));
|
|
67
|
+
return mixColors(uniforms.colorA.uniform, uniforms.colorB.uniform, t, uniforms.colorSpace.uniform);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var RadialGradient_default = componentDefinition;
|
|
71
|
+
export { componentDefinition as n, RadialGradient_default as t };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { t as applyEdgeHandling } from "./edges-Bn_OIa_h.js";
|
|
2
|
+
import { a as transformEdges, o as transformPosition } from "./transformations-DxfQXZWi.js";
|
|
3
|
+
import * as TSL from "three/tsl";
|
|
4
|
+
const componentDefinition = {
|
|
5
|
+
name: "RectangularCoordinates",
|
|
6
|
+
category: "Distortions",
|
|
7
|
+
description: "Convert polar coordinates back to rectangular space",
|
|
8
|
+
requiresRTT: true,
|
|
9
|
+
requiresChild: true,
|
|
10
|
+
props: {
|
|
11
|
+
center: {
|
|
12
|
+
default: {
|
|
13
|
+
x: .5,
|
|
14
|
+
y: .5
|
|
15
|
+
},
|
|
16
|
+
transform: transformPosition,
|
|
17
|
+
description: "The center point for rectangular coordinate conversion",
|
|
18
|
+
ui: {
|
|
19
|
+
type: "position",
|
|
20
|
+
label: "Center"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
scale: {
|
|
24
|
+
default: 1,
|
|
25
|
+
description: "Scale factor for the rectangular output",
|
|
26
|
+
ui: {
|
|
27
|
+
type: "range",
|
|
28
|
+
min: .1,
|
|
29
|
+
max: 3,
|
|
30
|
+
step: .01,
|
|
31
|
+
label: "Scale"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
intensity: {
|
|
35
|
+
default: 1,
|
|
36
|
+
description: "Blends between original UVs (0) and rectangular coordinates (1)",
|
|
37
|
+
ui: {
|
|
38
|
+
type: "range",
|
|
39
|
+
min: 0,
|
|
40
|
+
max: 1,
|
|
41
|
+
step: .01,
|
|
42
|
+
label: "Intensity"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
edges: {
|
|
46
|
+
default: "transparent",
|
|
47
|
+
description: "How to handle edges when distortion pushes content out of bounds",
|
|
48
|
+
transform: transformEdges,
|
|
49
|
+
ui: {
|
|
50
|
+
type: "select",
|
|
51
|
+
options: [
|
|
52
|
+
{
|
|
53
|
+
label: "Stretch",
|
|
54
|
+
value: "stretch"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
label: "Transparent",
|
|
58
|
+
value: "transparent"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: "Mirror",
|
|
62
|
+
value: "mirror"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
label: "Wrap",
|
|
66
|
+
value: "wrap"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
label: "Edges"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
uvTransformNode: ({ uv, uniforms, viewportSize: viewportSize$1 }) => {
|
|
74
|
+
const { vec2: vec2$1, cos: cos$1, sin: sin$1, PI, mix: mix$1 } = TSL;
|
|
75
|
+
const theta = uv.x.mul(PI.mul(2)).sub(PI);
|
|
76
|
+
const r = uv.y.mul(uniforms.scale.uniform);
|
|
77
|
+
const rectX = r.mul(cos$1(theta));
|
|
78
|
+
const rectY = r.mul(sin$1(theta));
|
|
79
|
+
const aspect = viewportSize$1.x.div(viewportSize$1.y);
|
|
80
|
+
const centerPos = vec2$1(uniforms.center.uniform.x, uniforms.center.uniform.y.oneMinus());
|
|
81
|
+
return mix$1(uv, vec2$1(rectX.div(aspect).add(centerPos.x), rectY.add(centerPos.y)), uniforms.intensity.uniform);
|
|
82
|
+
},
|
|
83
|
+
fragmentNode: ({ uniforms, childNode, onCleanup }) => {
|
|
84
|
+
const { vec2: vec2$1, vec4: vec4$1, cos: cos$1, sin: sin$1, screenUV: screenUV$1, viewportSize: viewportSize$1, convertToTexture: convertToTexture$1, PI, mix: mix$1 } = TSL;
|
|
85
|
+
if (!childNode) return vec4$1(0, 0, 0, 0);
|
|
86
|
+
const childTexture = convertToTexture$1(childNode);
|
|
87
|
+
onCleanup(() => {
|
|
88
|
+
if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
|
|
89
|
+
});
|
|
90
|
+
const theta = screenUV$1.x.mul(PI.mul(2)).sub(PI);
|
|
91
|
+
const r = screenUV$1.y.mul(uniforms.scale.uniform);
|
|
92
|
+
const rectX = r.mul(cos$1(theta));
|
|
93
|
+
const rectY = r.mul(sin$1(theta));
|
|
94
|
+
const aspect = viewportSize$1.x.div(viewportSize$1.y);
|
|
95
|
+
const centerPos = vec2$1(uniforms.center.uniform.x, uniforms.center.uniform.y.oneMinus());
|
|
96
|
+
const blendedUV = mix$1(screenUV$1, vec2$1(rectX.div(aspect).add(centerPos.x), rectY.add(centerPos.y)), uniforms.intensity.uniform);
|
|
97
|
+
return applyEdgeHandling(blendedUV, childTexture.sample(blendedUV), childTexture, uniforms.edges.uniform);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
var RectangularCoordinates_default = componentDefinition;
|
|
101
|
+
export { componentDefinition as n, RectangularCoordinates_default as t };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { t as createAnimatedTime } from "./time-CTJvRUZ4.js";
|
|
2
|
+
import { o as transformPosition, r as transformColor } from "./transformations-DxfQXZWi.js";
|
|
3
|
+
import { t as mixColors } from "./colorMixing-BXiTAqJU.js";
|
|
4
|
+
import * as TSL from "three/tsl";
|
|
5
|
+
const componentDefinition = {
|
|
6
|
+
name: "Ripples",
|
|
7
|
+
category: "Base Layers",
|
|
8
|
+
description: "Concentric animated ripples emanating from a point",
|
|
9
|
+
acceptsUVContext: true,
|
|
10
|
+
props: {
|
|
11
|
+
center: {
|
|
12
|
+
default: {
|
|
13
|
+
x: .5,
|
|
14
|
+
y: .5
|
|
15
|
+
},
|
|
16
|
+
transform: transformPosition,
|
|
17
|
+
description: "The center point where ripples emanate from",
|
|
18
|
+
ui: {
|
|
19
|
+
type: "position",
|
|
20
|
+
label: "Center"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
colorA: {
|
|
24
|
+
default: "#ffffff",
|
|
25
|
+
transform: transformColor,
|
|
26
|
+
description: "Color of the ripple waves",
|
|
27
|
+
ui: {
|
|
28
|
+
type: "color",
|
|
29
|
+
label: "Color A"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
colorB: {
|
|
33
|
+
default: "#000000",
|
|
34
|
+
transform: transformColor,
|
|
35
|
+
description: "Background color between ripples",
|
|
36
|
+
ui: {
|
|
37
|
+
type: "color",
|
|
38
|
+
label: "Color B"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
speed: {
|
|
42
|
+
default: 1,
|
|
43
|
+
description: "Speed of ripple animation",
|
|
44
|
+
ui: {
|
|
45
|
+
type: "range",
|
|
46
|
+
min: -5,
|
|
47
|
+
max: 5,
|
|
48
|
+
step: .1,
|
|
49
|
+
label: "Speed"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
frequency: {
|
|
53
|
+
default: 20,
|
|
54
|
+
description: "Number of ripples/spacing between them",
|
|
55
|
+
ui: {
|
|
56
|
+
type: "range",
|
|
57
|
+
min: 1,
|
|
58
|
+
max: 80,
|
|
59
|
+
step: .1,
|
|
60
|
+
label: "Frequency"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
softness: {
|
|
64
|
+
default: 0,
|
|
65
|
+
description: "Softness of ripple edges",
|
|
66
|
+
ui: {
|
|
67
|
+
type: "range",
|
|
68
|
+
min: 0,
|
|
69
|
+
max: 3,
|
|
70
|
+
step: .01,
|
|
71
|
+
label: "Softness"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
thickness: {
|
|
75
|
+
default: .5,
|
|
76
|
+
description: "Thickness of each ripple band",
|
|
77
|
+
ui: {
|
|
78
|
+
type: "range",
|
|
79
|
+
min: 0,
|
|
80
|
+
max: 1,
|
|
81
|
+
step: .01,
|
|
82
|
+
label: "Thickness"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
phase: {
|
|
86
|
+
default: 0,
|
|
87
|
+
description: "Phase offset for ripple animation",
|
|
88
|
+
ui: {
|
|
89
|
+
type: "range",
|
|
90
|
+
min: 0,
|
|
91
|
+
max: 6.28,
|
|
92
|
+
step: .01,
|
|
93
|
+
label: "Phase"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
fragmentNode: (params) => {
|
|
98
|
+
const { uniforms, uvContext } = params;
|
|
99
|
+
const { vec2: vec2$1, float: float$1, screenUV: screenUV$1, sin: sin$1, distance, viewportSize: viewportSize$1, smoothstep } = TSL;
|
|
100
|
+
const uv = uvContext ?? screenUV$1;
|
|
101
|
+
const center = uniforms.center.uniform;
|
|
102
|
+
const colorA = uniforms.colorA.uniform;
|
|
103
|
+
const colorB = uniforms.colorB.uniform;
|
|
104
|
+
const frequency = uniforms.frequency.uniform;
|
|
105
|
+
const softness = uniforms.softness.uniform;
|
|
106
|
+
const thickness = uniforms.thickness.uniform;
|
|
107
|
+
const phase = uniforms.phase.uniform;
|
|
108
|
+
const aspect = viewportSize$1.x.div(viewportSize$1.y);
|
|
109
|
+
const dist = distance(vec2$1(uv.x.mul(aspect), uv.y), vec2$1(center.x.mul(aspect), center.y.oneMinus()));
|
|
110
|
+
const animTime = createAnimatedTime(params, uniforms.speed);
|
|
111
|
+
const baseWave = sin$1(dist.mul(frequency).sub(animTime).add(phase));
|
|
112
|
+
const thicknessThreshold = thickness.mul(float$1(2)).sub(float$1(1));
|
|
113
|
+
return mixColors(colorB, colorA, smoothstep(thicknessThreshold.add(softness), thicknessThreshold.sub(softness), baseWave), TSL.float(0));
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
var Ripples_default = componentDefinition;
|
|
117
|
+
export { componentDefinition as n, Ripples_default as t };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as TSL from "three/tsl";
|
|
2
|
+
import { saturation } from "three/src/nodes/display/ColorAdjustment";
|
|
3
|
+
const componentDefinition = {
|
|
4
|
+
name: "Saturation",
|
|
5
|
+
category: "Adjustments",
|
|
6
|
+
description: "Adjust color saturation intensity",
|
|
7
|
+
requiresChild: true,
|
|
8
|
+
props: { intensity: {
|
|
9
|
+
default: 1,
|
|
10
|
+
description: "The intensity of the saturation effect (1 being no change)",
|
|
11
|
+
ui: {
|
|
12
|
+
type: "range",
|
|
13
|
+
min: 0,
|
|
14
|
+
max: 3,
|
|
15
|
+
step: .01,
|
|
16
|
+
label: "Intensity"
|
|
17
|
+
}
|
|
18
|
+
} },
|
|
19
|
+
fragmentNode: ({ uniforms, childNode }) => {
|
|
20
|
+
const { vec4: vec4$1 } = TSL;
|
|
21
|
+
if (!childNode) {
|
|
22
|
+
console.error("You must pass a child component into the Saturation shader.");
|
|
23
|
+
return vec4$1(0);
|
|
24
|
+
}
|
|
25
|
+
const sourceColor = childNode || vec4$1(0, 0, 0, 0);
|
|
26
|
+
return vec4$1(saturation(sourceColor.rgb, uniforms.intensity.uniform).rgb, sourceColor.a);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var Saturation_default = componentDefinition;
|
|
30
|
+
export { componentDefinition as n, Saturation_default as t };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { t as createAnimatedTime } from "./time-CTJvRUZ4.js";
|
|
2
|
+
import { r as transformColor } from "./transformations-DxfQXZWi.js";
|
|
3
|
+
import { t as mixColors } from "./colorMixing-BXiTAqJU.js";
|
|
4
|
+
import { clamp, exp, float, mx_noise_float, screenUV, vec2, vec3, viewportSize } from "three/tsl";
|
|
5
|
+
const componentDefinition = {
|
|
6
|
+
name: "SimplexNoise",
|
|
7
|
+
category: "Base Layers",
|
|
8
|
+
description: "Organic noise with animated movement",
|
|
9
|
+
acceptsUVContext: true,
|
|
10
|
+
props: {
|
|
11
|
+
colorA: {
|
|
12
|
+
default: "#ffffff",
|
|
13
|
+
description: "First color",
|
|
14
|
+
transform: transformColor,
|
|
15
|
+
ui: {
|
|
16
|
+
type: "color",
|
|
17
|
+
label: "Color A"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
colorB: {
|
|
21
|
+
default: "#000000",
|
|
22
|
+
description: "Second color",
|
|
23
|
+
transform: transformColor,
|
|
24
|
+
ui: {
|
|
25
|
+
type: "color",
|
|
26
|
+
label: "Color B"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
scale: {
|
|
30
|
+
default: 2,
|
|
31
|
+
description: "Pattern scale (higher = larger patterns)",
|
|
32
|
+
ui: {
|
|
33
|
+
type: "range",
|
|
34
|
+
min: -2,
|
|
35
|
+
max: 5,
|
|
36
|
+
step: .1,
|
|
37
|
+
label: "Scale"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
balance: {
|
|
41
|
+
default: 0,
|
|
42
|
+
description: "Balance between colors (negative = more colorB, positive = more colorA)",
|
|
43
|
+
ui: {
|
|
44
|
+
type: "range",
|
|
45
|
+
min: -1,
|
|
46
|
+
max: 1,
|
|
47
|
+
step: .01,
|
|
48
|
+
label: "Balance"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
contrast: {
|
|
52
|
+
default: 0,
|
|
53
|
+
description: "Pattern contrast (higher = sharper transitions)",
|
|
54
|
+
ui: {
|
|
55
|
+
type: "range",
|
|
56
|
+
min: -2,
|
|
57
|
+
max: 5,
|
|
58
|
+
step: .1,
|
|
59
|
+
label: "Contrast"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
seed: {
|
|
63
|
+
default: 0,
|
|
64
|
+
description: "Random seed for pattern variation",
|
|
65
|
+
ui: {
|
|
66
|
+
type: "range",
|
|
67
|
+
min: 0,
|
|
68
|
+
max: 100,
|
|
69
|
+
step: 1,
|
|
70
|
+
label: "Seed"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
speed: {
|
|
74
|
+
default: 1,
|
|
75
|
+
description: "Animation speed",
|
|
76
|
+
ui: {
|
|
77
|
+
type: "range",
|
|
78
|
+
min: 0,
|
|
79
|
+
max: 5,
|
|
80
|
+
step: .1,
|
|
81
|
+
label: "Speed"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
fragmentNode: (params) => {
|
|
86
|
+
const { uniforms, uvContext } = params;
|
|
87
|
+
const uv = uvContext ?? screenUV;
|
|
88
|
+
const aspect = viewportSize.x.div(viewportSize.y);
|
|
89
|
+
const aspectCorrectedUV = vec2(uv.x.mul(aspect), uv.y);
|
|
90
|
+
const animTime = createAnimatedTime(params, uniforms.speed);
|
|
91
|
+
const pos = aspectCorrectedUV.mul(exp(uniforms.scale.uniform)).add(uniforms.seed.uniform);
|
|
92
|
+
const noise = mx_noise_float(vec3(pos.x, pos.y, animTime.mul(.5)));
|
|
93
|
+
const contrastMultiplier = uniforms.contrast.uniform.add(1);
|
|
94
|
+
const k = clamp(0, 1, noise.mul(contrastMultiplier).add(uniforms.balance.uniform).mul(.5).add(.5));
|
|
95
|
+
return mixColors(uniforms.colorB.uniform, uniforms.colorA.uniform, k, float(0));
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var SimplexNoise_default = componentDefinition;
|
|
99
|
+
export { componentDefinition as n, SimplexNoise_default as t };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { n as transformAngle, o as transformPosition, r as transformColor } from "./transformations-DxfQXZWi.js";
|
|
2
|
+
import * as TSL from "three/tsl";
|
|
3
|
+
const componentDefinition = {
|
|
4
|
+
name: "SineWave",
|
|
5
|
+
category: "Base Layers",
|
|
6
|
+
description: "Animated wave with thickness and softness",
|
|
7
|
+
acceptsUVContext: true,
|
|
8
|
+
props: {
|
|
9
|
+
color: {
|
|
10
|
+
default: "#ffffff",
|
|
11
|
+
transform: transformColor,
|
|
12
|
+
description: "The color of the sine wave",
|
|
13
|
+
ui: {
|
|
14
|
+
type: "color",
|
|
15
|
+
label: "Color"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
amplitude: {
|
|
19
|
+
default: .15,
|
|
20
|
+
description: "The height/amplitude of the sine wave",
|
|
21
|
+
ui: {
|
|
22
|
+
type: "range",
|
|
23
|
+
min: 0,
|
|
24
|
+
max: 1,
|
|
25
|
+
step: .01,
|
|
26
|
+
label: "Amplitude"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
frequency: {
|
|
30
|
+
default: 1,
|
|
31
|
+
description: "The frequency/number of wave cycles",
|
|
32
|
+
ui: {
|
|
33
|
+
type: "range",
|
|
34
|
+
min: .1,
|
|
35
|
+
max: 20,
|
|
36
|
+
step: .1,
|
|
37
|
+
label: "Frequency"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
speed: {
|
|
41
|
+
default: 1,
|
|
42
|
+
description: "The animation speed of the wave",
|
|
43
|
+
ui: {
|
|
44
|
+
type: "range",
|
|
45
|
+
min: -5,
|
|
46
|
+
max: 5,
|
|
47
|
+
step: .1,
|
|
48
|
+
label: "Speed"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
angle: {
|
|
52
|
+
default: 0,
|
|
53
|
+
transform: transformAngle,
|
|
54
|
+
description: "The rotation angle of the wave (in degrees)",
|
|
55
|
+
ui: {
|
|
56
|
+
type: "range",
|
|
57
|
+
min: 0,
|
|
58
|
+
max: 360,
|
|
59
|
+
step: 1,
|
|
60
|
+
label: "Angle"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
position: {
|
|
64
|
+
default: {
|
|
65
|
+
x: .5,
|
|
66
|
+
y: .5
|
|
67
|
+
},
|
|
68
|
+
transform: transformPosition,
|
|
69
|
+
description: "The center position of the wave",
|
|
70
|
+
ui: {
|
|
71
|
+
type: "position",
|
|
72
|
+
label: "Position"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
thickness: {
|
|
76
|
+
default: .2,
|
|
77
|
+
description: "The thickness of the wave line",
|
|
78
|
+
ui: {
|
|
79
|
+
type: "range",
|
|
80
|
+
min: 0,
|
|
81
|
+
max: 2,
|
|
82
|
+
step: .01,
|
|
83
|
+
label: "Thickness"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
softness: {
|
|
87
|
+
default: .4,
|
|
88
|
+
description: "Edge softness of the wave line",
|
|
89
|
+
ui: {
|
|
90
|
+
type: "range",
|
|
91
|
+
min: 0,
|
|
92
|
+
max: 1,
|
|
93
|
+
step: .01,
|
|
94
|
+
label: "Softness"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
fragmentNode: ({ uniforms, uvContext }) => {
|
|
99
|
+
const { vec2: vec2$1, vec4: vec4$1, sin: sin$1, cos: cos$1, abs: abs$1, smoothstep, screenUV: screenUV$1, viewportSize: viewportSize$1, time, radians, PI } = TSL;
|
|
100
|
+
const uv = uvContext ?? screenUV$1;
|
|
101
|
+
const aspect = viewportSize$1.x.div(viewportSize$1.y);
|
|
102
|
+
const aspectCorrectedUV = vec2$1(uv.x.mul(aspect), uv.y);
|
|
103
|
+
const centerPos = vec2$1(uniforms.position.uniform.x.mul(aspect), uniforms.position.uniform.y.oneMinus());
|
|
104
|
+
const centeredUV = aspectCorrectedUV.sub(centerPos);
|
|
105
|
+
const angleRad = radians(uniforms.angle.uniform);
|
|
106
|
+
const cosAngle = cos$1(angleRad);
|
|
107
|
+
const sinAngle = sin$1(angleRad);
|
|
108
|
+
const rotatedX = centeredUV.x.mul(cosAngle).sub(centeredUV.y.mul(sinAngle));
|
|
109
|
+
const rotatedY = centeredUV.x.mul(sinAngle).add(centeredUV.y.mul(cosAngle));
|
|
110
|
+
const animatedTime = time.mul(uniforms.speed.uniform);
|
|
111
|
+
const sineWave = sin$1(rotatedX.mul(uniforms.frequency.uniform).mul(PI.mul(2)).add(animatedTime)).mul(uniforms.amplitude.uniform);
|
|
112
|
+
const distanceFromWave = abs$1(rotatedY.sub(sineWave));
|
|
113
|
+
const halfThickness = uniforms.thickness.uniform.mul(.5);
|
|
114
|
+
const halfSoftness = uniforms.softness.uniform.mul(.5);
|
|
115
|
+
const waveMask = smoothstep(halfThickness.add(halfSoftness), halfThickness.sub(halfSoftness), distanceFromWave);
|
|
116
|
+
return vec4$1(uniforms.color.uniform.rgb, uniforms.color.uniform.a.mul(waveMask));
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
var SineWave_default = componentDefinition;
|
|
120
|
+
export { componentDefinition as n, SineWave_default as t };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { r as transformColor } from "./transformations-DxfQXZWi.js";
|
|
2
|
+
const componentDefinition = {
|
|
3
|
+
name: "SolidColor",
|
|
4
|
+
category: "Base Layers",
|
|
5
|
+
description: "Fill the canvas with a single solid color",
|
|
6
|
+
acceptsUVContext: true,
|
|
7
|
+
props: { color: {
|
|
8
|
+
default: "#5b18ca",
|
|
9
|
+
transform: transformColor,
|
|
10
|
+
description: "The solid color to display",
|
|
11
|
+
ui: {
|
|
12
|
+
type: "color",
|
|
13
|
+
label: "Color"
|
|
14
|
+
}
|
|
15
|
+
} },
|
|
16
|
+
fragmentNode: ({ uniforms }) => {
|
|
17
|
+
return uniforms.color.uniform;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var SolidColor_default = componentDefinition;
|
|
21
|
+
export { componentDefinition as n, SolidColor_default as t };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { o as transformPosition, r as transformColor } from "./transformations-DxfQXZWi.js";
|
|
2
|
+
import * as TSL from "three/tsl";
|
|
3
|
+
const componentDefinition = {
|
|
4
|
+
name: "Spherize",
|
|
5
|
+
category: "Distortions",
|
|
6
|
+
description: "Map content onto a 3D sphere surface with depth distortion",
|
|
7
|
+
requiresRTT: true,
|
|
8
|
+
requiresChild: true,
|
|
9
|
+
props: {
|
|
10
|
+
radius: {
|
|
11
|
+
default: 1,
|
|
12
|
+
description: "Radius of the sphere (1 = half viewport height)",
|
|
13
|
+
ui: {
|
|
14
|
+
type: "range",
|
|
15
|
+
min: .1,
|
|
16
|
+
max: 3,
|
|
17
|
+
step: .01,
|
|
18
|
+
label: "Radius"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
depth: {
|
|
22
|
+
default: 1,
|
|
23
|
+
description: "How much the sphere bulges toward viewer (0 = flat, higher = more bulge)",
|
|
24
|
+
ui: {
|
|
25
|
+
type: "range",
|
|
26
|
+
min: 0,
|
|
27
|
+
max: 3,
|
|
28
|
+
step: .01,
|
|
29
|
+
label: "Depth"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
center: {
|
|
33
|
+
default: {
|
|
34
|
+
x: .5,
|
|
35
|
+
y: .5
|
|
36
|
+
},
|
|
37
|
+
transform: transformPosition,
|
|
38
|
+
description: "The center point of the sphere",
|
|
39
|
+
ui: {
|
|
40
|
+
type: "position",
|
|
41
|
+
label: "Center"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
lightPosition: {
|
|
45
|
+
default: {
|
|
46
|
+
x: .3,
|
|
47
|
+
y: .3
|
|
48
|
+
},
|
|
49
|
+
transform: transformPosition,
|
|
50
|
+
description: "Position of the specular light source",
|
|
51
|
+
ui: {
|
|
52
|
+
type: "position",
|
|
53
|
+
label: "Light Position"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
lightIntensity: {
|
|
57
|
+
default: .5,
|
|
58
|
+
description: "Intensity of the rim light (0 = off)",
|
|
59
|
+
ui: {
|
|
60
|
+
type: "range",
|
|
61
|
+
min: 0,
|
|
62
|
+
max: 1,
|
|
63
|
+
step: .01,
|
|
64
|
+
label: "Light Intensity"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
lightSoftness: {
|
|
68
|
+
default: .5,
|
|
69
|
+
description: "Softness of the rim light falloff (0 = hard edge, 1 = soft glow)",
|
|
70
|
+
ui: {
|
|
71
|
+
type: "range",
|
|
72
|
+
min: 0,
|
|
73
|
+
max: 1,
|
|
74
|
+
step: .01,
|
|
75
|
+
label: "Light Softness"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
lightColor: {
|
|
79
|
+
default: "#ffffff",
|
|
80
|
+
transform: transformColor,
|
|
81
|
+
description: "Color of the specular highlight",
|
|
82
|
+
ui: {
|
|
83
|
+
type: "color",
|
|
84
|
+
label: "Light Color"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
fragmentNode: ({ uniforms, childNode, onCleanup }) => {
|
|
89
|
+
const { vec2: vec2$1, vec3: vec3$1, vec4: vec4$1, float: float$1, screenUV: screenUV$1, convertToTexture: convertToTexture$1, viewportSize: viewportSize$1, sqrt: sqrt$1, max: max$1, smoothstep, pow: pow$1, normalize, dot: dot$1 } = TSL;
|
|
90
|
+
if (!childNode) return vec4$1(0, 0, 0, 0);
|
|
91
|
+
const childTexture = convertToTexture$1(childNode);
|
|
92
|
+
onCleanup(() => {
|
|
93
|
+
if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
|
|
94
|
+
});
|
|
95
|
+
const uv = screenUV$1;
|
|
96
|
+
const aspect = viewportSize$1.x.div(viewportSize$1.y);
|
|
97
|
+
const centerPos = vec2$1(uniforms.center.uniform.x, uniforms.center.uniform.y.oneMinus());
|
|
98
|
+
const radius = uniforms.radius.uniform;
|
|
99
|
+
const sphereUV = vec2$1(uv.x.sub(centerPos.x).mul(aspect), uv.y.sub(centerPos.y)).mul(2).div(radius);
|
|
100
|
+
const radiusSq = sphereUV.x.mul(sphereUV.x).add(sphereUV.y.mul(sphereUV.y));
|
|
101
|
+
const sphereAlpha = float$1(1).sub(smoothstep(float$1(.98), float$1(1), radiusSq));
|
|
102
|
+
const z = sqrt$1(max$1(float$1(0), float$1(1).sub(radiusSq)));
|
|
103
|
+
const depthFactor = float$1(1).add(z.mul(uniforms.depth.uniform));
|
|
104
|
+
const finalUV = sphereUV.div(depthFactor).mul(radius).div(2);
|
|
105
|
+
const transformedUV = vec2$1(finalUV.x.div(aspect).add(centerPos.x), finalUV.y.add(centerPos.y));
|
|
106
|
+
const sampledColor = childTexture.sample(transformedUV);
|
|
107
|
+
const lightPos = vec2$1(uniforms.lightPosition.uniform.x, uniforms.lightPosition.uniform.y.oneMinus());
|
|
108
|
+
const lightIntensity = uniforms.lightIntensity.uniform;
|
|
109
|
+
const lightSoftness = uniforms.lightSoftness.uniform;
|
|
110
|
+
const lightColor = vec3$1(uniforms.lightColor.uniform.x, uniforms.lightColor.uniform.y, uniforms.lightColor.uniform.z);
|
|
111
|
+
const normal = normalize(vec3$1(sphereUV.x, sphereUV.y, z));
|
|
112
|
+
const viewDir = vec3$1(0, 0, 1);
|
|
113
|
+
const fresnelPower = float$1(1).add(float$1(4).mul(float$1(1).sub(lightSoftness)));
|
|
114
|
+
const fresnel = pow$1(float$1(1).sub(max$1(dot$1(normal, viewDir), float$1(0))), fresnelPower);
|
|
115
|
+
const lightDir2D = vec2$1(lightPos.x.sub(float$1(.5)).mul(2), lightPos.y.sub(float$1(.5)).mul(2));
|
|
116
|
+
const normalDir = normalize(vec2$1(normal.x, normal.y).add(vec2$1(1e-4, 1e-4)));
|
|
117
|
+
const lightDirNorm = normalize(lightDir2D.add(vec2$1(1e-4, 1e-4)));
|
|
118
|
+
const directionalBias = pow$1(max$1(float$1(0), dot$1(normalDir, lightDirNorm)), float$1(2));
|
|
119
|
+
const rimLight = fresnel.mul(directionalBias).mul(lightIntensity).mul(float$1(2));
|
|
120
|
+
const finalR = sampledColor.x.add(lightColor.x.mul(rimLight));
|
|
121
|
+
const finalG = sampledColor.y.add(lightColor.y.mul(rimLight));
|
|
122
|
+
const finalB = sampledColor.z.add(lightColor.z.mul(rimLight));
|
|
123
|
+
const finalA = sampledColor.w.mul(sphereAlpha);
|
|
124
|
+
return vec4$1(finalR.mul(finalA), finalG.mul(finalA), finalB.mul(finalA), finalA);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
var Spherize_default = componentDefinition;
|
|
128
|
+
export { componentDefinition as n, Spherize_default as t };
|