@kassoulet/cathode 0.0.0-stage → 0.1.1
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/CHANGELOG.md +18 -0
- package/LICENSE +25 -0
- package/README.md +134 -2
- package/assets/crt/CRT Masks/Aperture Grille.png +0 -0
- package/assets/crt/CRT Masks/SX-64.png +0 -0
- package/assets/crt/CRT Masks/Shadow Mask EDP.png +0 -0
- package/assets/crt/CRT Masks/Shadow Mask.png +0 -0
- package/assets/crt/CRT Masks/Slot Mask.png +0 -0
- package/assets/crt/LICENSE +121 -0
- package/assets/crt/Presets/C64 Ultimate HDMI.yml +28 -0
- package/assets/crt/Presets/Cheap and broken TV.yml +27 -0
- package/assets/crt/Presets/Default.yml +28 -0
- package/assets/crt/Presets/SX-64.yml +27 -0
- package/assets/crt/Presets/VICE.yml +28 -0
- package/assets/crt/README.md +3 -0
- package/assets/crt/Shaders/2d-texture.glsl +4 -0
- package/assets/crt/Shaders/crt-adjacent-excitation.glsl +29 -0
- package/assets/crt/Shaders/crt-bezel-reflections.glsl +101 -0
- package/assets/crt/Shaders/crt-calc-bloom.glsl +24 -0
- package/assets/crt/Shaders/crt-curved.glsl +225 -0
- package/assets/crt/Shaders/crt-halation.glsl +35 -0
- package/assets/crt/Shaders/crt-simulation.glsl +175 -0
- package/assets/crt/Shaders/decoder-ntsc.glsl +105 -0
- package/assets/crt/Shaders/decoder-pal.glsl +83 -0
- package/assets/crt/Shaders/decoder-yiq.glsl +25 -0
- package/assets/crt/Shaders/decoder-yuv.glsl +25 -0
- package/assets/crt/Shaders/encoder-c64.glsl +26 -0
- package/assets/crt/Shaders/encoder-raw.glsl +19 -0
- package/assets/crt/Shaders/includes/colorGrade.glsl +25 -0
- package/assets/crt/Shaders/includes/colorSpaces.glsl +63 -0
- package/assets/crt/Shaders/includes/common.glsl +157 -0
- package/assets/crt/Shaders/includes/getMipMapColor.glsl +31 -0
- package/assets/crt/Shaders/includes/getSignal.glsl +95 -0
- package/assets/crt/Shaders/includes/grain.glsl +19 -0
- package/assets/crt/Shaders/includes/jailbars.glsl +11 -0
- package/assets/crt/Shaders/includes/mathDefines.glsl +6 -0
- package/assets/crt/Shaders/includes/overscan.glsl +18 -0
- package/assets/crt/Shaders/includes/verticalRoll.glsl +46 -0
- package/assets/crt/Shaders/lights.glsl +16 -0
- package/assets/crt/Shaders/overlay-dust-layer.glsl +27 -0
- package/assets/crt/Shaders/overlay-dust-particle.glsl +100 -0
- package/assets/crt/Shaders/overlay.glsl +73 -0
- package/assets/crt/Shaders/raw-overscan.glsl +9 -0
- package/assets/crt/reflections.png +0 -0
- package/package.json +64 -4
- package/src/cathode/backends/fast.js +95 -0
- package/src/cathode/backends/gl.js +35 -0
- package/src/cathode/cathode.js +123 -0
- package/src/cathode/presets.js +62 -0
- package/src/cathode/settings.js +56 -0
- package/src/crt.js +583 -0
- package/src/gl.js +313 -0
- package/src/index.d.ts +84 -0
- package/src/index.js +121 -0
- package/src/presets.js +293 -0
- package/src/shaders.js +130 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@kassoulet/cathode`. Format based on [Keep a Changelog](https://keepachangelog.com/), versions follow [SemVer](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.1.1]
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- Default look has no barrel curve and no glass reflection: `Default` preset (`curve: 0`, `reflections: 0`), `new Cathode()` default and `DEFAULTS`.
|
|
11
|
+
|
|
12
|
+
## [0.1.0]
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- `createCRT` / `attach`: WebGL2 multi-pass CRT renderer using the Toddler-Boy/CRTEmulation-Data shaders.
|
|
16
|
+
- `Cathode` API: preset matrix (`Presets.{Simple,Detailed,Exhaustive}.{Clean,Enhance,Degrade}`), grouped settings,
|
|
17
|
+
`gl` and `fast` (Canvas2D) backends, `requestVideoFrameCallback` loop.
|
|
18
|
+
- AC hum bar (`signal.humBar`), TypeScript declarations.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Gautier Portet
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
The CRT shaders, masks, presets and reflection image in assets/crt/ are not
|
|
24
|
+
covered by this licence; they come from Toddler-Boy/CRTEmulation-Data and keep
|
|
25
|
+
their own (CC0) licence, see assets/crt/LICENSE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,135 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @kassoulet/cathode
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
WebGL2 CRT emulation for any `<canvas>`, using the shaders from
|
|
4
|
+
[Toddler-Boy/CRTEmulation-Data](https://github.com/Toddler-Boy/CRTEmulation-Data)
|
|
5
|
+
(curvature, scanlines, shadow masks, bloom, halation, phosphor decay, glass
|
|
6
|
+
reflection, optional PAL/NTSC signal path).
|
|
7
|
+
|
|
8
|
+
Needs WebGL2 with `EXT_color_buffer_float`.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @kassoulet/cathode
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The package is ES modules only, has no runtime dependencies and ships TypeScript types. The shaders, masks and
|
|
17
|
+
presets live in `@kassoulet/cathode/assets/crt/` and are fetched at runtime. By default they are found next to the
|
|
18
|
+
module; when you bundle the library (Vite, webpack...) copy that folder to your static assets and pass its URL:
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
createCRT(canvas, { dataUrl: "/crt/" }); // or new Cathode({ canvas, gl: { dataUrl: "/crt/" } })
|
|
22
|
+
// or from a CDN:
|
|
23
|
+
createCRT(canvas, { dataUrl: "https://cdn.jsdelivr.net/npm/@kassoulet/cathode@0.1.0/assets/crt/" });
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
import { createCRT } from "@kassoulet/cathode";
|
|
28
|
+
|
|
29
|
+
const crt = await createCRT(document.querySelector("canvas"), {
|
|
30
|
+
preset: "Default", // see PRESET_NAMES
|
|
31
|
+
lines: 270, // simulated scanlines
|
|
32
|
+
analog: "off", // "off" | "pal" | "ntsc"
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
function frame(now) {
|
|
36
|
+
crt.render(videoOrCanvasOrImage, now / 1000);
|
|
37
|
+
requestAnimationFrame(frame);
|
|
38
|
+
}
|
|
39
|
+
requestAnimationFrame(frame);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Or let the library drive the loop: `const { crt, stop } = await attach(canvas, video)`.
|
|
43
|
+
|
|
44
|
+
## API
|
|
45
|
+
|
|
46
|
+
- `createCRT(canvas, options)` → `CRT`. Options: `preset`, `lines`, `analog`,
|
|
47
|
+
`aspect`, `autoResize`, `reflection`, `overrides`, `dataUrl`.
|
|
48
|
+
- `crt.render(source, timeSeconds)`: draw one frame.
|
|
49
|
+
- `crt.setPreset(name)`, `setMask(name)`, `setAnalog(mode)`, `setReflection(bool)`,
|
|
50
|
+
`setOptions({ curve, scanlines, mask, vignette, noise, phosphorDecay, ... })`
|
|
51
|
+
(values 0..1).
|
|
52
|
+
- `crt.snapshot()` → PNG data URL, `crt.dispose()`.
|
|
53
|
+
- Exports `PRESET_NAMES`, `MASKS`, `DEFAULT_SETTINGS`.
|
|
54
|
+
|
|
55
|
+
## Data files
|
|
56
|
+
|
|
57
|
+
Shaders, masks and presets are loaded at runtime from `assets/crt/`
|
|
58
|
+
(`dataUrl` overrides the location). In the monorepo they are found at
|
|
59
|
+
`../../assets/crt`; `npm run sync-assets` (run by `prepack`) copies them into
|
|
60
|
+
the package.
|
|
61
|
+
|
|
62
|
+
## Examples
|
|
63
|
+
|
|
64
|
+
Small self-contained pages in [`examples/`](examples/): `image.html` (`createCRT` on a canvas),
|
|
65
|
+
`video.html` (`Cathode` video player), `presets.html` (preset matrix and live settings). Run `npm run demo`, then
|
|
66
|
+
open <http://localhost:8080/js/examples/>.
|
|
67
|
+
|
|
68
|
+
## Interactive demo
|
|
69
|
+
|
|
70
|
+
`npm run demo`, then open <http://localhost:8080/js/examples/demo/> (interactive demo of `createCRT`).
|
|
71
|
+
|
|
72
|
+
## Comparison app
|
|
73
|
+
|
|
74
|
+
`npm install && npm run demo`, then open <http://localhost:8080/js/compare/>.
|
|
75
|
+
It renders the same example image (or an uploaded one) in two panes; each pane
|
|
76
|
+
picks its renderer: `crt-canvas` (this lib's `createCRT`), the
|
|
77
|
+
[`crt-shader`](https://www.npmjs.com/package/crt-shader) npm package, `cathode`
|
|
78
|
+
(YouTube CRT overlay) or lowres `CRT-Lite` / `CRT Deluxe`, or the well-known libretro shaders Lottes, crt-geom, crt-easymode and crt-royale (fetched at runtime from libretro/glsl-shaders at a pinned commit, not vendored; `renderers/libretro.js` is a small `.glslp` runner). The cathode and lowres
|
|
79
|
+
shaders and presets are extracted into `compare/renderers/` (`*-data.js`,
|
|
80
|
+
`lowres-shaders.js`). Every setting of each renderer is exposed, plus PNG export and
|
|
81
|
+
"copy settings" as JSON. Every pane redraws each frame; its meta line shows the
|
|
82
|
+
frame rate and the average frame time in ms (measured after `gl.finish()`, so it
|
|
83
|
+
is GPU work rather than the 60 fps rAF cap). `crt-shader`'s still-image cache is
|
|
84
|
+
bypassed there so its number reflects the shader path too. The example images
|
|
85
|
+
are generated by `compare/images/generate.py`.
|
|
86
|
+
|
|
87
|
+
## Benchmark
|
|
88
|
+
|
|
89
|
+
`/js/benchmark/` runs every comparison renderer at 240p, 480p, 720p, 1080p and
|
|
90
|
+
2160p inputs against 720p, 1080p and 2160p outputs. Each combination gets 3
|
|
91
|
+
warm-up frames, then 3 runs of 5 frames, and the page reports the median frame
|
|
92
|
+
time from `gl.finish()` (2D panes report CPU draw time) plus min/mean/σ and fps.
|
|
93
|
+
Results are shown as a table and as a JSON array (downloadable/copyable, plus a CSV
|
|
94
|
+
export) under `window.benchmark`. It takes several minutes at 2160p.
|
|
95
|
+
|
|
96
|
+
## Cathode API (`src/cathode/`)
|
|
97
|
+
|
|
98
|
+
Full reference: [docs/cathode-api.md](https://github.com/kassoulet/cathode/blob/main/docs/cathode-api.md). Shader comparison: [docs/shader-families.md](https://github.com/kassoulet/cathode/blob/main/docs/shader-families.md).
|
|
99
|
+
|
|
100
|
+
A facade implementing `specs.md`: a preset matrix, grouped settings and swappable backends.
|
|
101
|
+
|
|
102
|
+
```js
|
|
103
|
+
import { Cathode, Presets } from "@kassoulet/cathode";
|
|
104
|
+
const filter = new Cathode({ canvas, preset: Presets.Detailed.Enhance, backend: "gl" });
|
|
105
|
+
filter.attachSource(video); // video, canvas, img, ImageBitmap, OffscreenCanvas
|
|
106
|
+
filter.play();
|
|
107
|
+
filter.configure({ beam: { scanlineIntensity: 0.4 }, phosphor: { type: "shadow-mask" } });
|
|
108
|
+
filter.setPreset(Presets.Exhaustive.Degrade);
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
`Presets.{Simple,Detailed,Exhaustive}.{Clean,Enhance,Degrade}`. Backends: `gl` (the Cathode
|
|
112
|
+
pipeline; falls back to `fast` without WebGL2) and `fast` (Canvas2D: scanlines, vignette,
|
|
113
|
+
chromatic aberration, rounded bezel, hum bar only). `sw` throws: not implemented, nor is the
|
|
114
|
+
Rust crate.Both backends are selectable in the comparison app.
|
|
115
|
+
|
|
116
|
+
## Credits
|
|
117
|
+
|
|
118
|
+
The CRT shaders, masks, presets and reflection image in `assets/crt/` come from
|
|
119
|
+
[Toddler-Boy/CRTEmulation-Data](https://github.com/Toddler-Boy/CRTEmulation-Data)
|
|
120
|
+
(licence in `assets/crt/LICENSE`). Every renderer built on them (Cathode, the
|
|
121
|
+
`Cathode` API, the browser extension) uses those files.
|
|
122
|
+
|
|
123
|
+
## Browser extension
|
|
124
|
+
|
|
125
|
+
`js/extension/` is a Manifest V3 overlay (Chrome and Firefox) that runs `Cathode` on YouTube's player.
|
|
126
|
+
`node js/extension/tools/build.mjs` builds `dist/chrome`, `dist/firefox` and the zips. Alt+C toggles it.
|
|
127
|
+
|
|
128
|
+
## Contributing
|
|
129
|
+
|
|
130
|
+
See [CONTRIBUTING.md](https://github.com/kassoulet/cathode/blob/main/CONTRIBUTING.md). Licence: [MIT](https://github.com/kassoulet/cathode/blob/main/LICENSE) (the shader data in `assets/crt/` is CC0).
|
|
131
|
+
|
|
132
|
+
## Development
|
|
133
|
+
|
|
134
|
+
`prek install` sets up the git hooks (hygiene checks, `node --check`, and a commit-msg hook that rejects
|
|
135
|
+
`Co-authored-by` trailers). CI (`.github/workflows/ci.yml`) runs the same hooks, builds the extension and lints it.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Creative Commons Legal Code
|
|
2
|
+
|
|
3
|
+
CC0 1.0 Universal
|
|
4
|
+
|
|
5
|
+
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
6
|
+
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
7
|
+
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
8
|
+
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
9
|
+
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
10
|
+
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
11
|
+
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
12
|
+
HEREUNDER.
|
|
13
|
+
|
|
14
|
+
Statement of Purpose
|
|
15
|
+
|
|
16
|
+
The laws of most jurisdictions throughout the world automatically confer
|
|
17
|
+
exclusive Copyright and Related Rights (defined below) upon the creator
|
|
18
|
+
and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
19
|
+
authorship and/or a database (each, a "Work").
|
|
20
|
+
|
|
21
|
+
Certain owners wish to permanently relinquish those rights to a Work for
|
|
22
|
+
the purpose of contributing to a commons of creative, cultural and
|
|
23
|
+
scientific works ("Commons") that the public can reliably and without fear
|
|
24
|
+
of later claims of infringement build upon, modify, incorporate in other
|
|
25
|
+
works, reuse and redistribute as freely as possible in any form whatsoever
|
|
26
|
+
and for any purposes, including without limitation commercial purposes.
|
|
27
|
+
These owners may contribute to the Commons to promote the ideal of a free
|
|
28
|
+
culture and the further production of creative, cultural and scientific
|
|
29
|
+
works, or to gain reputation or greater distribution for their Work in
|
|
30
|
+
part through the use and efforts of others.
|
|
31
|
+
|
|
32
|
+
For these and/or other purposes and motivations, and without any
|
|
33
|
+
expectation of additional consideration or compensation, the person
|
|
34
|
+
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
35
|
+
is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
36
|
+
elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
37
|
+
terms, with knowledge of his or her Copyright and Related Rights in the
|
|
38
|
+
Work and the meaning and intended legal effect of CC0 on those rights.
|
|
39
|
+
|
|
40
|
+
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
41
|
+
protected by copyright and related or neighboring rights ("Copyright and
|
|
42
|
+
Related Rights"). Copyright and Related Rights include, but are not
|
|
43
|
+
limited to, the following:
|
|
44
|
+
|
|
45
|
+
i. the right to reproduce, adapt, distribute, perform, display,
|
|
46
|
+
communicate, and translate a Work;
|
|
47
|
+
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
48
|
+
iii. publicity and privacy rights pertaining to a person's image or
|
|
49
|
+
likeness depicted in a Work;
|
|
50
|
+
iv. rights protecting against unfair competition in regards to a Work,
|
|
51
|
+
subject to the limitations in paragraph 4(a), below;
|
|
52
|
+
v. rights protecting the extraction, dissemination, use and reuse of data
|
|
53
|
+
in a Work;
|
|
54
|
+
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
55
|
+
European Parliament and of the Council of 11 March 1996 on the legal
|
|
56
|
+
protection of databases, and under any national implementation
|
|
57
|
+
thereof, including any amended or successor version of such
|
|
58
|
+
directive); and
|
|
59
|
+
vii. other similar, equivalent or corresponding rights throughout the
|
|
60
|
+
world based on applicable law or treaty, and any national
|
|
61
|
+
implementations thereof.
|
|
62
|
+
|
|
63
|
+
2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
64
|
+
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
65
|
+
irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
66
|
+
Affirmer's Copyright and Related Rights and associated claims and causes
|
|
67
|
+
of action, whether now known or unknown (including existing as well as
|
|
68
|
+
future claims and causes of action), in the Work (i) in all territories
|
|
69
|
+
worldwide, (ii) for the maximum duration provided by applicable law or
|
|
70
|
+
treaty (including future time extensions), (iii) in any current or future
|
|
71
|
+
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
72
|
+
including without limitation commercial, advertising or promotional
|
|
73
|
+
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
74
|
+
member of the public at large and to the detriment of Affirmer's heirs and
|
|
75
|
+
successors, fully intending that such Waiver shall not be subject to
|
|
76
|
+
revocation, rescission, cancellation, termination, or any other legal or
|
|
77
|
+
equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
78
|
+
as contemplated by Affirmer's express Statement of Purpose.
|
|
79
|
+
|
|
80
|
+
3. Public License Fallback. Should any part of the Waiver for any reason
|
|
81
|
+
be judged legally invalid or ineffective under applicable law, then the
|
|
82
|
+
Waiver shall be preserved to the maximum extent permitted taking into
|
|
83
|
+
account Affirmer's express Statement of Purpose. In addition, to the
|
|
84
|
+
extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
85
|
+
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
86
|
+
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
87
|
+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
88
|
+
maximum duration provided by applicable law or treaty (including future
|
|
89
|
+
time extensions), (iii) in any current or future medium and for any number
|
|
90
|
+
of copies, and (iv) for any purpose whatsoever, including without
|
|
91
|
+
limitation commercial, advertising or promotional purposes (the
|
|
92
|
+
"License"). The License shall be deemed effective as of the date CC0 was
|
|
93
|
+
applied by Affirmer to the Work. Should any part of the License for any
|
|
94
|
+
reason be judged legally invalid or ineffective under applicable law, such
|
|
95
|
+
partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
96
|
+
of the License, and in such case Affirmer hereby affirms that he or she
|
|
97
|
+
will not (i) exercise any of his or her remaining Copyright and Related
|
|
98
|
+
Rights in the Work or (ii) assert any associated claims and causes of
|
|
99
|
+
action with respect to the Work, in either case contrary to Affirmer's
|
|
100
|
+
express Statement of Purpose.
|
|
101
|
+
|
|
102
|
+
4. Limitations and Disclaimers.
|
|
103
|
+
|
|
104
|
+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
105
|
+
surrendered, licensed or otherwise affected by this document.
|
|
106
|
+
b. Affirmer offers the Work as-is and makes no representations or
|
|
107
|
+
warranties of any kind concerning the Work, express, implied,
|
|
108
|
+
statutory or otherwise, including without limitation warranties of
|
|
109
|
+
title, merchantability, fitness for a particular purpose, non
|
|
110
|
+
infringement, or the absence of latent or other defects, accuracy, or
|
|
111
|
+
the present or absence of errors, whether or not discoverable, all to
|
|
112
|
+
the greatest extent permissible under applicable law.
|
|
113
|
+
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
114
|
+
that may apply to the Work or any use thereof, including without
|
|
115
|
+
limitation any person's Copyright and Related Rights in the Work.
|
|
116
|
+
Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
117
|
+
consents, permissions or other rights required for any use of the
|
|
118
|
+
Work.
|
|
119
|
+
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
120
|
+
party to this document and has no duty or obligation with respect to
|
|
121
|
+
this CC0 or use of the Work.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
crt:
|
|
2
|
+
jailbars: 0
|
|
3
|
+
noise: 0
|
|
4
|
+
sharpening: 0
|
|
5
|
+
luma-blur: 0
|
|
6
|
+
chroma-blur: 0
|
|
7
|
+
crosstalk: 0
|
|
8
|
+
phase: 0
|
|
9
|
+
hannover: 0
|
|
10
|
+
rainbowing: 0
|
|
11
|
+
drift: 0
|
|
12
|
+
curve: 0
|
|
13
|
+
rotation: 0
|
|
14
|
+
bleed: 0
|
|
15
|
+
bleed-red: -100, 0
|
|
16
|
+
bleed-green: 75, -75
|
|
17
|
+
bleed-blue: 75, 75
|
|
18
|
+
convergence: 0
|
|
19
|
+
h-wave: 0
|
|
20
|
+
expansion: 0
|
|
21
|
+
scanlines: 0
|
|
22
|
+
mask: 0
|
|
23
|
+
mask-bitmap: $DATA$/Slot Mask
|
|
24
|
+
phosphor-decay: 70
|
|
25
|
+
vignette: 0
|
|
26
|
+
adjacent: 0
|
|
27
|
+
halation: 0
|
|
28
|
+
ambient: 0
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
crt:
|
|
2
|
+
noise: 12
|
|
3
|
+
sharpening: 38
|
|
4
|
+
luma-blur: 56
|
|
5
|
+
chroma-blur: 48
|
|
6
|
+
crosstalk: 33
|
|
7
|
+
phase: 22.5
|
|
8
|
+
hannover: 73
|
|
9
|
+
rainbowing: 50
|
|
10
|
+
drift: 43
|
|
11
|
+
curve: 33
|
|
12
|
+
rotation: 6
|
|
13
|
+
bleed: 16
|
|
14
|
+
bleed-red: 100, 6
|
|
15
|
+
bleed-green: -100, -3
|
|
16
|
+
bleed-blue: 100, 16
|
|
17
|
+
convergence: 40
|
|
18
|
+
h-wave: 50
|
|
19
|
+
expansion: 100
|
|
20
|
+
scanlines: 35
|
|
21
|
+
mask: 25
|
|
22
|
+
mask-bitmap: $DATA$/Shadow Mask
|
|
23
|
+
phosphor-decay: 40
|
|
24
|
+
vignette: 50
|
|
25
|
+
adjacent: 50
|
|
26
|
+
halation: 50
|
|
27
|
+
ambient: 50
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
crt:
|
|
2
|
+
noise: 10
|
|
3
|
+
sharpening: 30
|
|
4
|
+
luma-blur: 50
|
|
5
|
+
chroma-blur: 50
|
|
6
|
+
crosstalk: 20
|
|
7
|
+
phase: 22.5
|
|
8
|
+
hannover: 90
|
|
9
|
+
rainbowing: 50
|
|
10
|
+
drift: 20
|
|
11
|
+
curve: 0
|
|
12
|
+
rotation: -7
|
|
13
|
+
bleed: 20
|
|
14
|
+
bleed-red: -100, 0
|
|
15
|
+
bleed-green: 75, -75
|
|
16
|
+
bleed-blue: 75, 75
|
|
17
|
+
convergence: 20
|
|
18
|
+
h-wave: 50
|
|
19
|
+
expansion: 50
|
|
20
|
+
scanlines: 35
|
|
21
|
+
mask: 25
|
|
22
|
+
mask-bitmap: $DATA$/Slot Mask
|
|
23
|
+
phosphor-decay: 60
|
|
24
|
+
vignette: 50
|
|
25
|
+
adjacent: 50
|
|
26
|
+
halation: 50
|
|
27
|
+
ambient: 50
|
|
28
|
+
reflections: 0
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
crt:
|
|
2
|
+
noise: 10
|
|
3
|
+
sharpening: 30
|
|
4
|
+
luma-blur: 50
|
|
5
|
+
chroma-blur: 50
|
|
6
|
+
crosstalk: 20
|
|
7
|
+
phase: 22.5
|
|
8
|
+
hannover: 90
|
|
9
|
+
rainbowing: 50
|
|
10
|
+
drift: 20
|
|
11
|
+
curve: 31
|
|
12
|
+
rotation: 4
|
|
13
|
+
bleed: 21
|
|
14
|
+
bleed-red: -100, 0
|
|
15
|
+
bleed-green: 75, -75
|
|
16
|
+
bleed-blue: 75, 75
|
|
17
|
+
convergence: 28
|
|
18
|
+
h-wave: 50
|
|
19
|
+
expansion: 100
|
|
20
|
+
scanlines: 100
|
|
21
|
+
mask: 100
|
|
22
|
+
mask-bitmap: $DATA$/SX-64
|
|
23
|
+
phosphor-decay: 60
|
|
24
|
+
vignette: 50
|
|
25
|
+
adjacent: 50
|
|
26
|
+
halation: 50
|
|
27
|
+
ambient: 50
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
crt:
|
|
2
|
+
jailbars: 0
|
|
3
|
+
noise: 0
|
|
4
|
+
sharpening: 0
|
|
5
|
+
luma-blur: 0
|
|
6
|
+
chroma-blur: 0
|
|
7
|
+
crosstalk: 0
|
|
8
|
+
phase: 22.5
|
|
9
|
+
hannover: 100
|
|
10
|
+
rainbowing: 0
|
|
11
|
+
drift: 0
|
|
12
|
+
curve: 0
|
|
13
|
+
rotation: 0
|
|
14
|
+
bleed: 0
|
|
15
|
+
bleed-red: -100, 0
|
|
16
|
+
bleed-green: 75, -75
|
|
17
|
+
bleed-blue: 75, 75
|
|
18
|
+
convergence: 0
|
|
19
|
+
h-wave: 0
|
|
20
|
+
expansion: 0
|
|
21
|
+
scanlines: 50
|
|
22
|
+
mask: 0
|
|
23
|
+
mask-bitmap: $DATA$/Slot Mask
|
|
24
|
+
phosphor-decay: 70
|
|
25
|
+
vignette: 0
|
|
26
|
+
adjacent: 0
|
|
27
|
+
halation: 0
|
|
28
|
+
ambient: 0
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#include "includes/colorSpaces.glsl"
|
|
2
|
+
#include "includes/getMipMapColor.glsl"
|
|
3
|
+
|
|
4
|
+
uniform float crtAdjacent = 0.5;
|
|
5
|
+
|
|
6
|
+
//-----------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
vec3 adjacentExcitation ( sampler2D tex, vec3 col, vec2 uv )
|
|
9
|
+
{
|
|
10
|
+
// tight radius, slightly oversaturated (beam spillover excites same-color phosphors)
|
|
11
|
+
vec3 adjCol = getMipMapColorJittered ( tex, uv, lodForRadius ( tex, 0.0074 ) );
|
|
12
|
+
float adjLuma = getLinearLuma ( adjCol );
|
|
13
|
+
adjCol = max ( mix ( vec3 ( adjLuma ), adjCol, 1.15 ), 0.0 );
|
|
14
|
+
|
|
15
|
+
float kAdj = crtAdjacent * 0.5;
|
|
16
|
+
|
|
17
|
+
return col * ( 1.0 - kAdj * 0.5 ) + adjCol * kAdj;
|
|
18
|
+
}
|
|
19
|
+
//-----------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
void main ()
|
|
22
|
+
{
|
|
23
|
+
vec3 col = texture ( iChannel0, fragCoord ).rgb;
|
|
24
|
+
|
|
25
|
+
col = adjacentExcitation ( iChannel0, col, fragCoord );
|
|
26
|
+
|
|
27
|
+
fragColor = vec4 ( col, 1.0 );
|
|
28
|
+
}
|
|
29
|
+
//-----------------------------------------------------------------------------
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#include "includes/mathDefines.glsl"
|
|
2
|
+
#include "includes/common.glsl"
|
|
3
|
+
#include "includes/colorGrade.glsl"
|
|
4
|
+
#include "includes/colorSpaces.glsl"
|
|
5
|
+
#include "includes/grain.glsl"
|
|
6
|
+
|
|
7
|
+
//-----------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
vec3 gausBlur ( vec2 uv, float radius )
|
|
10
|
+
{
|
|
11
|
+
const float samples = 8.0;
|
|
12
|
+
|
|
13
|
+
float lod = log2 ( radius * 5.0 );
|
|
14
|
+
vec2 scale = ( vec2 ( samples ) / textureSize ( iChannel0, 0 ).xy ) * radius;
|
|
15
|
+
vec3 col = vec3 ( 0.0 );
|
|
16
|
+
float accum = 0.0;
|
|
17
|
+
|
|
18
|
+
for ( float i = -samples; i <= samples; i++ )
|
|
19
|
+
{
|
|
20
|
+
float weight = exp ( -0.5 * ( i * i ) / ( samples * samples ) );
|
|
21
|
+
vec2 offset = vec2 ( i / samples ) * scale;
|
|
22
|
+
|
|
23
|
+
vec3 clipper = textureLod ( iChannel0, uv + vec2 ( offset.x, 0.0 ), lod ).rgb;
|
|
24
|
+
clipper += textureLod ( iChannel0, uv + vec2 ( 0.0, offset.y ), lod ).rgb;
|
|
25
|
+
|
|
26
|
+
// Compress luma
|
|
27
|
+
float lum = getLinearLuma ( clipper );
|
|
28
|
+
lum *= lum;
|
|
29
|
+
float targetLum = mix ( lum, 1.0 - lum, 0.3 );
|
|
30
|
+
clipper *= targetLum / max ( lum, 0.6 );
|
|
31
|
+
|
|
32
|
+
col += clipper * weight;
|
|
33
|
+
accum += weight;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return col / accum;
|
|
37
|
+
}
|
|
38
|
+
//-----------------------------------------------------------------------------
|
|
39
|
+
|
|
40
|
+
uniform float rflFold = 3.0; // overlap fold multiplier; tune per-overlay
|
|
41
|
+
|
|
42
|
+
vec2 foldOverlap ( vec2 uv )
|
|
43
|
+
{
|
|
44
|
+
float dl = uv.x, dr = 1.0 - uv.x, dt = uv.y, db = 1.0 - uv.y;
|
|
45
|
+
if ( dl > 0.0 && dr > 0.0 && dt > 0.0 && db > 0.0 )
|
|
46
|
+
{
|
|
47
|
+
float mx = min ( dl, dr );
|
|
48
|
+
float my = min ( dt, db );
|
|
49
|
+
if ( mx < my )
|
|
50
|
+
uv.x = ( dl < dr ) ? -dl * rflFold
|
|
51
|
+
: 1.0 + dr * rflFold;
|
|
52
|
+
else
|
|
53
|
+
uv.y = ( dt < db ) ? -dt * rflFold
|
|
54
|
+
: 1.0 + db * rflFold;
|
|
55
|
+
}
|
|
56
|
+
return uv;
|
|
57
|
+
}
|
|
58
|
+
//-----------------------------------------------------------------------------
|
|
59
|
+
|
|
60
|
+
uniform float rflLevel;
|
|
61
|
+
|
|
62
|
+
uniform vec2 rflZoom = vec2 ( 1.0 );
|
|
63
|
+
uniform vec2 rflShift = vec2 ( 0.0 );
|
|
64
|
+
uniform int rflRadius = 2;
|
|
65
|
+
|
|
66
|
+
uniform float ovlGrain = 0.2;
|
|
67
|
+
|
|
68
|
+
void main ()
|
|
69
|
+
{
|
|
70
|
+
// iChannel0 = CRT texture as blur-source
|
|
71
|
+
// iChannel1 = Bezel texture to blend into
|
|
72
|
+
// iChannel2 = 3D LUT for color grading (day to dusk)
|
|
73
|
+
// iChannel3 = 3D LUT for color grading (dusk to night)
|
|
74
|
+
vec4 mask = texture ( iChannel1, fragCoord );
|
|
75
|
+
|
|
76
|
+
if ( mask.a < ( 1.0 / 255.0 ) )
|
|
77
|
+
discard;
|
|
78
|
+
|
|
79
|
+
// Unmultiply alpha
|
|
80
|
+
mask.rgb /= mask.a;
|
|
81
|
+
|
|
82
|
+
// Color grade
|
|
83
|
+
mask.rgb = colorGrade ( mask.rgb, iChannel2, iChannel3 );
|
|
84
|
+
|
|
85
|
+
// Reflection
|
|
86
|
+
vec2 uv = curve ( fragCoord, crtCurve );
|
|
87
|
+
|
|
88
|
+
// Bezel
|
|
89
|
+
uv -= 0.5;
|
|
90
|
+
uv *= rflZoom;
|
|
91
|
+
uv += rflShift;
|
|
92
|
+
uv += 0.5;
|
|
93
|
+
uv = foldOverlap ( uv );
|
|
94
|
+
vec3 col = gausBlur ( uv, rflRadius ) * rflLevel;
|
|
95
|
+
|
|
96
|
+
col += mask.rgb;
|
|
97
|
+
col *= grnGrain ( uvec2 ( fragCoord * iResolution.xy ), ovlGrain );
|
|
98
|
+
|
|
99
|
+
fragColor = vec4 ( col * mask.a, mask.a );
|
|
100
|
+
}
|
|
101
|
+
//-----------------------------------------------------------------------------
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#include "includes/colorSpaces.glsl"
|
|
2
|
+
|
|
3
|
+
uniform float deltaTime = 0.0;
|
|
4
|
+
|
|
5
|
+
//-----------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
void main ()
|
|
8
|
+
{
|
|
9
|
+
ivec2 baseSize = textureSize ( iChannel1, 0 );
|
|
10
|
+
int maxDimension = max ( baseSize.x, baseSize.y );
|
|
11
|
+
int lastLod = int ( floor ( log2 ( float ( maxDimension ) ) ) );
|
|
12
|
+
vec3 avgColor = texelFetch ( iChannel1, ivec2 ( 0 ), lastLod ).rgb;
|
|
13
|
+
|
|
14
|
+
float targetCurrent = dot ( avgColor, vec3 ( 0.39, 0.38, 0.23 ) );
|
|
15
|
+
|
|
16
|
+
const float settleTime = 0.1;
|
|
17
|
+
|
|
18
|
+
float alpha = 1.0 - exp ( -5.0 * deltaTime / settleTime );
|
|
19
|
+
float prevCurrent = texelFetch ( iChannel0, ivec2 ( 0 ), 0 ).r;
|
|
20
|
+
float newCurrent = mix ( prevCurrent, targetCurrent, alpha );
|
|
21
|
+
|
|
22
|
+
fragColor = vec4 ( newCurrent );
|
|
23
|
+
}
|
|
24
|
+
//-----------------------------------------------------------------------------
|