@tinypoly/gpu-renderer 0.2.3 → 0.2.5

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/README.md CHANGED
@@ -199,6 +199,7 @@ Groups only this renderer reads, all on by default except the physical exposure,
199
199
  | `lens.distortion` | `0` | Radial distortion of the camera rays: positive is barrel, negative pincushion. |
200
200
  | `camera.whiteBalance` | `6500` | Kelvin the camera takes as white; `6500` is neutral, lower cools the image. |
201
201
  | `camera.autoExposure` | `false` | Meters the image as a camera in automatic does, the mean of the logarithms of its luminance weighed towards the centre, and exposes it to middle grey: a window or the sky cannot darken the room. Takes the place of `exposure`. |
202
+ | `camera.darkAdaptation` | `0` | How much of a dark scene's darkness the automatic exposure keeps, `0` to `1`. Below an average about three stops under middle grey, it keeps that share of the missing stops, so a night lit by a few lamps stays a night. `0` exposes every scene alike. |
202
203
  | `camera.exposureCompensation` | `0` | Stops over the metered exposure. |
203
204
  | `camera.physicalExposure` | `false` | Exposes from `iso`, `shutterSpeed` and `depthOfField.aperture`, with `exposure` as compensation. |
204
205
  | `camera.iso`, `camera.shutterSpeed` | `100`, `1/125` | Seconds for the shutter. |
@@ -15,6 +15,10 @@ export interface LensEffects {
15
15
  whiteBalance: number[] | null;
16
16
  /** Whether the image is metered and exposed to middle grey before the display transform. */
17
17
  autoExposure: boolean;
18
+ /** The share of a dark scene's darkness the meter keeps, `0` to `1`. */
19
+ darkAdaptation: number;
20
+ /** What the image is multiplied by after the lens, the meter's own exposure aside: the rays are limited against it. */
21
+ exposure: number;
18
22
  }
19
23
  /** The lens effects these settings ask for, or `null` when they ask for none and the pass can be skipped. */
20
24
  export declare function lensEffects(settings: GpuRenderSettings): LensEffects | null;
@@ -1 +1 @@
1
- {"version":3,"file":"lensPass.d.ts","sourceRoot":"","sources":["../src/lensPass.ts"],"names":[],"mappings":"AACA,OAAO,EAA6C,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAclG,uFAAuF;AAC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G,SAAS;IAuHlD,OAAO,CAAC,cAAc;IAQtB,OAAO;CAMR"}
package/dist/lensPass.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createShaderModule } from "./shaderModule.js";
2
- import { NEUTRAL_WHITE_BALANCE, whiteBalanceMatrix } from "./settings.js";
2
+ import { effectiveExposure, NEUTRAL_WHITE_BALANCE, whiteBalanceMatrix } from "./settings.js";
3
3
  import { LENS_WGSL } from "./wgsl/lens.wgsl.js";
4
- const UNIFORM_BYTES = 144;
4
+ const UNIFORM_BYTES = 160;
5
5
  const WORKGROUP = 8;
6
6
  /** Halving stops once a level would be smaller than this on its short side, or after this many levels. */
7
7
  const SMALLEST_LEVEL = 4;
@@ -30,6 +30,8 @@ export function lensEffects(settings) {
30
30
  glareAngle: (Number(glare.rotation) || 0) * Math.PI / 180,
31
31
  whiteBalance: neutral ? null : whiteBalanceMatrix(camera.whiteBalance),
32
32
  autoExposure,
33
+ darkAdaptation: Math.min(1, Math.max(0, Number(camera.darkAdaptation) || 0)),
34
+ exposure: Math.max(effectiveExposure(settings), 0),
33
35
  };
34
36
  }
35
37
  /** Halved levels of the image, the largest first, until one would be too small to be worth filtering. */
@@ -157,6 +159,8 @@ export class LensPass {
157
159
  integers[33] = streak.height;
158
160
  floats[34] = effects.glareAngle;
159
161
  floats[35] = effects.autoExposure ? 1 : 0;
162
+ floats[36] = effects.darkAdaptation;
163
+ floats[37] = effects.exposure;
160
164
  for (let row = 0; row < 3; row++)
161
165
  for (let column = 0; column < 3; column++)
162
166
  floats[20 + row * 4 + column] = white[row * 3 + column];
@@ -191,6 +195,10 @@ export class LensPass {
191
195
  integers[9] = level.height;
192
196
  integers[10] = level.offset;
193
197
  };
198
+ // The meter is one workgroup, whatever the size: dispatched as a single tile of the grid it reads. It goes first,
199
+ // since the rays are limited against the exposure it finds.
200
+ if (effects.autoExposure)
201
+ dispatch(this.meter, { width: 1, height: 1 }, () => { });
194
202
  // The rays are gathered from a level of the same pyramid, so either effect builds it.
195
203
  if (effects.bloom > 0 || effects.glare > 0) {
196
204
  levels.forEach((level, k) => dispatch(this.downsample, level, () => {
@@ -224,9 +232,6 @@ export class LensPass {
224
232
  encoder.copyBufferToBuffer(this.down, 0, this.up, 0, levels[0].width * levels[0].height * 16);
225
233
  }
226
234
  }
227
- // The meter is one workgroup, whatever the size: dispatched as a single tile of the grid it reads.
228
- if (effects.autoExposure)
229
- dispatch(this.meter, { width: 1, height: 1 }, () => { });
230
235
  dispatch(this.composite, { width, height }, () => { });
231
236
  return this.graded;
232
237
  }
@@ -1 +1 @@
1
- {"version":3,"file":"lensPass.js","sourceRoot":"","sources":["../src/lensPass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAA0B,MAAM,eAAe,CAAC;AAClG,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,MAAM,SAAS,GAAG,CAAC,CAAC;AAEpB,0GAA0G;AAC1G,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,UAAU,GAAG,CAAC,CAAC;AAErB,2GAA2G;AAC3G,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAoB/B,6GAA6G;AAC7G,MAAM,UAAU,WAAW,CAAC,QAA2B;IACrD,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC;IAChD,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChF,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE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O;QACL,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACvB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ;YAAE,MAAM,CAAC,OAAO,EAAE,CAAC;QACrD,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IAC3B,CAAC;CACF"}
@@ -83,6 +83,12 @@ export interface GpuRenderSettings extends Omit<RenderSettings, "globalIlluminat
83
83
  autoExposure: boolean;
84
84
  /** Stops added to the metered exposure: positive brightens, as on a camera's dial. */
85
85
  exposureCompensation: number;
86
+ /**
87
+ * How much of a dark scene's darkness the automatic exposure keeps, `0` to `1`. The meter brings any image to
88
+ * middle grey, so a night lit by a few lamps comes out as dusk; below a dim average this keeps that share of the
89
+ * missing stops, as the eye does at night. `0` exposes every scene alike; `1` brightens nothing below that average.
90
+ */
91
+ darkAdaptation: number;
86
92
  iso: number;
87
93
  /** Seconds. */
88
94
  shutterSpeed: number;
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAE5F;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,cAAc,EAAE,oBAAoB,CAAC;IACnF,kBAAkB,EAAE,cAAc,CAAC,oBAAoB,CAAC,GAAG;QACzD;;;WAGG;QACH,eAAe,EAAE,OAAO,CAAC;QACzB,uGAAuG;QACvG,aAAa,EAAE,MAAM,CAAC;QACtB;;;;WAIG;QACH,SAAS,EAAE,OAAO,CAAC;QACnB;;;;WAIG;QACH,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;IACF;;;OAGG;IACH,KAAK,EAAE;QACL,OAAO,EAAE,OAAO,CAAC;QACjB,yFAAyF;QACzF,SAAS,EAAE,MAAM,CAAC;QAClB,uFAAuF;QACvF,MAAM,EAAE,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QAClH,IAAI,EAAE,MAAM,CAAC;QACb,oGAAoG;QACpG,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,qGAAqG;IACrG,KAAK,EAAE;QACL,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,gGAAgG;IAChG,OAAO,EAAE;QACP,yGAAyG;QACzG,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,0GAA0G;AAC1G,MAAM,MAAM,sBAAsB,GAAG;KAClC,CAAC,IAAI,MAAM,iBAAiB,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,SAAS,MAAM,GAChE,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAC7B,iBAAiB,CAAC,CAAC,CAAC;CACzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,iBAAiB,CAqBd,CAAC;AAEvD,6GAA6G;AAC7G,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,EAAE,KAAK,GAAE,sBAA2B,GAAG,iBAAiB,CAE/G;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAK5F;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CASrE;AAmBD,KAAK,MAAM,GAAG,MAAM,EAAE,CAAC;AAsCvB,4FAA4F;AAC5F,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAE1C;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKzD"}
package/dist/settings.js CHANGED
@@ -14,7 +14,7 @@ export const DEFAULT_GPU_RENDER_SETTINGS = Object.freeze(mergeGpuSettings({
14
14
  glare: { enabled: true, intensity: 0.06, blades: 6, length: 0.25, rotation: 15 },
15
15
  lens: { chromaticAberration: 0.05, distortion: 0 },
16
16
  camera: {
17
- contrast: 1, physicalExposure: false, autoExposure: false, exposureCompensation: 0, iso: 100,
17
+ contrast: 1, physicalExposure: false, autoExposure: false, exposureCompensation: 0, darkAdaptation: 0, iso: 100,
18
18
  shutterSpeed: 1 / 125, whiteBalance: 6500,
19
19
  },
20
20
  subsurface: { enabled: true, depth: 2 },
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAuB,MAAM,eAAe,CAAC;AA4I5F;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAgC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CACpG;IACE,GAAG,uBAAuB;IAC1B,kGAAkG;IAClG,WAAW,EAAE,KAAK;IAClB,kBAAkB,EAAE,EAAE,GAAG,uBAAuB,CAAC,kBAAkB,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;QAC1G,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;IAClC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;IACvD,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;IAChF,IAAI,EAAE,EAAE,mBAAmB,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE;IAClD,MAAM,EAAE;QACN,QAAQ,EAAE,CAAC,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG;QAC5F,YAAY,EAAE,CAAC,GAAG,GAAG,EAAE,YAAY,EAAE,IAAI;KAC1C;IACD,UAAU,EAAE,EAA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Q,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7G,CAAC"}
@@ -13,5 +13,5 @@
13
13
  * texel takes the light of the texels behind it along every ray's direction, fading with the distance, with weights
14
14
  * that again sum to one.
15
15
  */
16
- export declare const LENS_WGSL = "\nstruct Lens {\n resolution: vec2<u32>,\n // Whether the colour comes from the denoiser's output rather than straight from the accumulation.\n denoised: u32,\n // Upsampling only: the level read from sits in the downsampled pyramid (the smallest one) instead of the folded one.\n fromDown: u32,\n sourceSize: vec2<u32>,\n // Where the level read from starts in its pyramid; a size of the full resolution reads the image itself.\n sourceOffset: u32,\n // The first downsample reads the image itself, and averages its taps by luminance against fireflies.\n fromImage: u32,\n targetSize: vec2<u32>,\n targetOffset: u32,\n // Where the largest level of the folded pyramid starts, which the composite reads the halo from.\n haloOffset: u32,\n haloSize: vec2<u32>,\n // How much of the light the halo takes, and how much each level takes from the one below it.\n intensity: f32,\n radius: f32,\n // How far red and blue move apart at the corners, as a share of the distance from the centre.\n aberration: f32,\n // How much of the light the aperture's rays take, how many there are, and how far they reach in streak texels.\n glare: f32,\n rays: u32,\n glareLength: f32,\n // The white balance, a linear sRGB matrix, row by row.\n white0: vec4<f32>,\n white1: vec4<f32>,\n white2: vec4<f32>,\n // The size of the level the rays are gathered at, and the angle of the first ray, in radians.\n streakSize: vec2<u32>,\n glareAngle: f32,\n // Whether the camera meters the image and exposes it to middle grey, which the meter pass works out.\n autoExposure: f32,\n};\n\nconst PI: f32 = 3.14159265358979;\n\n/** Taps along each of the aperture's rays. */\nconst STREAK_TAPS: i32 = 24;\n\n@group(0) @binding(0) var<uniform> lens: Lens;\n@group(0) @binding(1) var<storage, read> accumulation: array<vec4<f32>>;\n@group(0) @binding(2) var<storage, read> denoised: array<vec4<f32>>;\n@group(0) @binding(3) var<storage, read_write> down: array<vec4<f32>>;\n@group(0) @binding(4) var<storage, read_write> up: array<vec4<f32>>;\n@group(0) @binding(5) var<storage, read_write> graded: array<vec4<f32>>;\n@group(0) @binding(6) var<storage, read_write> streaked: array<vec4<f32>>;\n// What the camera's meter read: the exposure that brings the image's average to middle grey, in x.\n@group(0) @binding(7) var<storage, read_write> metered: array<vec4<f32>>;\n\n/** What a light meter calibrates to: an average scene reflects about eighteen percent. */\nconst MIDDLE_GREY: f32 = 0.18;\nconst METER_GRID: vec2<u32> = vec2<u32>(64u, 36u);\nconst METER_THREADS: u32 = 256u;\n\n/**\n * How far above middle grey the meter lets the bright end of the image land: three stops, where AgX still shows\n * detail, three and a half under where it reaches white.\n */\nconst HIGHLIGHT_CEILING: f32 = 8.0;\n/** The share of the metered points that counts as the bright end: the light through a window, not a lamp's own pixels. */\nconst HIGHLIGHT_SHARE: f32 = 0.03;\n/** Half stops of luminance, from 2^-16 to 2^16, which the bright end is found in. */\nconst METER_BINS: u32 = 64u;\n\nvar<workgroup> meterSums: array<vec2<f32>, 256>;\nvar<workgroup> meterHistogram: array<atomic<u32>, 64>;\n\n/**\n * The camera's meter: the image's average luminance over a grid of points, taken as the mean of the logarithms so that\n * a bright window or a patch of sky cannot darken everything else, weighed towards the centre as a camera's\n * centre-weighted metering is. What no path has reached yet, or is black, does not count. One workgroup reads the\n * grid and sums it in shared memory.\n *\n * Then it guards the highlights, as a camera's matrix metering does: the average alone takes a dim attic with a shaft\n * of sun in it to middle grey and burns the shaft out, where a photographer keeps the room dim. The brightest few\n * percent of the points, found in a histogram of half stops, may land no more than {@link HIGHLIGHT_CEILING} times\n * brighter; an even scene, whose bright end is close to its average, is left as the average says.\n */\n@compute @workgroup_size(256, 1, 1)\nfn meter(@builtin(local_invocation_index) thread: u32) {\n var sum = vec2<f32>(0.0);\n let count = METER_GRID.x * METER_GRID.y;\n\n if (thread < METER_BINS) {\n atomicStore(&meterHistogram[thread], 0u);\n }\n\n workgroupBarrier();\n\n for (var k = thread; k < count; k = k + METER_THREADS) {\n let cell = vec2<f32>(f32(k % METER_GRID.x), f32(k / METER_GRID.x)) + 0.5;\n let uv = cell / vec2<f32>(METER_GRID);\n let luminance = dot(imageTexel(i32(uv.x * f32(lens.resolution.x)), i32(uv.y * f32(lens.resolution.y))),\n vec3<f32>(0.2126, 0.7152, 0.0722));\n let away = (uv - 0.5) * 2.0;\n let weight = select(0.0, 1.0 - 0.6 * min(dot(away, away) * 0.5, 1.0), luminance > 0.0);\n\n sum = sum + vec2<f32>(log(max(luminance, 1e-6)) * weight, weight);\n\n if (luminance > 0.0) {\n let bin = u32(clamp((log2(luminance) + 16.0) * 2.0, 0.0, f32(METER_BINS - 1u)));\n\n atomicAdd(&meterHistogram[bin], 1u);\n }\n }\n\n meterSums[thread] = sum;\n workgroupBarrier();\n\n for (var stride = METER_THREADS / 2u; stride > 0u; stride = stride / 2u) {\n if (thread < stride) {\n meterSums[thread] = meterSums[thread] + meterSums[thread + stride];\n }\n\n workgroupBarrier();\n }\n\n if (thread == 0u) {\n let total = meterSums[0];\n let average = select(MIDDLE_GREY, exp(total.x / max(total.y, 1e-6)), total.y > 0.0);\n var exposure = MIDDLE_GREY / average;\n\n // From the top down, the first half stop by which the bright share is reached; its upper edge is that end.\n var points = 0u;\n\n for (var bin = 0u; bin < METER_BINS; bin = bin + 1u) {\n points = points + atomicLoad(&meterHistogram[bin]);\n }\n\n var above = 0u;\n var bright = 0.0;\n\n for (var bin = i32(METER_BINS) - 1; bin >= 0 && points > 0u; bin = bin - 1) {\n above = above + atomicLoad(&meterHistogram[u32(bin)]);\n\n if (f32(above) >= HIGHLIGHT_SHARE * f32(points)) {\n bright = exp2(f32(bin + 1) * 0.5 - 16.0);\n break;\n }\n }\n\n if (bright > 0.0) {\n exposure = min(exposure, HIGHLIGHT_CEILING * MIDDLE_GREY / bright);\n }\n\n metered[0] = vec4<f32>(clamp(exposure, 1e-4, 1e4), average, bright, 0.0);\n }\n}\n\n/** The image's own texel: its mean so far, or nothing where no path has landed yet. */\nfn imageTexel(x: i32, y: i32) -> vec3<f32> {\n let size = vec2<i32>(lens.resolution);\n let index = u32(clamp(y, 0, size.y - 1) * size.x + clamp(x, 0, size.x - 1));\n\n if (lens.denoised != 0u) {\n return denoised[index].rgb;\n }\n\n let stored = accumulation[index];\n\n return select(stored.rgb / stored.w, vec3<f32>(0.0), stored.w <= 0.0);\n}\n\nfn downTexel(offset: u32, size: vec2<u32>, x: i32, y: i32) -> vec3<f32> {\n let s = vec2<i32>(size);\n\n return down[offset + u32(clamp(y, 0, s.y - 1) * s.x + clamp(x, 0, s.x - 1))].rgb;\n}\n\nfn upTexel(offset: u32, size: vec2<u32>, x: i32, y: i32) -> vec3<f32> {\n let s = vec2<i32>(size);\n\n return up[offset + u32(clamp(y, 0, s.y - 1) * s.x + clamp(x, 0, s.x - 1))].rgb;\n}\n\n/** Bilinear weights and the texel below and left of a point given in texels, edges clamped. */\nfn bilinearAt(position: vec2<f32>) -> vec4<f32> {\n let p = position - 0.5;\n let base = floor(p);\n\n return vec4<f32>(base, p - base);\n}\n\nfn imageBilinear(position: vec2<f32>) -> vec3<f32> {\n let b = bilinearAt(position);\n let x = i32(b.x);\n let y = i32(b.y);\n\n return mix(\n mix(imageTexel(x, y), imageTexel(x + 1, y), b.z),\n mix(imageTexel(x, y + 1), imageTexel(x + 1, y + 1), b.z), b.w);\n}\n\nfn downBilinear(offset: u32, size: vec2<u32>, position: vec2<f32>) -> vec3<f32> {\n let b = bilinearAt(position);\n let x = i32(b.x);\n let y = i32(b.y);\n\n return mix(\n mix(downTexel(offset, size, x, y), downTexel(offset, size, x + 1, y), b.z),\n mix(downTexel(offset, size, x, y + 1), downTexel(offset, size, x + 1, y + 1), b.z), b.w);\n}\n\nfn upBilinear(offset: u32, size: vec2<u32>, position: vec2<f32>) -> vec3<f32> {\n let b = bilinearAt(position);\n let x = i32(b.x);\n let y = i32(b.y);\n\n return mix(\n mix(upTexel(offset, size, x, y), upTexel(offset, size, x + 1, y), b.z),\n mix(upTexel(offset, size, x, y + 1), upTexel(offset, size, x + 1, y + 1), b.z), b.w);\n}\n\n/** The level being filtered, read bilinearly at a point given in its own texels. */\nfn sourceAt(position: vec2<f32>) -> vec3<f32> {\n if (lens.fromImage != 0u) {\n return imageBilinear(position);\n }\n\n return downBilinear(lens.sourceOffset, lens.sourceSize, position);\n}\n\nfn luminance(color: vec3<f32>) -> f32 {\n return dot(color, vec3<f32>(0.2126, 0.7152, 0.0722));\n}\n\n/** Karis' average: a group of taps weighed by one over one plus its luminance, so a lone firefly cannot flare. */\nfn karis(sum: vec3<f32>) -> vec4<f32> {\n let weight = 1.0 / (1.0 + luminance(sum));\n\n return vec4<f32>(sum * weight, weight);\n}\n\n/** One level of the pyramid from the one above it: Jimenez's 13 taps, four overlapping boxes and a centre one. */\n@compute @workgroup_size(8, 8, 1)\nfn downsample(@builtin(global_invocation_id) id: vec3<u32>) {\n if (id.x >= lens.targetSize.x || id.y >= lens.targetSize.y) {\n return;\n }\n\n let scale = vec2<f32>(lens.sourceSize) / vec2<f32>(lens.targetSize);\n let centre = (vec2<f32>(id.xy) + 0.5) * scale;\n let a = sourceAt(centre + vec2<f32>(-2.0, -2.0));\n let b = sourceAt(centre + vec2<f32>(0.0, -2.0));\n let c = sourceAt(centre + vec2<f32>(2.0, -2.0));\n let d = sourceAt(centre + vec2<f32>(-2.0, 0.0));\n let e = sourceAt(centre);\n let f = sourceAt(centre + vec2<f32>(2.0, 0.0));\n let g = sourceAt(centre + vec2<f32>(-2.0, 2.0));\n let h = sourceAt(centre + vec2<f32>(0.0, 2.0));\n let i = sourceAt(centre + vec2<f32>(2.0, 2.0));\n let j = sourceAt(centre + vec2<f32>(-1.0, -1.0));\n let k = sourceAt(centre + vec2<f32>(1.0, -1.0));\n let l = sourceAt(centre + vec2<f32>(-1.0, 1.0));\n let m = sourceAt(centre + vec2<f32>(1.0, 1.0));\n var result: vec3<f32>;\n\n if (lens.fromImage != 0u) {\n let groups = karis((j + k + l + m) * 0.25) * 0.5\n + karis((a + b + d + e) * 0.25) * 0.125\n + karis((b + c + e + f) * 0.25) * 0.125\n + karis((d + e + g + h) * 0.25) * 0.125\n + karis((e + f + h + i) * 0.25) * 0.125;\n\n result = groups.rgb / max(groups.w, 1e-6);\n } else {\n result = e * 0.125 + (a + c + g + i) * 0.03125 + (b + d + f + h) * 0.0625 + (j + k + l + m) * 0.125;\n }\n\n down[lens.targetOffset + id.y * lens.targetSize.x + id.x] = vec4<f32>(max(result, vec3<f32>(0.0)), 1.0);\n}\n\n/** A 3 x 3 tent over the smaller level, read at a point given in its texels. */\nfn tent(position: vec2<f32>) -> vec3<f32> {\n var sum = vec3<f32>(0.0);\n\n for (var dy = -1; dy <= 1; dy = dy + 1) {\n for (var dx = -1; dx <= 1; dx = dx + 1) {\n let weight = f32((2 - abs(dx)) * (2 - abs(dy))) / 16.0;\n let at = position + vec2<f32>(f32(dx), f32(dy));\n\n if (lens.fromDown != 0u) {\n sum = sum + downBilinear(lens.sourceOffset, lens.sourceSize, at) * weight;\n } else {\n sum = sum + upBilinear(lens.sourceOffset, lens.sourceSize, at) * weight;\n }\n }\n }\n\n return sum;\n}\n\n/** One level folded back: its own light, mixed by the radius with the wider spread of every level below it. */\n@compute @workgroup_size(8, 8, 1)\nfn upsample(@builtin(global_invocation_id) id: vec3<u32>) {\n if (id.x >= lens.targetSize.x || id.y >= lens.targetSize.y) {\n return;\n }\n\n let scale = vec2<f32>(lens.sourceSize) / vec2<f32>(lens.targetSize);\n let wider = tent((vec2<f32>(id.xy) + 0.5) * scale);\n let index = lens.targetOffset + id.y * lens.targetSize.x + id.x;\n\n up[index] = vec4<f32>(mix(down[index].rgb, wider, lens.radius), 1.0);\n}\n\n/** The aperture's rays at one texel of the streak level: the light behind it along each ray, fading with distance. */\n@compute @workgroup_size(8, 8, 1)\nfn streaks(@builtin(global_invocation_id) id: vec3<u32>) {\n if (id.x >= lens.targetSize.x || id.y >= lens.targetSize.y) {\n return;\n }\n\n let centre = vec2<f32>(id.xy) + 0.5;\n var sum = vec3<f32>(0.0);\n var total = 0.0;\n\n for (var r = 0u; r < lens.rays; r = r + 1u) {\n let angle = lens.glareAngle + f32(r) * 2.0 * PI / f32(lens.rays);\n let along = vec2<f32>(cos(angle), sin(angle));\n\n for (var j = 1; j <= STREAK_TAPS; j = j + 1) {\n let t = f32(j) / f32(STREAK_TAPS);\n let weight = exp(-4.0 * t);\n\n sum = sum + downBilinear(lens.sourceOffset, lens.sourceSize, centre - along * (t * lens.glareLength)) * weight;\n total = total + weight;\n }\n }\n\n streaked[id.y * lens.targetSize.x + id.x] = vec4<f32>(sum / max(total, 1e-6), 1.0);\n}\n\nfn streakTexel(x: i32, y: i32) -> vec3<f32> {\n let s = vec2<i32>(lens.streakSize);\n\n return streaked[u32(clamp(y, 0, s.y - 1) * s.x + clamp(x, 0, s.x - 1))].rgb;\n}\n\nfn streakBilinear(position: vec2<f32>) -> vec3<f32> {\n let b = bilinearAt(position);\n let x = i32(b.x);\n let y = i32(b.y);\n\n return mix(mix(streakTexel(x, y), streakTexel(x + 1, y), b.z), mix(streakTexel(x, y + 1), streakTexel(x + 1, y + 1), b.z), b.w);\n}\n\n/** The image as the lens delivers it: fringed towards the corners, with its halo, balanced for the camera's white. */\n@compute @workgroup_size(8, 8, 1)\nfn composite(@builtin(global_invocation_id) id: vec3<u32>) {\n if (id.x >= lens.resolution.x || id.y >= lens.resolution.y) {\n return;\n }\n\n let size = vec2<f32>(lens.resolution);\n let position = vec2<f32>(id.xy) + 0.5;\n var color = imageTexel(i32(id.x), i32(id.y));\n\n // Lateral chromatic aberration: each colour is magnified a little differently, red outwards and blue inwards,\n // in proportion to the distance from the centre, which is how a lens's dispersion moves them.\n if (lens.aberration > 0.0) {\n let centre = size * 0.5;\n let away = position - centre;\n let red = imageBilinear(centre + away * (1.0 - lens.aberration));\n let blue = imageBilinear(centre + away * (1.0 + lens.aberration));\n\n color = vec3<f32>(red.r, color.g, blue.b);\n }\n\n if (lens.intensity > 0.0) {\n // The largest folded level is already a tent over the levels below it, so one bilinear read of it is smooth.\n let halo = upBilinear(lens.haloOffset, lens.haloSize, position * vec2<f32>(lens.haloSize) / size);\n\n color = mix(color, halo, lens.intensity);\n }\n\n if (lens.glare > 0.0) {\n color = mix(color, streakBilinear(position * vec2<f32>(lens.streakSize) / size), lens.glare);\n }\n\n if (lens.autoExposure > 0.0) {\n color = color * metered[0].x;\n }\n\n let balanced = vec3<f32>(dot(lens.white0.xyz, color), dot(lens.white1.xyz, color), dot(lens.white2.xyz, color));\n\n graded[id.y * lens.resolution.x + id.x] = vec4<f32>(max(balanced, vec3<f32>(0.0)), 1.0);\n}\n";
16
+ export declare const LENS_WGSL = "\nstruct Lens {\n resolution: vec2<u32>,\n // Whether the colour comes from the denoiser's output rather than straight from the accumulation.\n denoised: u32,\n // Upsampling only: the level read from sits in the downsampled pyramid (the smallest one) instead of the folded one.\n fromDown: u32,\n sourceSize: vec2<u32>,\n // Where the level read from starts in its pyramid; a size of the full resolution reads the image itself.\n sourceOffset: u32,\n // The first downsample reads the image itself, and averages its taps by luminance against fireflies.\n fromImage: u32,\n targetSize: vec2<u32>,\n targetOffset: u32,\n // Where the largest level of the folded pyramid starts, which the composite reads the halo from.\n haloOffset: u32,\n haloSize: vec2<u32>,\n // How much of the light the halo takes, and how much each level takes from the one below it.\n intensity: f32,\n radius: f32,\n // How far red and blue move apart at the corners, as a share of the distance from the centre.\n aberration: f32,\n // How much of the light the aperture's rays take, how many there are, and how far they reach in streak texels.\n glare: f32,\n rays: u32,\n glareLength: f32,\n // The white balance, a linear sRGB matrix, row by row.\n white0: vec4<f32>,\n white1: vec4<f32>,\n white2: vec4<f32>,\n // The size of the level the rays are gathered at, and the angle of the first ray, in radians.\n streakSize: vec2<u32>,\n glareAngle: f32,\n // Whether the camera meters the image and exposes it to middle grey, which the meter pass works out.\n autoExposure: f32,\n // The share of a dark scene's darkness the meter keeps.\n darkAdaptation: f32,\n // The exposure applied after the lens, the meter's aside, which the rays are limited against.\n exposure: f32,\n};\n\nconst PI: f32 = 3.14159265358979;\n\n/** Taps along each of the aperture's rays. */\nconst STREAK_TAPS: i32 = 24;\n\n/**\n * The brightest a tap of the rays counts as, in multiples of the exposed white. A lamp is thousands of times white,\n * which would carry its rays across the frame at full length; past this they stay as short as a camera shows them.\n */\nconst GLARE_CEILING: f32 = 4.0;\n\n@group(0) @binding(0) var<uniform> lens: Lens;\n@group(0) @binding(1) var<storage, read> accumulation: array<vec4<f32>>;\n@group(0) @binding(2) var<storage, read> denoised: array<vec4<f32>>;\n@group(0) @binding(3) var<storage, read_write> down: array<vec4<f32>>;\n@group(0) @binding(4) var<storage, read_write> up: array<vec4<f32>>;\n@group(0) @binding(5) var<storage, read_write> graded: array<vec4<f32>>;\n@group(0) @binding(6) var<storage, read_write> streaked: array<vec4<f32>>;\n// What the camera's meter read: the exposure that brings the image's average to middle grey, in x.\n@group(0) @binding(7) var<storage, read_write> metered: array<vec4<f32>>;\n\n/** What a light meter calibrates to: an average scene reflects about eighteen percent. */\nconst MIDDLE_GREY: f32 = 0.18;\nconst METER_GRID: vec2<u32> = vec2<u32>(64u, 36u);\nconst METER_THREADS: u32 = 256u;\n\n/**\n * How far above middle grey the meter lets the bright end of the image land: three stops, where AgX still shows\n * detail, three and a half under where it reaches white.\n */\nconst HIGHLIGHT_CEILING: f32 = 8.0;\n/** The share of the metered points that counts as the bright end: the light through a window, not a lamp's own pixels. */\nconst HIGHLIGHT_SHARE: f32 = 0.03;\n/**\n * The average below which a scene counts as dark: about three stops under middle grey, a room lit by a window on a\n * grey day. Above it the meter exposes fully; below it, only for the stops the dark adaptation lets go.\n */\nconst DIM_AVERAGE: f32 = 0.02;\n/** Half stops of luminance, from 2^-16 to 2^16, which the bright end is found in. */\nconst METER_BINS: u32 = 64u;\n\nvar<workgroup> meterSums: array<vec2<f32>, 256>;\nvar<workgroup> meterHistogram: array<atomic<u32>, 64>;\n\n/**\n * The camera's meter: the image's average luminance over a grid of points, taken as the mean of the logarithms so that\n * a bright window or a patch of sky cannot darken everything else, weighed towards the centre as a camera's\n * centre-weighted metering is. What no path has reached yet, or is black, does not count. One workgroup reads the\n * grid and sums it in shared memory.\n *\n * Then it guards the highlights, as a camera's matrix metering does: the average alone takes a dim attic with a shaft\n * of sun in it to middle grey and burns the shaft out, where a photographer keeps the room dim. The brightest few\n * percent of the points, found in a histogram of half stops, may land no more than {@link HIGHLIGHT_CEILING} times\n * brighter; an even scene, whose bright end is close to its average, is left as the average says.\n */\n@compute @workgroup_size(256, 1, 1)\nfn meter(@builtin(local_invocation_index) thread: u32) {\n var sum = vec2<f32>(0.0);\n let count = METER_GRID.x * METER_GRID.y;\n\n if (thread < METER_BINS) {\n atomicStore(&meterHistogram[thread], 0u);\n }\n\n workgroupBarrier();\n\n for (var k = thread; k < count; k = k + METER_THREADS) {\n let cell = vec2<f32>(f32(k % METER_GRID.x), f32(k / METER_GRID.x)) + 0.5;\n let uv = cell / vec2<f32>(METER_GRID);\n let luminance = dot(imageTexel(i32(uv.x * f32(lens.resolution.x)), i32(uv.y * f32(lens.resolution.y))),\n vec3<f32>(0.2126, 0.7152, 0.0722));\n let away = (uv - 0.5) * 2.0;\n let weight = select(0.0, 1.0 - 0.6 * min(dot(away, away) * 0.5, 1.0), luminance > 0.0);\n\n sum = sum + vec2<f32>(log(max(luminance, 1e-6)) * weight, weight);\n\n if (luminance > 0.0) {\n let bin = u32(clamp((log2(luminance) + 16.0) * 2.0, 0.0, f32(METER_BINS - 1u)));\n\n atomicAdd(&meterHistogram[bin], 1u);\n }\n }\n\n meterSums[thread] = sum;\n workgroupBarrier();\n\n for (var stride = METER_THREADS / 2u; stride > 0u; stride = stride / 2u) {\n if (thread < stride) {\n meterSums[thread] = meterSums[thread] + meterSums[thread + stride];\n }\n\n workgroupBarrier();\n }\n\n if (thread == 0u) {\n let total = meterSums[0];\n let average = select(MIDDLE_GREY, exp(total.x / max(total.y, 1e-6)), total.y > 0.0);\n var exposure = MIDDLE_GREY / average;\n\n // A dark scene keeps a share of its missing stops: a night stays a night instead of turning into dusk.\n if (average < DIM_AVERAGE) {\n exposure = exposure * pow(average / DIM_AVERAGE, lens.darkAdaptation);\n }\n\n // From the top down, the first half stop by which the bright share is reached; its upper edge is that end.\n var points = 0u;\n\n for (var bin = 0u; bin < METER_BINS; bin = bin + 1u) {\n points = points + atomicLoad(&meterHistogram[bin]);\n }\n\n var above = 0u;\n var bright = 0.0;\n\n for (var bin = i32(METER_BINS) - 1; bin >= 0 && points > 0u; bin = bin - 1) {\n above = above + atomicLoad(&meterHistogram[u32(bin)]);\n\n if (f32(above) >= HIGHLIGHT_SHARE * f32(points)) {\n bright = exp2(f32(bin + 1) * 0.5 - 16.0);\n break;\n }\n }\n\n if (bright > 0.0) {\n exposure = min(exposure, HIGHLIGHT_CEILING * MIDDLE_GREY / bright);\n }\n\n metered[0] = vec4<f32>(clamp(exposure, 1e-4, 1e4), average, bright, 0.0);\n }\n}\n\n/** The image's own texel: its mean so far, or nothing where no path has landed yet. */\nfn imageTexel(x: i32, y: i32) -> vec3<f32> {\n let size = vec2<i32>(lens.resolution);\n let index = u32(clamp(y, 0, size.y - 1) * size.x + clamp(x, 0, size.x - 1));\n\n if (lens.denoised != 0u) {\n return denoised[index].rgb;\n }\n\n let stored = accumulation[index];\n\n return select(stored.rgb / stored.w, vec3<f32>(0.0), stored.w <= 0.0);\n}\n\nfn downTexel(offset: u32, size: vec2<u32>, x: i32, y: i32) -> vec3<f32> {\n let s = vec2<i32>(size);\n\n return down[offset + u32(clamp(y, 0, s.y - 1) * s.x + clamp(x, 0, s.x - 1))].rgb;\n}\n\nfn upTexel(offset: u32, size: vec2<u32>, x: i32, y: i32) -> vec3<f32> {\n let s = vec2<i32>(size);\n\n return up[offset + u32(clamp(y, 0, s.y - 1) * s.x + clamp(x, 0, s.x - 1))].rgb;\n}\n\n/** Bilinear weights and the texel below and left of a point given in texels, edges clamped. */\nfn bilinearAt(position: vec2<f32>) -> vec4<f32> {\n let p = position - 0.5;\n let base = floor(p);\n\n return vec4<f32>(base, p - base);\n}\n\nfn imageBilinear(position: vec2<f32>) -> vec3<f32> {\n let b = bilinearAt(position);\n let x = i32(b.x);\n let y = i32(b.y);\n\n return mix(\n mix(imageTexel(x, y), imageTexel(x + 1, y), b.z),\n mix(imageTexel(x, y + 1), imageTexel(x + 1, y + 1), b.z), b.w);\n}\n\nfn downBilinear(offset: u32, size: vec2<u32>, position: vec2<f32>) -> vec3<f32> {\n let b = bilinearAt(position);\n let x = i32(b.x);\n let y = i32(b.y);\n\n return mix(\n mix(downTexel(offset, size, x, y), downTexel(offset, size, x + 1, y), b.z),\n mix(downTexel(offset, size, x, y + 1), downTexel(offset, size, x + 1, y + 1), b.z), b.w);\n}\n\nfn upBilinear(offset: u32, size: vec2<u32>, position: vec2<f32>) -> vec3<f32> {\n let b = bilinearAt(position);\n let x = i32(b.x);\n let y = i32(b.y);\n\n return mix(\n mix(upTexel(offset, size, x, y), upTexel(offset, size, x + 1, y), b.z),\n mix(upTexel(offset, size, x, y + 1), upTexel(offset, size, x + 1, y + 1), b.z), b.w);\n}\n\n/** The level being filtered, read bilinearly at a point given in its own texels. */\nfn sourceAt(position: vec2<f32>) -> vec3<f32> {\n if (lens.fromImage != 0u) {\n return imageBilinear(position);\n }\n\n return downBilinear(lens.sourceOffset, lens.sourceSize, position);\n}\n\nfn luminance(color: vec3<f32>) -> f32 {\n return dot(color, vec3<f32>(0.2126, 0.7152, 0.0722));\n}\n\n/** Karis' average: a group of taps weighed by one over one plus its luminance, so a lone firefly cannot flare. */\nfn karis(sum: vec3<f32>) -> vec4<f32> {\n let weight = 1.0 / (1.0 + luminance(sum));\n\n return vec4<f32>(sum * weight, weight);\n}\n\n/** One level of the pyramid from the one above it: Jimenez's 13 taps, four overlapping boxes and a centre one. */\n@compute @workgroup_size(8, 8, 1)\nfn downsample(@builtin(global_invocation_id) id: vec3<u32>) {\n if (id.x >= lens.targetSize.x || id.y >= lens.targetSize.y) {\n return;\n }\n\n let scale = vec2<f32>(lens.sourceSize) / vec2<f32>(lens.targetSize);\n let centre = (vec2<f32>(id.xy) + 0.5) * scale;\n let a = sourceAt(centre + vec2<f32>(-2.0, -2.0));\n let b = sourceAt(centre + vec2<f32>(0.0, -2.0));\n let c = sourceAt(centre + vec2<f32>(2.0, -2.0));\n let d = sourceAt(centre + vec2<f32>(-2.0, 0.0));\n let e = sourceAt(centre);\n let f = sourceAt(centre + vec2<f32>(2.0, 0.0));\n let g = sourceAt(centre + vec2<f32>(-2.0, 2.0));\n let h = sourceAt(centre + vec2<f32>(0.0, 2.0));\n let i = sourceAt(centre + vec2<f32>(2.0, 2.0));\n let j = sourceAt(centre + vec2<f32>(-1.0, -1.0));\n let k = sourceAt(centre + vec2<f32>(1.0, -1.0));\n let l = sourceAt(centre + vec2<f32>(-1.0, 1.0));\n let m = sourceAt(centre + vec2<f32>(1.0, 1.0));\n var result: vec3<f32>;\n\n if (lens.fromImage != 0u) {\n let groups = karis((j + k + l + m) * 0.25) * 0.5\n + karis((a + b + d + e) * 0.25) * 0.125\n + karis((b + c + e + f) * 0.25) * 0.125\n + karis((d + e + g + h) * 0.25) * 0.125\n + karis((e + f + h + i) * 0.25) * 0.125;\n\n result = groups.rgb / max(groups.w, 1e-6);\n } else {\n result = e * 0.125 + (a + c + g + i) * 0.03125 + (b + d + f + h) * 0.0625 + (j + k + l + m) * 0.125;\n }\n\n down[lens.targetOffset + id.y * lens.targetSize.x + id.x] = vec4<f32>(max(result, vec3<f32>(0.0)), 1.0);\n}\n\n/** A 3 x 3 tent over the smaller level, read at a point given in its texels. */\nfn tent(position: vec2<f32>) -> vec3<f32> {\n var sum = vec3<f32>(0.0);\n\n for (var dy = -1; dy <= 1; dy = dy + 1) {\n for (var dx = -1; dx <= 1; dx = dx + 1) {\n let weight = f32((2 - abs(dx)) * (2 - abs(dy))) / 16.0;\n let at = position + vec2<f32>(f32(dx), f32(dy));\n\n if (lens.fromDown != 0u) {\n sum = sum + downBilinear(lens.sourceOffset, lens.sourceSize, at) * weight;\n } else {\n sum = sum + upBilinear(lens.sourceOffset, lens.sourceSize, at) * weight;\n }\n }\n }\n\n return sum;\n}\n\n/** One level folded back: its own light, mixed by the radius with the wider spread of every level below it. */\n@compute @workgroup_size(8, 8, 1)\nfn upsample(@builtin(global_invocation_id) id: vec3<u32>) {\n if (id.x >= lens.targetSize.x || id.y >= lens.targetSize.y) {\n return;\n }\n\n let scale = vec2<f32>(lens.sourceSize) / vec2<f32>(lens.targetSize);\n let wider = tent((vec2<f32>(id.xy) + 0.5) * scale);\n let index = lens.targetOffset + id.y * lens.targetSize.x + id.x;\n\n up[index] = vec4<f32>(mix(down[index].rgb, wider, lens.radius), 1.0);\n}\n\n/** The aperture's rays at one texel of the streak level: the light behind it along each ray, fading with distance. */\n@compute @workgroup_size(8, 8, 1)\nfn streaks(@builtin(global_invocation_id) id: vec3<u32>) {\n if (id.x >= lens.targetSize.x || id.y >= lens.targetSize.y) {\n return;\n }\n\n let centre = vec2<f32>(id.xy) + 0.5;\n // The exposure the image will have: the setting's, and the meter's when it meters.\n let exposure = lens.exposure * select(1.0, metered[0].x, lens.autoExposure > 0.0);\n var sum = vec3<f32>(0.0);\n var total = 0.0;\n\n for (var r = 0u; r < lens.rays; r = r + 1u) {\n let angle = lens.glareAngle + f32(r) * 2.0 * PI / f32(lens.rays);\n let along = vec2<f32>(cos(angle), sin(angle));\n\n for (var j = 1; j <= STREAK_TAPS; j = j + 1) {\n let t = f32(j) / f32(STREAK_TAPS);\n let weight = exp(-6.0 * t);\n\n let light = downBilinear(lens.sourceOffset, lens.sourceSize, centre - along * (t * lens.glareLength));\n\n sum = sum + light * (weight / max(1.0, luminance(light) * exposure / GLARE_CEILING));\n total = total + weight;\n }\n }\n\n streaked[id.y * lens.targetSize.x + id.x] = vec4<f32>(sum / max(total, 1e-6), 1.0);\n}\n\nfn streakTexel(x: i32, y: i32) -> vec3<f32> {\n let s = vec2<i32>(lens.streakSize);\n\n return streaked[u32(clamp(y, 0, s.y - 1) * s.x + clamp(x, 0, s.x - 1))].rgb;\n}\n\nfn streakBilinear(position: vec2<f32>) -> vec3<f32> {\n let b = bilinearAt(position);\n let x = i32(b.x);\n let y = i32(b.y);\n\n return mix(mix(streakTexel(x, y), streakTexel(x + 1, y), b.z), mix(streakTexel(x, y + 1), streakTexel(x + 1, y + 1), b.z), b.w);\n}\n\n/** The image as the lens delivers it: fringed towards the corners, with its halo, balanced for the camera's white. */\n@compute @workgroup_size(8, 8, 1)\nfn composite(@builtin(global_invocation_id) id: vec3<u32>) {\n if (id.x >= lens.resolution.x || id.y >= lens.resolution.y) {\n return;\n }\n\n let size = vec2<f32>(lens.resolution);\n let position = vec2<f32>(id.xy) + 0.5;\n var color = imageTexel(i32(id.x), i32(id.y));\n\n // Lateral chromatic aberration: each colour is magnified a little differently, red outwards and blue inwards,\n // in proportion to the distance from the centre, which is how a lens's dispersion moves them.\n if (lens.aberration > 0.0) {\n let centre = size * 0.5;\n let away = position - centre;\n let red = imageBilinear(centre + away * (1.0 - lens.aberration));\n let blue = imageBilinear(centre + away * (1.0 + lens.aberration));\n\n color = vec3<f32>(red.r, color.g, blue.b);\n }\n\n if (lens.intensity > 0.0) {\n // The largest folded level is already a tent over the levels below it, so one bilinear read of it is smooth.\n let halo = upBilinear(lens.haloOffset, lens.haloSize, position * vec2<f32>(lens.haloSize) / size);\n\n color = mix(color, halo, lens.intensity);\n }\n\n if (lens.glare > 0.0) {\n color = mix(color, streakBilinear(position * vec2<f32>(lens.streakSize) / size), lens.glare);\n }\n\n if (lens.autoExposure > 0.0) {\n color = color * metered[0].x;\n }\n\n let balanced = vec3<f32>(dot(lens.white0.xyz, color), dot(lens.white1.xyz, color), dot(lens.white2.xyz, color));\n\n graded[id.y * lens.resolution.x + id.x] = vec4<f32>(max(balanced, vec3<f32>(0.0)), 1.0);\n}\n";
17
17
  //# sourceMappingURL=lens.wgsl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lens.wgsl.d.ts","sourceRoot":"","sources":["../../src/wgsl/lens.wgsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS,gldAuYrB,CAAC"}
1
+ {"version":3,"file":"lens.wgsl.d.ts","sourceRoot":"","sources":["../../src/wgsl/lens.wgsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS,kyfA+ZrB,CAAC"}
@@ -48,6 +48,10 @@ struct Lens {
48
48
  glareAngle: f32,
49
49
  // Whether the camera meters the image and exposes it to middle grey, which the meter pass works out.
50
50
  autoExposure: f32,
51
+ // The share of a dark scene's darkness the meter keeps.
52
+ darkAdaptation: f32,
53
+ // The exposure applied after the lens, the meter's aside, which the rays are limited against.
54
+ exposure: f32,
51
55
  };
52
56
 
53
57
  const PI: f32 = 3.14159265358979;
@@ -55,6 +59,12 @@ const PI: f32 = 3.14159265358979;
55
59
  /** Taps along each of the aperture's rays. */
56
60
  const STREAK_TAPS: i32 = 24;
57
61
 
62
+ /**
63
+ * The brightest a tap of the rays counts as, in multiples of the exposed white. A lamp is thousands of times white,
64
+ * which would carry its rays across the frame at full length; past this they stay as short as a camera shows them.
65
+ */
66
+ const GLARE_CEILING: f32 = 4.0;
67
+
58
68
  @group(0) @binding(0) var<uniform> lens: Lens;
59
69
  @group(0) @binding(1) var<storage, read> accumulation: array<vec4<f32>>;
60
70
  @group(0) @binding(2) var<storage, read> denoised: array<vec4<f32>>;
@@ -77,6 +87,11 @@ const METER_THREADS: u32 = 256u;
77
87
  const HIGHLIGHT_CEILING: f32 = 8.0;
78
88
  /** The share of the metered points that counts as the bright end: the light through a window, not a lamp's own pixels. */
79
89
  const HIGHLIGHT_SHARE: f32 = 0.03;
90
+ /**
91
+ * The average below which a scene counts as dark: about three stops under middle grey, a room lit by a window on a
92
+ * grey day. Above it the meter exposes fully; below it, only for the stops the dark adaptation lets go.
93
+ */
94
+ const DIM_AVERAGE: f32 = 0.02;
80
95
  /** Half stops of luminance, from 2^-16 to 2^16, which the bright end is found in. */
81
96
  const METER_BINS: u32 = 64u;
82
97
 
@@ -138,6 +153,11 @@ fn meter(@builtin(local_invocation_index) thread: u32) {
138
153
  let average = select(MIDDLE_GREY, exp(total.x / max(total.y, 1e-6)), total.y > 0.0);
139
154
  var exposure = MIDDLE_GREY / average;
140
155
 
156
+ // A dark scene keeps a share of its missing stops: a night stays a night instead of turning into dusk.
157
+ if (average < DIM_AVERAGE) {
158
+ exposure = exposure * pow(average / DIM_AVERAGE, lens.darkAdaptation);
159
+ }
160
+
141
161
  // From the top down, the first half stop by which the bright share is reached; its upper edge is that end.
142
162
  var points = 0u;
143
163
 
@@ -330,6 +350,8 @@ fn streaks(@builtin(global_invocation_id) id: vec3<u32>) {
330
350
  }
331
351
 
332
352
  let centre = vec2<f32>(id.xy) + 0.5;
353
+ // The exposure the image will have: the setting's, and the meter's when it meters.
354
+ let exposure = lens.exposure * select(1.0, metered[0].x, lens.autoExposure > 0.0);
333
355
  var sum = vec3<f32>(0.0);
334
356
  var total = 0.0;
335
357
 
@@ -339,9 +361,11 @@ fn streaks(@builtin(global_invocation_id) id: vec3<u32>) {
339
361
 
340
362
  for (var j = 1; j <= STREAK_TAPS; j = j + 1) {
341
363
  let t = f32(j) / f32(STREAK_TAPS);
342
- let weight = exp(-4.0 * t);
364
+ let weight = exp(-6.0 * t);
365
+
366
+ let light = downBilinear(lens.sourceOffset, lens.sourceSize, centre - along * (t * lens.glareLength));
343
367
 
344
- sum = sum + downBilinear(lens.sourceOffset, lens.sourceSize, centre - along * (t * lens.glareLength)) * weight;
368
+ sum = sum + light * (weight / max(1.0, luminance(light) * exposure / GLARE_CEILING));
345
369
  total = total + weight;
346
370
  }
347
371
  }
@@ -1 +1 @@
1
- {"version":3,"file":"lens.wgsl.js","sourceRoot":"","sources":["../../src/wgsl/lens.wgsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuYnC,CAAC"}
1
+ {"version":3,"file":"lens.wgsl.js","sourceRoot":"","sources":["../../src/wgsl/lens.wgsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+ZnC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinypoly/gpu-renderer",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "WebGPU path tracer for Three.js scenes: BVH traversal, progressive accumulation and tone mapping in WGSL compute shaders.",
5
5
  "keywords": [
6
6
  "three",
package/src/lensPass.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { createShaderModule } from "./shaderModule.js";
2
- import { NEUTRAL_WHITE_BALANCE, whiteBalanceMatrix, type GpuRenderSettings } from "./settings.js";
2
+ import { effectiveExposure, NEUTRAL_WHITE_BALANCE, whiteBalanceMatrix, type GpuRenderSettings } from "./settings.js";
3
3
  import { LENS_WGSL } from "./wgsl/lens.wgsl.js";
4
4
 
5
- const UNIFORM_BYTES = 144;
5
+ const UNIFORM_BYTES = 160;
6
6
 
7
7
  const WORKGROUP = 8;
8
8
 
@@ -29,6 +29,10 @@ export interface LensEffects {
29
29
  whiteBalance: number[] | null;
30
30
  /** Whether the image is metered and exposed to middle grey before the display transform. */
31
31
  autoExposure: boolean;
32
+ /** The share of a dark scene's darkness the meter keeps, `0` to `1`. */
33
+ darkAdaptation: number;
34
+ /** What the image is multiplied by after the lens, the meter's own exposure aside: the rays are limited against it. */
35
+ exposure: number;
32
36
  }
33
37
 
34
38
  /** The lens effects these settings ask for, or `null` when they ask for none and the pass can be skipped. */
@@ -55,6 +59,8 @@ export function lensEffects(settings: GpuRenderSettings): LensEffects | null {
55
59
  glareAngle: (Number(glare.rotation) || 0) * Math.PI / 180,
56
60
  whiteBalance: neutral ? null : whiteBalanceMatrix(camera.whiteBalance),
57
61
  autoExposure,
62
+ darkAdaptation: Math.min(1, Math.max(0, Number(camera.darkAdaptation) || 0)),
63
+ exposure: Math.max(effectiveExposure(settings), 0),
58
64
  };
59
65
  }
60
66
 
@@ -212,6 +218,8 @@ export class LensPass {
212
218
  integers[33] = streak.height;
213
219
  floats[34] = effects.glareAngle;
214
220
  floats[35] = effects.autoExposure ? 1 : 0;
221
+ floats[36] = effects.darkAdaptation;
222
+ floats[37] = effects.exposure;
215
223
  for (let row = 0; row < 3; row++) for (let column = 0; column < 3; column++)
216
224
  floats[20 + row * 4 + column] = white[row * 3 + column];
217
225
  fill();
@@ -252,6 +260,10 @@ export class LensPass {
252
260
  integers[10] = level.offset;
253
261
  };
254
262
 
263
+ // The meter is one workgroup, whatever the size: dispatched as a single tile of the grid it reads. It goes first,
264
+ // since the rays are limited against the exposure it finds.
265
+ if (effects.autoExposure) dispatch(this.meter, { width: 1, height: 1 }, () => {});
266
+
255
267
  // The rays are gathered from a level of the same pyramid, so either effect builds it.
256
268
  if (effects.bloom > 0 || effects.glare > 0) {
257
269
  levels.forEach((level, k) => dispatch(this.downsample, level, () => {
@@ -290,9 +302,6 @@ export class LensPass {
290
302
  }
291
303
  }
292
304
 
293
- // The meter is one workgroup, whatever the size: dispatched as a single tile of the grid it reads.
294
- if (effects.autoExposure) dispatch(this.meter, { width: 1, height: 1 }, () => {});
295
-
296
305
  dispatch(this.composite, { width, height }, () => {});
297
306
 
298
307
  return this.graded as GPUBuffer;
package/src/settings.ts CHANGED
@@ -84,6 +84,12 @@ export interface GpuRenderSettings extends Omit<RenderSettings, "globalIlluminat
84
84
  autoExposure: boolean;
85
85
  /** Stops added to the metered exposure: positive brightens, as on a camera's dial. */
86
86
  exposureCompensation: number;
87
+ /**
88
+ * How much of a dark scene's darkness the automatic exposure keeps, `0` to `1`. The meter brings any image to
89
+ * middle grey, so a night lit by a few lamps comes out as dusk; below a dim average this keeps that share of the
90
+ * missing stops, as the eye does at night. `0` exposes every scene alike; `1` brightens nothing below that average.
91
+ */
92
+ darkAdaptation: number;
87
93
  iso: number;
88
94
  /** Seconds. */
89
95
  shutterSpeed: number;
@@ -154,7 +160,7 @@ export const DEFAULT_GPU_RENDER_SETTINGS: Readonly<GpuRenderSettings> = Object.f
154
160
  glare: { enabled: true, intensity: 0.06, blades: 6, length: 0.25, rotation: 15 },
155
161
  lens: { chromaticAberration: 0.05, distortion: 0 },
156
162
  camera: {
157
- contrast: 1, physicalExposure: false, autoExposure: false, exposureCompensation: 0, iso: 100,
163
+ contrast: 1, physicalExposure: false, autoExposure: false, exposureCompensation: 0, darkAdaptation: 0, iso: 100,
158
164
  shutterSpeed: 1 / 125, whiteBalance: 6500,
159
165
  },
160
166
  subsurface: { enabled: true, depth: 2 },
@@ -48,6 +48,10 @@ struct Lens {
48
48
  glareAngle: f32,
49
49
  // Whether the camera meters the image and exposes it to middle grey, which the meter pass works out.
50
50
  autoExposure: f32,
51
+ // The share of a dark scene's darkness the meter keeps.
52
+ darkAdaptation: f32,
53
+ // The exposure applied after the lens, the meter's aside, which the rays are limited against.
54
+ exposure: f32,
51
55
  };
52
56
 
53
57
  const PI: f32 = 3.14159265358979;
@@ -55,6 +59,12 @@ const PI: f32 = 3.14159265358979;
55
59
  /** Taps along each of the aperture's rays. */
56
60
  const STREAK_TAPS: i32 = 24;
57
61
 
62
+ /**
63
+ * The brightest a tap of the rays counts as, in multiples of the exposed white. A lamp is thousands of times white,
64
+ * which would carry its rays across the frame at full length; past this they stay as short as a camera shows them.
65
+ */
66
+ const GLARE_CEILING: f32 = 4.0;
67
+
58
68
  @group(0) @binding(0) var<uniform> lens: Lens;
59
69
  @group(0) @binding(1) var<storage, read> accumulation: array<vec4<f32>>;
60
70
  @group(0) @binding(2) var<storage, read> denoised: array<vec4<f32>>;
@@ -77,6 +87,11 @@ const METER_THREADS: u32 = 256u;
77
87
  const HIGHLIGHT_CEILING: f32 = 8.0;
78
88
  /** The share of the metered points that counts as the bright end: the light through a window, not a lamp's own pixels. */
79
89
  const HIGHLIGHT_SHARE: f32 = 0.03;
90
+ /**
91
+ * The average below which a scene counts as dark: about three stops under middle grey, a room lit by a window on a
92
+ * grey day. Above it the meter exposes fully; below it, only for the stops the dark adaptation lets go.
93
+ */
94
+ const DIM_AVERAGE: f32 = 0.02;
80
95
  /** Half stops of luminance, from 2^-16 to 2^16, which the bright end is found in. */
81
96
  const METER_BINS: u32 = 64u;
82
97
 
@@ -138,6 +153,11 @@ fn meter(@builtin(local_invocation_index) thread: u32) {
138
153
  let average = select(MIDDLE_GREY, exp(total.x / max(total.y, 1e-6)), total.y > 0.0);
139
154
  var exposure = MIDDLE_GREY / average;
140
155
 
156
+ // A dark scene keeps a share of its missing stops: a night stays a night instead of turning into dusk.
157
+ if (average < DIM_AVERAGE) {
158
+ exposure = exposure * pow(average / DIM_AVERAGE, lens.darkAdaptation);
159
+ }
160
+
141
161
  // From the top down, the first half stop by which the bright share is reached; its upper edge is that end.
142
162
  var points = 0u;
143
163
 
@@ -330,6 +350,8 @@ fn streaks(@builtin(global_invocation_id) id: vec3<u32>) {
330
350
  }
331
351
 
332
352
  let centre = vec2<f32>(id.xy) + 0.5;
353
+ // The exposure the image will have: the setting's, and the meter's when it meters.
354
+ let exposure = lens.exposure * select(1.0, metered[0].x, lens.autoExposure > 0.0);
333
355
  var sum = vec3<f32>(0.0);
334
356
  var total = 0.0;
335
357
 
@@ -339,9 +361,11 @@ fn streaks(@builtin(global_invocation_id) id: vec3<u32>) {
339
361
 
340
362
  for (var j = 1; j <= STREAK_TAPS; j = j + 1) {
341
363
  let t = f32(j) / f32(STREAK_TAPS);
342
- let weight = exp(-4.0 * t);
364
+ let weight = exp(-6.0 * t);
365
+
366
+ let light = downBilinear(lens.sourceOffset, lens.sourceSize, centre - along * (t * lens.glareLength));
343
367
 
344
- sum = sum + downBilinear(lens.sourceOffset, lens.sourceSize, centre - along * (t * lens.glareLength)) * weight;
368
+ sum = sum + light * (weight / max(1.0, luminance(light) * exposure / GLARE_CEILING));
345
369
  total = total + weight;
346
370
  }
347
371
  }