@luma.gl/effects 9.2.5 → 9.3.0-alpha.10
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/dist.dev.js +2692 -645
- package/dist/dist.min.js +10 -9
- package/dist/index.cjs +753 -302
- package/dist/index.cjs.map +3 -3
- package/dist/passes/postprocessing/fxaa/fxaa.d.ts +1 -0
- package/dist/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -1
- package/dist/passes/postprocessing/fxaa/fxaa.js +287 -0
- package/dist/passes/postprocessing/fxaa/fxaa.js.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +2 -2
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js +6 -7
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts +2 -2
- package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/denoise.js +32 -24
- package/dist/passes/postprocessing/image-adjust-filters/denoise.js.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts +2 -2
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js +26 -33
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts +2 -2
- package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/noise.js +10 -9
- package/dist/passes/postprocessing/image-adjust-filters/noise.js.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts +2 -2
- package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/sepia.js +12 -11
- package/dist/passes/postprocessing/image-adjust-filters/sepia.js.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts +2 -2
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.js +10 -10
- package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts +2 -2
- package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/vignette.js +11 -15
- package/dist/passes/postprocessing/image-adjust-filters/vignette.js.map +1 -1
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts +3 -3
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.js +36 -18
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.js.map +1 -1
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts +3 -3
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.js +27 -18
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.js.map +1 -1
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts +3 -3
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.js +22 -13
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.js.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts +2 -2
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.js +20 -18
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.js.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts +2 -2
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.js +12 -12
- package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts +3 -3
- package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/edgework.js +85 -14
- package/dist/passes/postprocessing/image-fun-filters/edgework.js.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts +2 -2
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js +35 -23
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/ink.d.ts +2 -2
- package/dist/passes/postprocessing/image-fun-filters/ink.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/ink.js +26 -17
- package/dist/passes/postprocessing/image-fun-filters/ink.js.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts +2 -2
- package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/magnify.js +23 -13
- package/dist/passes/postprocessing/image-fun-filters/magnify.js.map +1 -1
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts +3 -3
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.js +28 -14
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.js.map +1 -1
- package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts +3 -3
- package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-warp-filters/swirl.js +21 -16
- package/dist/passes/postprocessing/image-warp-filters/swirl.js.map +1 -1
- package/dist/passes/postprocessing/image-warp-filters/warp.d.ts +1 -1
- package/dist/passes/postprocessing/image-warp-filters/warp.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-warp-filters/warp.js +9 -4
- package/dist/passes/postprocessing/image-warp-filters/warp.js.map +1 -1
- package/package.json +4 -5
- package/src/passes/postprocessing/fxaa/fxaa.ts +288 -0
- package/src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts +6 -7
- package/src/passes/postprocessing/image-adjust-filters/denoise.ts +34 -26
- package/src/passes/postprocessing/image-adjust-filters/huesaturation.ts +28 -35
- package/src/passes/postprocessing/image-adjust-filters/noise.ts +10 -9
- package/src/passes/postprocessing/image-adjust-filters/sepia.ts +12 -11
- package/src/passes/postprocessing/image-adjust-filters/vibrance.ts +10 -10
- package/src/passes/postprocessing/image-adjust-filters/vignette.ts +11 -15
- package/src/passes/postprocessing/image-blur-filters/tiltshift.ts +38 -20
- package/src/passes/postprocessing/image-blur-filters/triangleblur.ts +27 -18
- package/src/passes/postprocessing/image-blur-filters/zoomblur.ts +23 -14
- package/src/passes/postprocessing/image-fun-filters/colorhalftone.ts +20 -18
- package/src/passes/postprocessing/image-fun-filters/dotscreen.ts +12 -12
- package/src/passes/postprocessing/image-fun-filters/edgework.ts +86 -15
- package/src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts +39 -27
- package/src/passes/postprocessing/image-fun-filters/ink.ts +26 -17
- package/src/passes/postprocessing/image-fun-filters/magnify.ts +23 -13
- package/src/passes/postprocessing/image-warp-filters/bulgepinch.ts +28 -14
- package/src/passes/postprocessing/image-warp-filters/swirl.ts +21 -16
- package/src/passes/postprocessing/image-warp-filters/warp.ts +9 -4
|
@@ -3,36 +3,45 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
import { random } from '@luma.gl/shadertools';
|
|
5
5
|
const source = /* wgsl */ `
|
|
6
|
-
|
|
6
|
+
struct zoomBlurUniforms {
|
|
7
7
|
center: vec2f,
|
|
8
8
|
strength: f32,
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
@group(0) @binding(
|
|
11
|
+
@group(0) @binding(auto) var<uniform> zoomBlur : zoomBlurUniforms;
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
fn zoomBlur_sampleColor(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
fn zoomBlur_sampleColor(
|
|
15
|
+
sourceTexture: texture_2d<f32>,
|
|
16
|
+
sourceTextureSampler: sampler,
|
|
17
|
+
texSize: vec2f,
|
|
18
|
+
texCoord: vec2f
|
|
19
|
+
) -> vec4f {
|
|
20
|
+
var color = vec4f(0.0);
|
|
21
|
+
var total = 0.0;
|
|
22
|
+
let toCenter = zoomBlur.center * texSize - texCoord * texSize;
|
|
18
23
|
|
|
19
24
|
/* randomize the lookup values to hide the fixed number of samples */
|
|
20
|
-
|
|
25
|
+
let offset = random(vec3f(12.9898, 78.233, 151.7182), 0.0);
|
|
21
26
|
|
|
22
|
-
for (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
for (var t = 0.0; t <= 40.0; t += 1.0) {
|
|
28
|
+
let percent = (t + offset) / 40.0;
|
|
29
|
+
let weight = 4.0 * (percent - percent * percent);
|
|
30
|
+
let offsetColor = textureSample(
|
|
31
|
+
sourceTexture,
|
|
32
|
+
sourceTextureSampler,
|
|
33
|
+
texCoord + toCenter * percent * zoomBlur.strength / texSize
|
|
34
|
+
);
|
|
26
35
|
color += offsetColor * weight;
|
|
27
36
|
total += weight;
|
|
28
37
|
}
|
|
29
38
|
|
|
30
|
-
color
|
|
39
|
+
color /= total;
|
|
31
40
|
return color;
|
|
32
41
|
}
|
|
33
42
|
`;
|
|
34
43
|
const fs = /* glsl */ `
|
|
35
|
-
uniform zoomBlurUniforms {
|
|
44
|
+
layout(std140) uniform zoomBlurUniforms {
|
|
36
45
|
vec2 center;
|
|
37
46
|
float strength;
|
|
38
47
|
} zoomBlur;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zoomblur.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-blur-filters/zoomblur.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,MAAM,EAAC,MAAM,sBAAsB,CAAC;AAE5C,MAAM,MAAM,GAAG,UAAU,CAAC
|
|
1
|
+
{"version":3,"file":"zoomblur.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-blur-filters/zoomblur.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,MAAM,EAAC,MAAM,sBAAsB,CAAC;AAE5C,MAAM,MAAM,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCzB,CAAC;AAEF,MAAM,EAAE,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;CAyBrB,CAAC;AAcF;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,UAAU;IAChB,YAAY,EAAE,CAAC,MAAM,CAAC;IACtB,MAAM;IACN,EAAE;IAEF,KAAK,EAAE,EAAmB;IAC1B,QAAQ,EAAE,EAAsB;IAChC,YAAY,EAAE;QACZ,MAAM,EAAE,WAAW;QACnB,QAAQ,EAAE,KAAK;KAChB;IACD,SAAS,EAAE;QACT,MAAM,EAAE,EAAC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAC;QAC3B,QAAQ,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAC;KAC3C;IAED,MAAM,EAAE,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;CACkC,CAAC"}
|
|
@@ -21,8 +21,8 @@ export type ColorHalftoneUniforms = ColorHalftoneProps;
|
|
|
21
21
|
*/
|
|
22
22
|
export declare const colorHalftone: {
|
|
23
23
|
readonly name: "colorHalftone";
|
|
24
|
-
readonly source: "struct colorHalftoneUniforms {\n center: vec2f,\n angle: f32,\n size: f32
|
|
25
|
-
readonly fs: "uniform colorHalftoneUniforms {\n vec2 center;\n float angle;\n float size;\n} colorHalftone;\n\nfloat pattern(float angle, float scale, vec2 texSize, vec2 texCoord) {\n float s = sin(angle), c = cos(angle);\n vec2 tex = texCoord * texSize - colorHalftone.center * texSize;\n vec2 point = vec2(\n\tc * tex.x - s * tex.y,\n\ts * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvec4 colorHalftone_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n float scale = 3.1514 / colorHalftone.size;\n vec3 cmy = 1.0 - color.rgb;\n float k = min(cmy.x, min(cmy.y, cmy.z));\n\n cmy = (cmy - k) / (1.0 - k);\n cmy = clamp(\n\t cmy * 10.0 - 3.0 + vec3(\n pattern(colorHalftone.angle + 0.26179, scale, texSize, texCoord),\n\t pattern(colorHalftone.angle + 1.30899, scale, texSize, texCoord),\n pattern(colorHalftone.angle, scale, texSize, texCoord)\n ),\n\t 0.0,\n\t 1.0\n );\n k = clamp(k * 10.0 - 5.0 + pattern(colorHalftone.angle + 0.78539, scale, texSize, texCoord), 0.0, 1.0);\n return vec4(1.0 - cmy - k, color.a);\n}\n";
|
|
24
|
+
readonly source: "struct colorHalftoneUniforms {\n center: vec2f,\n angle: f32,\n size: f32,\n};\n\n@group(0) @binding(auto) var<uniform> colorHalftone: colorHalftoneUniforms;\n\nfn pattern(angle: f32, scale: f32, texSize: vec2f, texCoord: vec2f) -> f32 {\n let s = sin(angle);\n let c = cos(angle);\n let tex = texCoord * texSize - colorHalftone.center * texSize;\n let point = vec2f(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nfn colorHalftone_filterColor_ext(color: vec4f, texSize: vec2f, texCoord: vec2f) -> vec4f {\n let scale = 3.1514 / colorHalftone.size;\n var cmy = vec3f(1.0) - color.rgb;\n var k = min(cmy.x, min(cmy.y, cmy.z));\n let safeDenominator = max(1.0 - k, 0.00001);\n\n cmy = (cmy - vec3f(k)) / safeDenominator;\n cmy = clamp(\n cmy * 10.0 - vec3f(3.0) + vec3f(\n pattern(colorHalftone.angle + 0.26179, scale, texSize, texCoord),\n pattern(colorHalftone.angle + 1.30899, scale, texSize, texCoord),\n pattern(colorHalftone.angle, scale, texSize, texCoord)\n ),\n vec3f(0.0),\n vec3f(1.0)\n );\n k = clamp(k * 10.0 - 5.0 + pattern(colorHalftone.angle + 0.78539, scale, texSize, texCoord), 0.0, 1.0);\n return vec4f(vec3f(1.0) - cmy - vec3f(k), color.a);\n}\n";
|
|
25
|
+
readonly fs: "layout(std140) uniform colorHalftoneUniforms {\n vec2 center;\n float angle;\n float size;\n} colorHalftone;\n\nfloat pattern(float angle, float scale, vec2 texSize, vec2 texCoord) {\n float s = sin(angle), c = cos(angle);\n vec2 tex = texCoord * texSize - colorHalftone.center * texSize;\n vec2 point = vec2(\n\tc * tex.x - s * tex.y,\n\ts * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvec4 colorHalftone_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n float scale = 3.1514 / colorHalftone.size;\n vec3 cmy = 1.0 - color.rgb;\n float k = min(cmy.x, min(cmy.y, cmy.z));\n\n cmy = (cmy - k) / (1.0 - k);\n cmy = clamp(\n\t cmy * 10.0 - 3.0 + vec3(\n pattern(colorHalftone.angle + 0.26179, scale, texSize, texCoord),\n\t pattern(colorHalftone.angle + 1.30899, scale, texSize, texCoord),\n pattern(colorHalftone.angle, scale, texSize, texCoord)\n ),\n\t 0.0,\n\t 1.0\n );\n k = clamp(k * 10.0 - 5.0 + pattern(colorHalftone.angle + 0.78539, scale, texSize, texCoord), 0.0, 1.0);\n return vec4(1.0 - cmy - k, color.a);\n}\n";
|
|
26
26
|
readonly props: ColorHalftoneProps;
|
|
27
27
|
readonly uniforms: ColorHalftoneUniforms;
|
|
28
28
|
readonly uniformTypes: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorhalftone.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/colorhalftone.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"colorhalftone.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/colorhalftone.ts"],"names":[],"mappings":"AAqFA;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gDAAgD;IAChD,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,aAAa;;;;oBAKX,kBAAkB;uBACf,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;CAagC,CAAC"}
|
|
@@ -5,43 +5,45 @@ const source = /* wgsl */ `\
|
|
|
5
5
|
struct colorHalftoneUniforms {
|
|
6
6
|
center: vec2f,
|
|
7
7
|
angle: f32,
|
|
8
|
-
size: f32
|
|
8
|
+
size: f32,
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
@group(0) @binding(
|
|
11
|
+
@group(0) @binding(auto) var<uniform> colorHalftone: colorHalftoneUniforms;
|
|
12
12
|
|
|
13
13
|
fn pattern(angle: f32, scale: f32, texSize: vec2f, texCoord: vec2f) -> f32 {
|
|
14
|
-
let s
|
|
15
|
-
let
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
let s = sin(angle);
|
|
15
|
+
let c = cos(angle);
|
|
16
|
+
let tex = texCoord * texSize - colorHalftone.center * texSize;
|
|
17
|
+
let point = vec2f(
|
|
18
|
+
c * tex.x - s * tex.y,
|
|
19
|
+
s * tex.x + c * tex.y
|
|
19
20
|
) * scale;
|
|
20
21
|
return (sin(point.x) * sin(point.y)) * 4.0;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
fn colorHalftone_filterColor_ext(vec4f
|
|
24
|
-
let scale
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
fn colorHalftone_filterColor_ext(color: vec4f, texSize: vec2f, texCoord: vec2f) -> vec4f {
|
|
25
|
+
let scale = 3.1514 / colorHalftone.size;
|
|
26
|
+
var cmy = vec3f(1.0) - color.rgb;
|
|
27
|
+
var k = min(cmy.x, min(cmy.y, cmy.z));
|
|
28
|
+
let safeDenominator = max(1.0 - k, 0.00001);
|
|
27
29
|
|
|
28
|
-
cmy = (cmy - k) /
|
|
30
|
+
cmy = (cmy - vec3f(k)) / safeDenominator;
|
|
29
31
|
cmy = clamp(
|
|
30
|
-
|
|
32
|
+
cmy * 10.0 - vec3f(3.0) + vec3f(
|
|
31
33
|
pattern(colorHalftone.angle + 0.26179, scale, texSize, texCoord),
|
|
32
|
-
|
|
34
|
+
pattern(colorHalftone.angle + 1.30899, scale, texSize, texCoord),
|
|
33
35
|
pattern(colorHalftone.angle, scale, texSize, texCoord)
|
|
34
36
|
),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
vec3f(0.0),
|
|
38
|
+
vec3f(1.0)
|
|
37
39
|
);
|
|
38
40
|
k = clamp(k * 10.0 - 5.0 + pattern(colorHalftone.angle + 0.78539, scale, texSize, texCoord), 0.0, 1.0);
|
|
39
|
-
return
|
|
41
|
+
return vec4f(vec3f(1.0) - cmy - vec3f(k), color.a);
|
|
40
42
|
}
|
|
41
43
|
`;
|
|
42
44
|
// TODO pass texCoord to angle
|
|
43
45
|
const fs = /* glsl */ `\
|
|
44
|
-
uniform colorHalftoneUniforms {
|
|
46
|
+
layout(std140) uniform colorHalftoneUniforms {
|
|
45
47
|
vec2 center;
|
|
46
48
|
float angle;
|
|
47
49
|
float size;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorhalftone.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/colorhalftone.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,MAAM,MAAM,GAAG,UAAU,CAAC
|
|
1
|
+
{"version":3,"file":"colorhalftone.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/colorhalftone.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,MAAM,MAAM,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCzB,CAAC;AAEF,8BAA8B;AAC9B,MAAM,EAAE,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCrB,CAAC;AAmBF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,eAAe;IACrB,MAAM;IACN,EAAE;IAEF,KAAK,EAAE,EAAwB;IAC/B,QAAQ,EAAE,EAA2B;IACrC,YAAY,EAAE;QACZ,MAAM,EAAE,WAAW;QACnB,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,KAAK;KACZ;IACD,SAAS,EAAE;QACT,MAAM,EAAE,EAAC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAC;QAC3B,KAAK,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,EAAC;QACrD,IAAI,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAC;KAClD;IAED,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC;CAC6C,CAAC"}
|
|
@@ -19,8 +19,8 @@ export type DotScreenUniforms = DotScreenProps;
|
|
|
19
19
|
*/
|
|
20
20
|
export declare const dotScreen: {
|
|
21
21
|
readonly name: "dotScreen";
|
|
22
|
-
readonly source: "
|
|
23
|
-
readonly fs: "uniform dotScreenUniforms {\n vec2 center;\n float angle;\n float size;\n} dotScreen;\n\nfloat pattern(vec2 texSize, vec2 texCoord) {\n float scale = 3.1415 / dotScreen.size;\n\n float s = sin(dotScreen.angle), c = cos(dotScreen.angle);\n vec2 tex = texCoord * texSize - dotScreen.center * texSize;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvec4 dotScreen_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n float average = (color.r + color.g + color.b) / 3.0;\n return vec4(vec3(average * 10.0 - 5.0 + pattern(texSize, texCoord)), color.a);\n}\n";
|
|
22
|
+
readonly source: "struct dotScreenUniforms {\n center: vec2f,\n angle: f32,\n size: f32,\n};\n\n@group(0) @binding(auto) var<uniform> dotScreen: dotScreenUniforms;\n\nfn pattern(texSize: vec2f, texCoord: vec2f) -> f32 {\n let scale = 3.1415 / dotScreen.size;\n let s = sin(dotScreen.angle);\n let c = cos(dotScreen.angle);\n let tex = texCoord * texSize - dotScreen.center * texSize;\n let point = vec2f(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nfn dotScreen_filterColor_ext(color: vec4f, texSize: vec2f, texCoord: vec2f) -> vec4f {\n let average = (color.r + color.g + color.b) / 3.0;\n return vec4f(vec3f(average * 10.0 - 5.0 + pattern(texSize, texCoord)), color.a);\n}\n";
|
|
23
|
+
readonly fs: "layout(std140) uniform dotScreenUniforms {\n vec2 center;\n float angle;\n float size;\n} dotScreen;\n\nfloat pattern(vec2 texSize, vec2 texCoord) {\n float scale = 3.1415 / dotScreen.size;\n\n float s = sin(dotScreen.angle), c = cos(dotScreen.angle);\n vec2 tex = texCoord * texSize - dotScreen.center * texSize;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvec4 dotScreen_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n float average = (color.r + color.g + color.b) / 3.0;\n return vec4(vec3(average * 10.0 - 5.0 + pattern(texSize, texCoord)), color.a);\n}\n";
|
|
24
24
|
readonly props: DotScreenProps;
|
|
25
25
|
readonly uniforms: DotScreenUniforms;
|
|
26
26
|
readonly uniformTypes: {
|
|
@@ -2,33 +2,33 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
const source = /* wgsl */ `\
|
|
5
|
-
|
|
5
|
+
struct dotScreenUniforms {
|
|
6
6
|
center: vec2f,
|
|
7
7
|
angle: f32,
|
|
8
8
|
size: f32,
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
@group(0) @binding(
|
|
11
|
+
@group(0) @binding(auto) var<uniform> dotScreen: dotScreenUniforms;
|
|
12
12
|
|
|
13
13
|
fn pattern(texSize: vec2f, texCoord: vec2f) -> f32 {
|
|
14
|
-
let scale
|
|
15
|
-
|
|
16
|
-
let
|
|
17
|
-
tex
|
|
18
|
-
point = vec2f(
|
|
19
|
-
c
|
|
14
|
+
let scale = 3.1415 / dotScreen.size;
|
|
15
|
+
let s = sin(dotScreen.angle);
|
|
16
|
+
let c = cos(dotScreen.angle);
|
|
17
|
+
let tex = texCoord * texSize - dotScreen.center * texSize;
|
|
18
|
+
let point = vec2f(
|
|
19
|
+
c * tex.x - s * tex.y,
|
|
20
20
|
s * tex.x + c * tex.y
|
|
21
21
|
) * scale;
|
|
22
22
|
return (sin(point.x) * sin(point.y)) * 4.0;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
fn dotScreen_filterColor_ext(
|
|
26
|
-
let average
|
|
27
|
-
return
|
|
25
|
+
fn dotScreen_filterColor_ext(color: vec4f, texSize: vec2f, texCoord: vec2f) -> vec4f {
|
|
26
|
+
let average = (color.r + color.g + color.b) / 3.0;
|
|
27
|
+
return vec4f(vec3f(average * 10.0 - 5.0 + pattern(texSize, texCoord)), color.a);
|
|
28
28
|
}
|
|
29
29
|
`;
|
|
30
30
|
const fs = /* glsl */ `\
|
|
31
|
-
uniform dotScreenUniforms {
|
|
31
|
+
layout(std140) uniform dotScreenUniforms {
|
|
32
32
|
vec2 center;
|
|
33
33
|
float angle;
|
|
34
34
|
float size;
|
|
@@ -19,11 +19,11 @@ export declare const edgeWork: {
|
|
|
19
19
|
readonly name: "edgeWork";
|
|
20
20
|
readonly dependencies: [{
|
|
21
21
|
readonly name: "random";
|
|
22
|
-
readonly source: "fn random(scale: vec3f, seed:
|
|
22
|
+
readonly source: "fn random(scale: vec3f, seed: f32) -> f32 {\n return fract(sin(dot(scale + vec3f(seed), vec3f(12.9898, 78.233, 151.7182))) * 43758.5453 + seed);\n}\n";
|
|
23
23
|
readonly fs: "float random(vec3 scale, float seed) {\n /* use the fragment position for a different seed per-pixel */\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n";
|
|
24
24
|
}];
|
|
25
|
-
readonly source: "struct edgeWorkUniforms {\n radius: f32,\n
|
|
26
|
-
readonly fs: "uniform edgeWorkUniforms {\n float radius;\n int mode;\n} edgeWork;\n\nvec4 edgeWork_sampleColorRGB(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {\n vec2 relativeDelta = edgeWork.radius * delta / texSize;\n\n vec2 color = vec2(0.0);\n vec2 total = vec2(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec3 sampleColor = texture(source, texCoord + relativeDelta * percent).rgb;\n float average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;\n color.x += average * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += average * weight;\n total.y += weight;\n }\n }\n return vec4(color / total, 0.0, 1.0);\n}\n\nvec4 edgeWork_sampleColorXY(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {\n vec2 relativeDelta = edgeWork.radius * delta / texSize;\n\n vec2 color = vec2(0.0);\n vec2 total = vec2(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec2 sampleColor = texture(source, texCoord + relativeDelta * percent).xy;\n color.x += sampleColor.x * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += sampleColor.y * weight;\n total.y += weight;\n }\n }\n float c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);\n return vec4(c, c, c, 1.0);\n}\n\nvec4 edgeWork_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n switch (edgeWork.mode) {\n case 0: \n return edgeWork_sampleColorRGB(source, texSize, texCoord, vec2(1., 0.));\n case 1: \n default:\n return edgeWork_sampleColorXY(source, texSize, texCoord, vec2(0., 1.));\n }\n}\n";
|
|
25
|
+
readonly source: "struct edgeWorkUniforms {\n radius: f32,\n mode: u32,\n};\n\n@group(0) @binding(auto) var<uniform> edgeWork: edgeWorkUniforms;\n\nfn edgeWork_sampleColorRGB(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f,\n delta: vec2f\n) -> vec4f {\n let relativeDelta = edgeWork.radius * delta / texSize;\n\n var color = vec2f(0.0);\n var total = vec2f(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n let offset = random(vec3f(12.9898, 78.233, 151.7182), 0.0);\n\n for (var t = -30.0; t <= 30.0; t += 1.0) {\n let percent = (t + offset - 0.5) / 30.0;\n var weight = 1.0 - abs(percent);\n let sampleColor = textureSample(\n sourceTexture,\n sourceTextureSampler,\n texCoord + relativeDelta * percent\n ).rgb;\n let average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;\n color.x += average * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += average * weight;\n total.y += weight;\n }\n }\n return vec4f(color / total, 0.0, 1.0);\n}\n\nfn edgeWork_sampleColorXY(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f,\n delta: vec2f\n) -> vec4f {\n let relativeDelta = edgeWork.radius * delta / texSize;\n\n var color = vec2f(0.0);\n var total = vec2f(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n let offset = random(vec3f(12.9898, 78.233, 151.7182), 0.0);\n\n for (var t = -30.0; t <= 30.0; t += 1.0) {\n let percent = (t + offset - 0.5) / 30.0;\n var weight = 1.0 - abs(percent);\n let sampleColor = textureSample(\n sourceTexture,\n sourceTextureSampler,\n texCoord + relativeDelta * percent\n ).xy;\n color.x += sampleColor.x * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += sampleColor.y * weight;\n total.y += weight;\n }\n }\n\n let c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);\n return vec4f(c, c, c, 1.0);\n}\n\nfn edgeWork_sampleColor(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n if (edgeWork.mode == 0u) {\n return edgeWork_sampleColorRGB(\n sourceTexture,\n sourceTextureSampler,\n texSize,\n texCoord,\n vec2f(1.0, 0.0)\n );\n }\n\n return edgeWork_sampleColorXY(\n sourceTexture,\n sourceTextureSampler,\n texSize,\n texCoord,\n vec2f(0.0, 1.0)\n );\n}\n";
|
|
26
|
+
readonly fs: "layout(std140) uniform edgeWorkUniforms {\n float radius;\n int mode;\n} edgeWork;\n\nvec4 edgeWork_sampleColorRGB(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {\n vec2 relativeDelta = edgeWork.radius * delta / texSize;\n\n vec2 color = vec2(0.0);\n vec2 total = vec2(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec3 sampleColor = texture(source, texCoord + relativeDelta * percent).rgb;\n float average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;\n color.x += average * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += average * weight;\n total.y += weight;\n }\n }\n return vec4(color / total, 0.0, 1.0);\n}\n\nvec4 edgeWork_sampleColorXY(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {\n vec2 relativeDelta = edgeWork.radius * delta / texSize;\n\n vec2 color = vec2(0.0);\n vec2 total = vec2(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec2 sampleColor = texture(source, texCoord + relativeDelta * percent).xy;\n color.x += sampleColor.x * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += sampleColor.y * weight;\n total.y += weight;\n }\n }\n float c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);\n return vec4(c, c, c, 1.0);\n}\n\nvec4 edgeWork_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n switch (edgeWork.mode) {\n case 0: \n return edgeWork_sampleColorRGB(source, texSize, texCoord, vec2(1., 0.));\n case 1: \n default:\n return edgeWork_sampleColorXY(source, texSize, texCoord, vec2(0., 1.));\n }\n}\n";
|
|
27
27
|
readonly props: EdgeWorkProps;
|
|
28
28
|
readonly uniforms: EdgeWorkProps;
|
|
29
29
|
readonly uniformTypes: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edgework.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/edgework.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"edgework.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/edgework.ts"],"names":[],"mappings":"AAmLA;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;oBAMN,aAAa;uBACV,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoB8B,CAAC"}
|
|
@@ -5,25 +5,35 @@ import { random } from '@luma.gl/shadertools';
|
|
|
5
5
|
const source = /* wgsl */ `\
|
|
6
6
|
struct edgeWorkUniforms {
|
|
7
7
|
radius: f32,
|
|
8
|
-
|
|
8
|
+
mode: u32,
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
@group(0) @binding(
|
|
11
|
+
@group(0) @binding(auto) var<uniform> edgeWork: edgeWorkUniforms;
|
|
12
12
|
|
|
13
|
-
fn edgeWork_sampleColorRGB(
|
|
14
|
-
|
|
13
|
+
fn edgeWork_sampleColorRGB(
|
|
14
|
+
sourceTexture: texture_2d<f32>,
|
|
15
|
+
sourceTextureSampler: sampler,
|
|
16
|
+
texSize: vec2f,
|
|
17
|
+
texCoord: vec2f,
|
|
18
|
+
delta: vec2f
|
|
19
|
+
) -> vec4f {
|
|
20
|
+
let relativeDelta = edgeWork.radius * delta / texSize;
|
|
15
21
|
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
var color = vec2f(0.0);
|
|
23
|
+
var total = vec2f(0.0);
|
|
18
24
|
|
|
19
25
|
/* randomize the lookup values to hide the fixed number of samples */
|
|
20
|
-
|
|
26
|
+
let offset = random(vec3f(12.9898, 78.233, 151.7182), 0.0);
|
|
21
27
|
|
|
22
|
-
for (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
for (var t = -30.0; t <= 30.0; t += 1.0) {
|
|
29
|
+
let percent = (t + offset - 0.5) / 30.0;
|
|
30
|
+
var weight = 1.0 - abs(percent);
|
|
31
|
+
let sampleColor = textureSample(
|
|
32
|
+
sourceTexture,
|
|
33
|
+
sourceTextureSampler,
|
|
34
|
+
texCoord + relativeDelta * percent
|
|
35
|
+
).rgb;
|
|
36
|
+
let average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;
|
|
27
37
|
color.x += average * weight;
|
|
28
38
|
total.x += weight;
|
|
29
39
|
if (abs(t) < 15.0) {
|
|
@@ -32,11 +42,72 @@ fn edgeWork_sampleColorRGB(sampler2D source, vec2 texSize, vec2 texCoord, vec2 d
|
|
|
32
42
|
total.y += weight;
|
|
33
43
|
}
|
|
34
44
|
}
|
|
35
|
-
return
|
|
45
|
+
return vec4f(color / total, 0.0, 1.0);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
fn edgeWork_sampleColorXY(
|
|
49
|
+
sourceTexture: texture_2d<f32>,
|
|
50
|
+
sourceTextureSampler: sampler,
|
|
51
|
+
texSize: vec2f,
|
|
52
|
+
texCoord: vec2f,
|
|
53
|
+
delta: vec2f
|
|
54
|
+
) -> vec4f {
|
|
55
|
+
let relativeDelta = edgeWork.radius * delta / texSize;
|
|
56
|
+
|
|
57
|
+
var color = vec2f(0.0);
|
|
58
|
+
var total = vec2f(0.0);
|
|
59
|
+
|
|
60
|
+
/* randomize the lookup values to hide the fixed number of samples */
|
|
61
|
+
let offset = random(vec3f(12.9898, 78.233, 151.7182), 0.0);
|
|
62
|
+
|
|
63
|
+
for (var t = -30.0; t <= 30.0; t += 1.0) {
|
|
64
|
+
let percent = (t + offset - 0.5) / 30.0;
|
|
65
|
+
var weight = 1.0 - abs(percent);
|
|
66
|
+
let sampleColor = textureSample(
|
|
67
|
+
sourceTexture,
|
|
68
|
+
sourceTextureSampler,
|
|
69
|
+
texCoord + relativeDelta * percent
|
|
70
|
+
).xy;
|
|
71
|
+
color.x += sampleColor.x * weight;
|
|
72
|
+
total.x += weight;
|
|
73
|
+
if (abs(t) < 15.0) {
|
|
74
|
+
weight = weight * 2.0 - 1.0;
|
|
75
|
+
color.y += sampleColor.y * weight;
|
|
76
|
+
total.y += weight;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
let c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);
|
|
81
|
+
return vec4f(c, c, c, 1.0);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
fn edgeWork_sampleColor(
|
|
85
|
+
sourceTexture: texture_2d<f32>,
|
|
86
|
+
sourceTextureSampler: sampler,
|
|
87
|
+
texSize: vec2f,
|
|
88
|
+
texCoord: vec2f
|
|
89
|
+
) -> vec4f {
|
|
90
|
+
if (edgeWork.mode == 0u) {
|
|
91
|
+
return edgeWork_sampleColorRGB(
|
|
92
|
+
sourceTexture,
|
|
93
|
+
sourceTextureSampler,
|
|
94
|
+
texSize,
|
|
95
|
+
texCoord,
|
|
96
|
+
vec2f(1.0, 0.0)
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return edgeWork_sampleColorXY(
|
|
101
|
+
sourceTexture,
|
|
102
|
+
sourceTextureSampler,
|
|
103
|
+
texSize,
|
|
104
|
+
texCoord,
|
|
105
|
+
vec2f(0.0, 1.0)
|
|
106
|
+
);
|
|
36
107
|
}
|
|
37
108
|
`;
|
|
38
109
|
const fs = /* glsl */ `\
|
|
39
|
-
uniform edgeWorkUniforms {
|
|
110
|
+
layout(std140) uniform edgeWorkUniforms {
|
|
40
111
|
float radius;
|
|
41
112
|
int mode;
|
|
42
113
|
} edgeWork;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edgework.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/edgework.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,MAAM,EAAC,MAAM,sBAAsB,CAAC;AAE5C,MAAM,MAAM,GAAG,UAAU,CAAC
|
|
1
|
+
{"version":3,"file":"edgework.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/edgework.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,MAAM,EAAC,MAAM,sBAAsB,CAAC;AAE5C,MAAM,MAAM,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuGzB,CAAC;AAEF,MAAM,EAAE,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiErB,CAAC;AAgBF;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,UAAU;IAChB,YAAY,EAAE,CAAC,MAAM,CAAC;IACtB,MAAM;IACN,EAAE;IAEF,KAAK,EAAE,EAAmB;IAC1B,QAAQ,EAAE,EAAmB;IAC7B,YAAY,EAAE;QACZ,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,KAAK;KACZ;IACD,SAAS,EAAE;QACT,MAAM,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAC;QACvC,IAAI,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAC;KAChC;IAED,MAAM,EAAE;QACN;YACE,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,EAAC,IAAI,EAAE,CAAC,EAAC;SACpB;QACD;YACE,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,EAAC,IAAI,EAAE,CAAC,EAAC;SACpB;KACF;CAC0D,CAAC"}
|
|
@@ -17,8 +17,8 @@ export type HexagonalPixelateUniforms = HexagonalPixelateProps;
|
|
|
17
17
|
*/
|
|
18
18
|
export declare const hexagonalPixelate: {
|
|
19
19
|
readonly name: "hexagonalPixelate";
|
|
20
|
-
readonly source: "struct hexagonalPixelateUniforms {\n center: vec2f,\n scale: f32,\n};\n\n@group(0) @binding(
|
|
21
|
-
readonly fs: "uniform hexagonalPixelateUniforms {\n vec2 center;\n float scale;\n} hexagonalPixelate;\n\nvec4 hexagonalPixelate_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 tex = (texCoord * texSize - hexagonalPixelate.center * texSize) / hexagonalPixelate.scale;\n tex.y /= 0.866025404;\n tex.x -= tex.y * 0.5;\n\n vec2 a;\n if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {\n a = vec2(floor(tex.x), floor(tex.y));\n }\n else a = vec2(ceil(tex.x), ceil(tex.y));\n vec2 b = vec2(ceil(tex.x), floor(tex.y));\n vec2 c = vec2(floor(tex.x), ceil(tex.y));\n\n vec3 TEX = vec3(tex.x, tex.y, 1.0 - tex.x - tex.y);\n vec3 A = vec3(a.x, a.y, 1.0 - a.x - a.y);\n vec3 B = vec3(b.x, b.y, 1.0 - b.x - b.y);\n vec3 C = vec3(c.x, c.y, 1.0 - c.x - c.y);\n\n float alen = length(TEX - A);\n float blen = length(TEX - B);\n float clen = length(TEX - C);\n\n vec2 choice;\n if (alen < blen) {\n if (alen < clen) choice = a;\n else choice = c;\n } else {\n if (blen < clen) choice = b;\n else choice = c;\n }\n\n choice.x += choice.y * 0.5;\n choice.y *= 0.866025404;\n choice *= hexagonalPixelate.scale / texSize;\n\n return texture(source, choice + hexagonalPixelate.center);\n}\n";
|
|
20
|
+
readonly source: "struct hexagonalPixelateUniforms {\n center: vec2f,\n scale: f32,\n};\n\n@group(0) @binding(auto) var<uniform> hexagonalPixelate: hexagonalPixelateUniforms;\n\nfn hexagonalPixelate_sampleColor(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n var tex = (texCoord * texSize - hexagonalPixelate.center * texSize) / hexagonalPixelate.scale;\n tex.y /= 0.866025404;\n tex.x -= tex.y * 0.5;\n\n var a = vec2f(0.0);\n if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {\n a = vec2f(floor(tex.x), floor(tex.y));\n } else {\n a = vec2f(ceil(tex.x), ceil(tex.y));\n }\n let b = vec2f(ceil(tex.x), floor(tex.y));\n let c = vec2f(floor(tex.x), ceil(tex.y));\n\n let texBarycentric = vec3f(tex.x, tex.y, 1.0 - tex.x - tex.y);\n let aBarycentric = vec3f(a.x, a.y, 1.0 - a.x - a.y);\n let bBarycentric = vec3f(b.x, b.y, 1.0 - b.x - b.y);\n let cBarycentric = vec3f(c.x, c.y, 1.0 - c.x - c.y);\n\n let aLength = length(texBarycentric - aBarycentric);\n let bLength = length(texBarycentric - bBarycentric);\n let cLength = length(texBarycentric - cBarycentric);\n\n var choice = vec2f(0.0);\n if (aLength < bLength) {\n if (aLength < cLength) {\n choice = a;\n } else {\n choice = c;\n }\n } else {\n if (bLength < cLength) {\n choice = b;\n } else {\n choice = c;\n }\n }\n\n choice.x += choice.y * 0.5;\n choice.y *= 0.866025404;\n choice *= hexagonalPixelate.scale / texSize;\n\n return textureSample(sourceTexture, sourceTextureSampler, choice + hexagonalPixelate.center);\n}\n";
|
|
21
|
+
readonly fs: "layout(std140) uniform hexagonalPixelateUniforms {\n vec2 center;\n float scale;\n} hexagonalPixelate;\n\nvec4 hexagonalPixelate_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 tex = (texCoord * texSize - hexagonalPixelate.center * texSize) / hexagonalPixelate.scale;\n tex.y /= 0.866025404;\n tex.x -= tex.y * 0.5;\n\n vec2 a;\n if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {\n a = vec2(floor(tex.x), floor(tex.y));\n }\n else a = vec2(ceil(tex.x), ceil(tex.y));\n vec2 b = vec2(ceil(tex.x), floor(tex.y));\n vec2 c = vec2(floor(tex.x), ceil(tex.y));\n\n vec3 TEX = vec3(tex.x, tex.y, 1.0 - tex.x - tex.y);\n vec3 A = vec3(a.x, a.y, 1.0 - a.x - a.y);\n vec3 B = vec3(b.x, b.y, 1.0 - b.x - b.y);\n vec3 C = vec3(c.x, c.y, 1.0 - c.x - c.y);\n\n float alen = length(TEX - A);\n float blen = length(TEX - B);\n float clen = length(TEX - C);\n\n vec2 choice;\n if (alen < blen) {\n if (alen < clen) choice = a;\n else choice = c;\n } else {\n if (blen < clen) choice = b;\n else choice = c;\n }\n\n choice.x += choice.y * 0.5;\n choice.y *= 0.866025404;\n choice *= hexagonalPixelate.scale / texSize;\n\n return texture(source, choice + hexagonalPixelate.center);\n}\n";
|
|
22
22
|
readonly props: HexagonalPixelateProps;
|
|
23
23
|
readonly uniforms: HexagonalPixelateUniforms;
|
|
24
24
|
readonly uniformTypes: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hexagonalpixelate.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hexagonalpixelate.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts"],"names":[],"mappings":"AA8GA;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,oDAAoD;IACpD,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;oBAKf,sBAAsB;uBACnB,yBAAyB;;;;;;;;;;;;;;;;;;;;CAWoC,CAAC"}
|
|
@@ -7,48 +7,60 @@ struct hexagonalPixelateUniforms {
|
|
|
7
7
|
scale: f32,
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
@group(0) @binding(
|
|
10
|
+
@group(0) @binding(auto) var<uniform> hexagonalPixelate: hexagonalPixelateUniforms;
|
|
11
11
|
|
|
12
|
-
fn hexagonalPixelate_sampleColor(
|
|
13
|
-
|
|
12
|
+
fn hexagonalPixelate_sampleColor(
|
|
13
|
+
sourceTexture: texture_2d<f32>,
|
|
14
|
+
sourceTextureSampler: sampler,
|
|
15
|
+
texSize: vec2f,
|
|
16
|
+
texCoord: vec2f
|
|
17
|
+
) -> vec4f {
|
|
18
|
+
var tex = (texCoord * texSize - hexagonalPixelate.center * texSize) / hexagonalPixelate.scale;
|
|
14
19
|
tex.y /= 0.866025404;
|
|
15
20
|
tex.x -= tex.y * 0.5;
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
var a = vec2f(0.0);
|
|
18
23
|
if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {
|
|
19
|
-
a =
|
|
24
|
+
a = vec2f(floor(tex.x), floor(tex.y));
|
|
25
|
+
} else {
|
|
26
|
+
a = vec2f(ceil(tex.x), ceil(tex.y));
|
|
20
27
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
vec2 c = vec2(floor(tex.x), ceil(tex.y));
|
|
28
|
+
let b = vec2f(ceil(tex.x), floor(tex.y));
|
|
29
|
+
let c = vec2f(floor(tex.x), ceil(tex.y));
|
|
24
30
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
let texBarycentric = vec3f(tex.x, tex.y, 1.0 - tex.x - tex.y);
|
|
32
|
+
let aBarycentric = vec3f(a.x, a.y, 1.0 - a.x - a.y);
|
|
33
|
+
let bBarycentric = vec3f(b.x, b.y, 1.0 - b.x - b.y);
|
|
34
|
+
let cBarycentric = vec3f(c.x, c.y, 1.0 - c.x - c.y);
|
|
29
35
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
let aLength = length(texBarycentric - aBarycentric);
|
|
37
|
+
let bLength = length(texBarycentric - bBarycentric);
|
|
38
|
+
let cLength = length(texBarycentric - cBarycentric);
|
|
33
39
|
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
if (
|
|
37
|
-
|
|
40
|
+
var choice = vec2f(0.0);
|
|
41
|
+
if (aLength < bLength) {
|
|
42
|
+
if (aLength < cLength) {
|
|
43
|
+
choice = a;
|
|
44
|
+
} else {
|
|
45
|
+
choice = c;
|
|
46
|
+
}
|
|
38
47
|
} else {
|
|
39
|
-
if (
|
|
40
|
-
|
|
48
|
+
if (bLength < cLength) {
|
|
49
|
+
choice = b;
|
|
50
|
+
} else {
|
|
51
|
+
choice = c;
|
|
52
|
+
}
|
|
41
53
|
}
|
|
42
54
|
|
|
43
55
|
choice.x += choice.y * 0.5;
|
|
44
56
|
choice.y *= 0.866025404;
|
|
45
57
|
choice *= hexagonalPixelate.scale / texSize;
|
|
46
58
|
|
|
47
|
-
return
|
|
59
|
+
return textureSample(sourceTexture, sourceTextureSampler, choice + hexagonalPixelate.center);
|
|
48
60
|
}
|
|
49
61
|
`;
|
|
50
62
|
const fs = /* glsl */ `\
|
|
51
|
-
uniform hexagonalPixelateUniforms {
|
|
63
|
+
layout(std140) uniform hexagonalPixelateUniforms {
|
|
52
64
|
vec2 center;
|
|
53
65
|
float scale;
|
|
54
66
|
} hexagonalPixelate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hexagonalpixelate.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,MAAM,MAAM,GAAG,UAAU,CAAC
|
|
1
|
+
{"version":3,"file":"hexagonalpixelate.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,MAAM,MAAM,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyDzB,CAAC;AAEF,MAAM,EAAE,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CrB,CAAC;AAgBF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,mBAAmB;IACzB,MAAM;IACN,EAAE;IAEF,KAAK,EAAE,EAA4B;IACnC,QAAQ,EAAE,EAA+B;IACzC,YAAY,EAAE;QACZ,MAAM,EAAE,WAAW;QACnB,KAAK,EAAE,KAAK;KACb;IACD,SAAS,EAAE;QACT,MAAM,EAAE,EAAC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,aAAa,EAAC;QAChD,KAAK,EAAE,EAAC,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAC;KACpD;IAED,MAAM,EAAE,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;CACoD,CAAC"}
|
|
@@ -20,8 +20,8 @@ export type InkUniforms = InkProps;
|
|
|
20
20
|
*/
|
|
21
21
|
export declare const ink: {
|
|
22
22
|
readonly name: "ink";
|
|
23
|
-
readonly source: "
|
|
24
|
-
readonly fs: "uniform inkUniforms {\n float strength;\n} ink;\n\nvec4 ink_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 dx = vec2(1.0 / texSize.x, 0.0);\n vec2 dy = vec2(0.0, 1.0 / texSize.y);\n vec4 color = texture(source, texCoord);\n float bigTotal = 0.0;\n float smallTotal = 0.0;\n vec3 bigAverage = vec3(0.0);\n vec3 smallAverage = vec3(0.0);\n for (float x = -2.0; x <= 2.0; x += 1.0) {\n for (float y = -2.0; y <= 2.0; y += 1.0) {\n vec3 offsetColor = texture(source, texCoord + dx * x + dy * y).rgb;\n bigAverage += offsetColor;\n bigTotal += 1.0;\n if (abs(x) + abs(y) < 2.0) {\n smallAverage += offsetColor;\n smallTotal += 1.0;\n }\n }\n }\n vec3 edge = max(vec3(0.0), bigAverage / bigTotal - smallAverage / smallTotal);\n float power = ink.strength * ink.strength * ink.strength * ink.strength * ink.strength;\n return vec4(color.rgb - dot(edge, edge) * power * 100000.0, color.a);\n}\n";
|
|
23
|
+
readonly source: "struct inkUniforms {\n strength: f32,\n};\n\n@group(0) @binding(auto) var<uniform> ink: inkUniforms;\n\nfn ink_sampleColor(\n sourceTexture: texture_2d<f32>,\n sourceTextureSampler: sampler,\n texSize: vec2f,\n texCoord: vec2f\n) -> vec4f {\n let dx = vec2f(1.0 / texSize.x, 0.0);\n let dy = vec2f(0.0, 1.0 / texSize.y);\n let color = textureSample(sourceTexture, sourceTextureSampler, texCoord);\n var bigTotal = 0.0;\n var smallTotal = 0.0;\n var bigAverage = vec3f(0.0);\n var smallAverage = vec3f(0.0);\n for (var x = -2.0; x <= 2.0; x += 1.0) {\n for (var y = -2.0; y <= 2.0; y += 1.0) {\n let offsetColor = textureSample(\n sourceTexture,\n sourceTextureSampler,\n texCoord + dx * x + dy * y\n ).rgb;\n bigAverage += offsetColor;\n bigTotal += 1.0;\n if (abs(x) + abs(y) < 2.0) {\n smallAverage += offsetColor;\n smallTotal += 1.0;\n }\n }\n }\n let edge = max(vec3f(0.0), bigAverage / bigTotal - smallAverage / smallTotal);\n let power = ink.strength * ink.strength * ink.strength * ink.strength * ink.strength;\n return vec4f(color.rgb - vec3f(dot(edge, edge) * power * 100000.0), color.a);\n}\n";
|
|
24
|
+
readonly fs: "layout(std140) uniform inkUniforms {\n float strength;\n} ink;\n\nvec4 ink_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 dx = vec2(1.0 / texSize.x, 0.0);\n vec2 dy = vec2(0.0, 1.0 / texSize.y);\n vec4 color = texture(source, texCoord);\n float bigTotal = 0.0;\n float smallTotal = 0.0;\n vec3 bigAverage = vec3(0.0);\n vec3 smallAverage = vec3(0.0);\n for (float x = -2.0; x <= 2.0; x += 1.0) {\n for (float y = -2.0; y <= 2.0; y += 1.0) {\n vec3 offsetColor = texture(source, texCoord + dx * x + dy * y).rgb;\n bigAverage += offsetColor;\n bigTotal += 1.0;\n if (abs(x) + abs(y) < 2.0) {\n smallAverage += offsetColor;\n smallTotal += 1.0;\n }\n }\n }\n vec3 edge = max(vec3(0.0), bigAverage / bigTotal - smallAverage / smallTotal);\n float power = ink.strength * ink.strength * ink.strength * ink.strength * ink.strength;\n return vec4(color.rgb - dot(edge, edge) * power * 100000.0, color.a);\n}\n";
|
|
25
25
|
readonly props: InkProps;
|
|
26
26
|
readonly uniforms: InkUniforms;
|
|
27
27
|
readonly uniformTypes: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ink.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/ink.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ink.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/ink.ts"],"names":[],"mappings":"AA6EA;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,GAAG;;;;oBAKD,QAAQ;uBACL,WAAW;;;;;;;;;;;;;;CASsB,CAAC"}
|
|
@@ -2,23 +2,32 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
const source = /* wgsl */ `\
|
|
5
|
-
|
|
5
|
+
struct inkUniforms {
|
|
6
6
|
strength: f32,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
@group(0) @binding(
|
|
9
|
+
@group(0) @binding(auto) var<uniform> ink: inkUniforms;
|
|
10
10
|
|
|
11
|
-
fn ink_sampleColor(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
fn ink_sampleColor(
|
|
12
|
+
sourceTexture: texture_2d<f32>,
|
|
13
|
+
sourceTextureSampler: sampler,
|
|
14
|
+
texSize: vec2f,
|
|
15
|
+
texCoord: vec2f
|
|
16
|
+
) -> vec4f {
|
|
17
|
+
let dx = vec2f(1.0 / texSize.x, 0.0);
|
|
18
|
+
let dy = vec2f(0.0, 1.0 / texSize.y);
|
|
19
|
+
let color = textureSample(sourceTexture, sourceTextureSampler, texCoord);
|
|
20
|
+
var bigTotal = 0.0;
|
|
21
|
+
var smallTotal = 0.0;
|
|
22
|
+
var bigAverage = vec3f(0.0);
|
|
23
|
+
var smallAverage = vec3f(0.0);
|
|
24
|
+
for (var x = -2.0; x <= 2.0; x += 1.0) {
|
|
25
|
+
for (var y = -2.0; y <= 2.0; y += 1.0) {
|
|
26
|
+
let offsetColor = textureSample(
|
|
27
|
+
sourceTexture,
|
|
28
|
+
sourceTextureSampler,
|
|
29
|
+
texCoord + dx * x + dy * y
|
|
30
|
+
).rgb;
|
|
22
31
|
bigAverage += offsetColor;
|
|
23
32
|
bigTotal += 1.0;
|
|
24
33
|
if (abs(x) + abs(y) < 2.0) {
|
|
@@ -27,13 +36,13 @@ fn ink_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) -> vec4f {
|
|
|
27
36
|
}
|
|
28
37
|
}
|
|
29
38
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return
|
|
39
|
+
let edge = max(vec3f(0.0), bigAverage / bigTotal - smallAverage / smallTotal);
|
|
40
|
+
let power = ink.strength * ink.strength * ink.strength * ink.strength * ink.strength;
|
|
41
|
+
return vec4f(color.rgb - vec3f(dot(edge, edge) * power * 100000.0), color.a);
|
|
33
42
|
}
|
|
34
43
|
`;
|
|
35
44
|
const fs = /* glsl */ `\
|
|
36
|
-
uniform inkUniforms {
|
|
45
|
+
layout(std140) uniform inkUniforms {
|
|
37
46
|
float strength;
|
|
38
47
|
} ink;
|
|
39
48
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ink.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/ink.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,MAAM,MAAM,GAAG,UAAU,CAAC
|
|
1
|
+
{"version":3,"file":"ink.js","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/ink.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,MAAM,MAAM,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCzB,CAAC;AAEF,MAAM,EAAE,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BrB,CAAC;AAkBF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,IAAI,EAAE,KAAK;IACX,MAAM;IACN,EAAE;IAEF,KAAK,EAAE,EAAc;IACrB,QAAQ,EAAE,EAAiB;IAC3B,YAAY,EAAE;QACZ,QAAQ,EAAE,KAAK;KAChB;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAC;KAC5C;IAED,MAAM,EAAE,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;CACwB,CAAC"}
|