@driftengine/core 4.8.4 → 4.8.6
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.json +4332 -4250
- package/dist/build/shaderComments.js +0 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.js +11 -1
- package/dist/render/ambientHarmonics.d.ts +46 -0
- package/dist/render/ambientHarmonics.js +80 -0
- package/dist/render/areaLights.d.ts +19 -0
- package/dist/render/areaLights.js +20 -0
- package/dist/render/backend/api.d.ts +13 -2
- package/dist/render/backend/webgl2/instanced.d.ts +2 -0
- package/dist/render/backend/webgl2/instanced.js +11 -2
- package/dist/render/backend/webgl2/renderer.d.ts +74 -1
- package/dist/render/backend/webgl2/renderer.js +229 -37
- package/dist/render/backend/webgl2/skinScatter.d.ts +14 -0
- package/dist/render/backend/webgl2/skinScatter.js +88 -26
- package/dist/render/backend/webgpu/buffers.js +2 -1
- package/dist/render/backend/webgpu/clusterBinner.js +3 -2
- package/dist/render/backend/webgpu/flatPass.d.ts +7 -5
- package/dist/render/backend/webgpu/flatPass.js +15 -13
- package/dist/render/backend/webgpu/particlePass.d.ts +37 -4
- package/dist/render/backend/webgpu/particlePass.js +80 -12
- package/dist/render/backend/webgpu/postPass.d.ts +6 -1
- package/dist/render/backend/webgpu/postPass.js +7 -2
- package/dist/render/backend/webgpu/renderer.d.ts +58 -7
- package/dist/render/backend/webgpu/renderer.js +329 -78
- package/dist/render/backend/webgpu/shaders/clusterBin.wgsl.d.ts +1 -1
- package/dist/render/backend/webgpu/shaders/clusterBin.wgsl.js +41 -1
- package/dist/render/backend/webgpu/skinPaletteRing.d.ts +40 -28
- package/dist/render/backend/webgpu/skinPaletteRing.js +69 -32
- package/dist/render/backend/webgpu/skinScatterPass.d.ts +10 -2
- package/dist/render/backend/webgpu/skinScatterPass.js +59 -9
- package/dist/render/backend/webgpu/surfaceTexturePass.d.ts +2 -1
- package/dist/render/backend/webgpu/surfaceTexturePass.js +18 -4
- package/dist/render/bloomChain.d.ts +44 -0
- package/dist/render/bloomChain.js +28 -0
- package/dist/render/bloomPass.d.ts +3 -1
- package/dist/render/bloomPass.js +16 -2
- package/dist/render/clusteredLights.d.ts +55 -1
- package/dist/render/clusteredLights.js +182 -8
- package/dist/render/fixtureAtlas.js +1 -1
- package/dist/render/instanceCull.js +7 -0
- package/dist/render/instances.d.ts +32 -10
- package/dist/render/instances.js +17 -8
- package/dist/render/lightBudget.d.ts +26 -1
- package/dist/render/lightBudget.js +26 -3
- package/dist/render/lightmap.d.ts +102 -0
- package/dist/render/lightmap.js +118 -0
- package/dist/render/mesh.js +2 -1
- package/dist/render/particleBatch.d.ts +59 -3
- package/dist/render/particleBatch.js +53 -2
- package/dist/render/particleMaterial.d.ts +6 -1
- package/dist/render/particleMaterial.js +10 -2
- package/dist/render/particlePool.d.ts +11 -0
- package/dist/render/particlePool.js +2 -0
- package/dist/render/particleSort.d.ts +34 -0
- package/dist/render/particleSort.js +96 -0
- package/dist/render/sceneTarget.d.ts +5 -0
- package/dist/render/sceneTarget.js +8 -1
- package/dist/render/shaders/bloom.d.ts +8 -4
- package/dist/render/shaders/bloom.js +20 -3
- package/dist/render/shaders/flat/areaLight.d.ts +10 -0
- package/dist/render/shaders/flat/areaLight.js +96 -0
- package/dist/render/shaders/flat/index.js +30 -4
- package/dist/render/shaders/flat/main.d.ts +1 -1
- package/dist/render/shaders/flat/main.js +107 -105
- package/dist/render/shaders/flat/models.d.ts +16 -4
- package/dist/render/shaders/flat/models.js +64 -4
- package/dist/render/shaders/flat/normalMap.d.ts +10 -0
- package/dist/render/shaders/flat/normalMap.js +25 -0
- package/dist/render/shaders/flat/preamble.js +74 -37
- package/dist/render/shaders/flat/skin.js +6 -5
- package/dist/render/shaders/generated/bloom.wgsl.d.ts +13 -3
- package/dist/render/shaders/generated/bloom.wgsl.js +13 -3
- package/dist/render/shaders/generated/flat.wgsl.d.ts +1631 -2044
- package/dist/render/shaders/generated/flat.wgsl.js +1669 -2082
- package/dist/render/shaders/generated/particle.wgsl.d.ts +115 -1
- package/dist/render/shaders/generated/particle.wgsl.js +115 -1
- package/dist/render/shaders/generated/skinBlur.wgsl.d.ts +12 -2
- package/dist/render/shaders/generated/skinBlur.wgsl.js +12 -2
- package/dist/render/shaders/particle.d.ts +17 -1
- package/dist/render/shaders/particle.js +133 -1
- package/dist/render/shaders/skinBlur.js +25 -3
- package/dist/render/skinBlur.d.ts +8 -5
- package/dist/render/skinBlur.js +8 -5
- package/dist/render/surfaceModel.d.ts +21 -1
- package/dist/render/surfaceModel.js +22 -0
- package/dist/render/surfaceTexture.d.ts +14 -1
- package/dist/render/surfaceTexture.js +15 -2
- package/package.json +6 -6
- package/src/build/shaderComments.ts +0 -0
- package/src/index.ts +20 -1
- package/src/render/ambientHarmonics.ts +92 -0
- package/src/render/areaLights.ts +39 -0
- package/src/render/backend/api.ts +14 -1
- package/src/render/backend/webgl2/instanced.ts +12 -2
- package/src/render/backend/webgl2/renderer.ts +292 -35
- package/src/render/backend/webgl2/skinScatter.ts +120 -43
- package/src/render/backend/webgpu/buffers.ts +2 -1
- package/src/render/backend/webgpu/clusterBinner.ts +3 -1
- package/src/render/backend/webgpu/flatPass.ts +18 -13
- package/src/render/backend/webgpu/particlePass.ts +118 -12
- package/src/render/backend/webgpu/postPass.ts +7 -2
- package/src/render/backend/webgpu/renderer.ts +396 -95
- package/src/render/backend/webgpu/shaders/clusterBin.wgsl.ts +41 -1
- package/src/render/backend/webgpu/skinPaletteRing.ts +65 -33
- package/src/render/backend/webgpu/skinScatterPass.ts +59 -9
- package/src/render/backend/webgpu/surfaceTexturePass.ts +26 -5
- package/src/render/bloomChain.ts +69 -0
- package/src/render/bloomPass.ts +26 -2
- package/src/render/clusteredLights.ts +221 -7
- package/src/render/fixtureAtlas.ts +1 -1
- package/src/render/instanceCull.ts +5 -0
- package/src/render/instances.ts +40 -11
- package/src/render/lightBudget.ts +48 -2
- package/src/render/lightmap.ts +202 -0
- package/src/render/mesh.ts +2 -1
- package/src/render/particleBatch.ts +95 -4
- package/src/render/particleMaterial.ts +11 -1
- package/src/render/particlePool.ts +13 -0
- package/src/render/particleSort.ts +133 -0
- package/src/render/sceneTarget.ts +18 -1
- package/src/render/shaders/bloom.ts +20 -3
- package/src/render/shaders/flat/areaLight.ts +96 -0
- package/src/render/shaders/flat/index.ts +30 -4
- package/src/render/shaders/flat/main.ts +107 -105
- package/src/render/shaders/flat/models.ts +73 -8
- package/src/render/shaders/flat/normalMap.ts +25 -0
- package/src/render/shaders/flat/preamble.ts +74 -37
- package/src/render/shaders/flat/skin.ts +6 -5
- package/src/render/shaders/generated/bloom.wgsl.ts +13 -3
- package/src/render/shaders/generated/flat.wgsl.ts +1669 -2082
- package/src/render/shaders/generated/particle.wgsl.ts +116 -1
- package/src/render/shaders/generated/skinBlur.wgsl.ts +12 -2
- package/src/render/shaders/particle.ts +134 -1
- package/src/render/shaders/skinBlur.ts +25 -3
- package/src/render/skinBlur.ts +8 -5
- package/src/render/surfaceModel.ts +36 -1
- package/src/render/surfaceTexture.ts +41 -3
|
@@ -156,10 +156,38 @@ uniform ivec4 uMaterialFlags;
|
|
|
156
156
|
*
|
|
157
157
|
* **Four numbers in one row**: x is the cutoff, y how this frame resolves the edge (0 the hard test,
|
|
158
158
|
* 1 a dither the temporal resolve averages, 2 alpha-to-coverage; see \`cutoutDither.ts\`), z the
|
|
159
|
-
* frame the dither's pattern is offset by, w
|
|
160
|
-
*
|
|
159
|
+
* frame the dither's pattern is offset by, w the material's lighting channels — a mask a light
|
|
160
|
+
* shades it only where its own shares a bit with (\`SurfaceMaterial.lightChannels\`, 1 unless a
|
|
161
|
+
* material names others). One vector rather than a float and three more, because every loose
|
|
162
|
+
* scalar is a row of WebGL2's 224 that the light budget gives up.
|
|
161
163
|
*/
|
|
162
164
|
uniform vec4 uCutout;
|
|
165
|
+
/**
|
|
166
|
+
* A draw's own ambient, as nine spherical-harmonic coefficients of incoming radiance, red green blue
|
|
167
|
+
* in turn, twenty-seven floats, and in the last of the twenty-eight a 1 where they are on — 0 is the
|
|
168
|
+
* frame's own ambient, the sky's gradient or the probes'. \`ambientHarmonics.ts\` is the arithmetic
|
|
169
|
+
* and the basis, and its tests hold this to it. Seven rows of the material block, which is per draw
|
|
170
|
+
* as far as anything here is: \`setAmbientSH\` moves it between two draws as \`setMaterial\` does.
|
|
171
|
+
*/
|
|
172
|
+
uniform vec4 uAmbientSH[7];
|
|
173
|
+
|
|
174
|
+
/** The ambient a surface facing \`n\` receives from \`uAmbientSH\`: \`ambientFromSH\`'s arithmetic. */
|
|
175
|
+
vec3 ambientHarmonics(vec3 n) {
|
|
176
|
+
vec3 c0 = uAmbientSH[0].xyz;
|
|
177
|
+
vec3 c1 = vec3(uAmbientSH[0].w, uAmbientSH[1].xy);
|
|
178
|
+
vec3 c2 = vec3(uAmbientSH[1].zw, uAmbientSH[2].x);
|
|
179
|
+
vec3 c3 = uAmbientSH[2].yzw;
|
|
180
|
+
vec3 c4 = uAmbientSH[3].xyz;
|
|
181
|
+
vec3 c5 = vec3(uAmbientSH[3].w, uAmbientSH[4].xy);
|
|
182
|
+
vec3 c6 = vec3(uAmbientSH[4].zw, uAmbientSH[5].x);
|
|
183
|
+
vec3 c7 = uAmbientSH[5].yzw;
|
|
184
|
+
vec3 c8 = uAmbientSH[6].xyz;
|
|
185
|
+
/* The bands over pi after the cosine convolution: 1, 2/3 and 1/4. */
|
|
186
|
+
vec3 band1 = (0.488603 * 2.0 / 3.0) * (c1 * n.y + c2 * n.z + c3 * n.x);
|
|
187
|
+
vec3 band2 = 0.25 * (1.092548 * (c4 * n.x * n.y + c5 * n.y * n.z + c7 * n.x * n.z)
|
|
188
|
+
+ 0.315392 * c6 * (3.0 * n.z * n.z - 1.0) + 0.546274 * c8 * (n.x * n.x - n.y * n.y));
|
|
189
|
+
return max(0.282095 * c0 + band1 + band2, vec3(0.0));
|
|
190
|
+
}
|
|
163
191
|
/**
|
|
164
192
|
* The albedo array's per-layer effects table: six texels a layer, read with \`texelFetch\` at the
|
|
165
193
|
* layer a vertex carries. A 1×1 stand-in where the array has none, which the size test below reads
|
|
@@ -220,8 +248,12 @@ uniform vec3 uOrmScale;
|
|
|
220
248
|
*
|
|
221
249
|
* A uniform rather than a permutation flag, following the ORM map's in \`uMaterialFlags\`: a fifth boolean doubles the
|
|
222
250
|
* generated WGSL every consumer bundles as source, and this is a few multiply-adds.
|
|
251
|
+
*
|
|
252
|
+
* **x of \`uEnvironmentDials\`**, beside the two below: one row where three floats were three
|
|
253
|
+
* (\`uniformVectorBudget.ts\`). y is how much of the environment the material mirrors, z how
|
|
254
|
+
* bright what it mirrors is.
|
|
223
255
|
*/
|
|
224
|
-
uniform
|
|
256
|
+
uniform vec3 uEnvironmentDials;
|
|
225
257
|
|
|
226
258
|
/**
|
|
227
259
|
* Where a surface glows, and in what colour.
|
|
@@ -325,8 +357,12 @@ uniform vec4 uClipPlane;
|
|
|
325
357
|
* One row for all four, paid for by the flag the clip plane no longer needs.
|
|
326
358
|
*/
|
|
327
359
|
uniform vec4 uSurfaceScene;
|
|
328
|
-
|
|
329
|
-
|
|
360
|
+
/**
|
|
361
|
+
* What emission is multiplied by: x the gain (\`setEmissiveGain\`, the environment's own until a
|
|
362
|
+
* draw moves it), y the night factor emission is gated on. One row where two floats were two
|
|
363
|
+
* (\`uniformVectorBudget.ts\`).
|
|
364
|
+
*/
|
|
365
|
+
uniform vec2 uEmission;
|
|
330
366
|
#if NIGHT_EMISSIVE
|
|
331
367
|
/**
|
|
332
368
|
* Emission that only shows where the dominant light does not reach. 0 is off and is the default.
|
|
@@ -455,10 +491,9 @@ uniform float uGrain;
|
|
|
455
491
|
* Two numbers rather than one because they are what separates the surfaces this exists for.
|
|
456
492
|
* Asphalt is coarse and deep, orange peel on paint is fine and shallow, cast concrete sits
|
|
457
493
|
* between them, and the geometry carrying them is identical in all three cases. See
|
|
458
|
-
* Renderer.setSurfaceRelief.
|
|
494
|
+
* Renderer.setSurfaceRelief. x is the strength and y the bumps to a metre, in one row.
|
|
459
495
|
*/
|
|
460
|
-
uniform
|
|
461
|
-
uniform float uReliefCycles;
|
|
496
|
+
uniform vec2 uRelief;
|
|
462
497
|
/**
|
|
463
498
|
* How hard the bound surface texture's own luminance turns the shading normal, 0 for not at all.
|
|
464
499
|
*
|
|
@@ -491,9 +526,8 @@ uniform float uTextureRelief;
|
|
|
491
526
|
* how tight the lobe was made, because what makes a car body look wet is mostly the world
|
|
492
527
|
* in it rather than the lights on it.
|
|
493
528
|
*
|
|
494
|
-
* Off by default, so every scene written before it is unchanged.
|
|
529
|
+
* Off by default, so every scene written before it is unchanged. **y of \`uEnvironmentDials\`.**
|
|
495
530
|
*/
|
|
496
|
-
uniform float uReflectivity;
|
|
497
531
|
/**
|
|
498
532
|
* How bright the environment these surfaces reflect is, as a multiplier on it.
|
|
499
533
|
*
|
|
@@ -513,9 +547,8 @@ uniform float uReflectivity;
|
|
|
513
547
|
*
|
|
514
548
|
* Applies to whatever the surface reflects, probe or hemispheric approximation alike, and to the
|
|
515
549
|
* probe's own irradiance where a caller asked for that. **1 is the default and the identity**, so
|
|
516
|
-
* every scene written before this is unchanged.
|
|
550
|
+
* every scene written before this is unchanged. **z of \`uEnvironmentDials\`.**
|
|
517
551
|
*/
|
|
518
|
-
uniform float uEnvironmentGain;
|
|
519
552
|
/**
|
|
520
553
|
* The room itself, as a cubemap baked from one point, and whether one exists.
|
|
521
554
|
*
|
|
@@ -615,10 +648,12 @@ uniform float uProbeGridAmbient;
|
|
|
615
648
|
*/
|
|
616
649
|
uniform vec3 uProbeGridSets;
|
|
617
650
|
#endif
|
|
618
|
-
/**
|
|
651
|
+
/**
|
|
652
|
+
* A world-space box that lights up regardless of time of day: its corners, and in the far corner's
|
|
653
|
+
* w the gain — one row where a loose float was another (\`uniformVectorBudget.ts\`).
|
|
654
|
+
*/
|
|
619
655
|
uniform vec3 uHighlightMin;
|
|
620
|
-
uniform
|
|
621
|
-
uniform float uHighlightGain;
|
|
656
|
+
uniform vec4 uHighlightMax;
|
|
622
657
|
|
|
623
658
|
/*
|
|
624
659
|
* The froxel table, and the numbers needed to find a fragment's place in it.
|
|
@@ -762,8 +797,13 @@ uniform float uLightIesProfile[MAX_LIGHTS];
|
|
|
762
797
|
* tangent to a sphere, so any reference built from the aim alone flips somewhere — and the obvious
|
|
763
798
|
* constructions put that flip exactly where these fixtures point, \`cross(worldUp, dir)\` being
|
|
764
799
|
* singular for a light aimed straight down.
|
|
800
|
+
*
|
|
801
|
+
* **w is the light's lighting channels**, a mask compared with the material's (\`uCutout.w\`): a
|
|
802
|
+
* light shades a surface only where the two share a bit. In the lane the axis left, because an
|
|
803
|
+
* array of its own would be a row a light of a budget with none to spare; the froxel record keeps
|
|
804
|
+
* it beside the axis too, in the slot that was spare there.
|
|
765
805
|
*/
|
|
766
|
-
uniform
|
|
806
|
+
uniform vec4 uLightIesAxis[MAX_LIGHTS];
|
|
767
807
|
/**
|
|
768
808
|
* Which tile of the cookie atlas each light projects, or a negative index for none.
|
|
769
809
|
*
|
|
@@ -781,32 +821,29 @@ uniform float uLightCookie[MAX_LIGHTS];
|
|
|
781
821
|
* single row of ones, the multiplicative identity, because a declared sampler needs a complete
|
|
782
822
|
* texture whether or not the branch reads it and a row of zeros would switch off every light.
|
|
783
823
|
*/
|
|
784
|
-
/** Rows of profile in the fixture atlas, below its cookies. At least 1. */
|
|
785
|
-
uniform float uIesAtlasRows;
|
|
786
824
|
/**
|
|
787
|
-
*
|
|
788
|
-
*
|
|
789
|
-
*
|
|
790
|
-
*
|
|
791
|
-
*
|
|
792
|
-
*
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
*
|
|
797
|
-
*
|
|
798
|
-
*
|
|
799
|
-
*
|
|
800
|
-
*
|
|
801
|
-
*
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
uniform float uCookieTiles;
|
|
825
|
+
* The fixture atlas's shape, three numbers in one row — a row each would be three of a budget that
|
|
826
|
+
* has none to give (\`uniformVectorBudget.ts\`):
|
|
827
|
+
*
|
|
828
|
+
* - **x, rows of profile** below its cookies. At least 1.
|
|
829
|
+
* - **y, horizontal planes each profile occupies**, so a row is \`profile * planes + plane\`. 1 for
|
|
830
|
+
* an atlas with nothing asymmetric in it, which is nearly every atlas, and the whole plane path is
|
|
831
|
+
* branched away on that — see \`photometric\` in \`main.ts\`. One count for the atlas rather
|
|
832
|
+
* than one per profile, because a per-profile count would need a second number in a light's
|
|
833
|
+
* record to divide by, and a light's record is where space is expensive.
|
|
834
|
+
* - **z, cookie tiles**: one row of square tiles, one a fixture's mask. 0 when no consumer has
|
|
835
|
+
* loaded one, and the whole projection is branched away on it — a uniform is provably uniform
|
|
836
|
+
* control flow, so a scene with no cookie performs no arithmetic and no fetch. With none loaded
|
|
837
|
+
* the atlas holds a single white texel, the multiplicative identity, because a declared sampler
|
|
838
|
+
* needs a complete texture whether or not the branch reads it and a black stand-in would switch
|
|
839
|
+
* off every light that reached it.
|
|
840
|
+
*/
|
|
841
|
+
uniform vec3 uFixtureShape;
|
|
805
842
|
/**
|
|
806
843
|
* Both tables in one texture: the cookies' row of tiles in the top band, the profiles' rows below.
|
|
807
844
|
* One sampler for the two since 2026-09-30, because the lit stage bound fifteen of the sixteen
|
|
808
845
|
* WebGL2 guarantees; see \`fixtureAtlas.ts\`. The bands are found from \`textureSize\` and
|
|
809
|
-
* \`
|
|
846
|
+
* \`uFixtureShape.x\`, so the fold cost no uniform.
|
|
810
847
|
*/
|
|
811
848
|
uniform sampler2D uFixtureAtlas;
|
|
812
849
|
/**
|
|
@@ -17,11 +17,12 @@
|
|
|
17
17
|
* behind both, still glows. The shadow map's depth at the receiver would separate the two, and the
|
|
18
18
|
* lamp loop reads a visibility rather than a depth.
|
|
19
19
|
*
|
|
20
|
-
* **Under \`skinScattering: 'screen-space'\`** the surface is drawn in
|
|
21
|
-
*
|
|
22
|
-
* it is, because the blur that follows carries light across curvature
|
|
23
|
-
* picture and the fit as well would count it twice — keeping the
|
|
24
|
-
* cannot see
|
|
20
|
+
* **Under \`skinScattering: 'screen-space'\`** the surface is drawn in halves: the frame's without
|
|
21
|
+
* its diffuse; the diffuse's light alone into the blur's target, shaded on a white surface —
|
|
22
|
+
* Lambert's, with the shadow as it is, because the blur that follows carries light across curvature
|
|
23
|
+
* and shadow edges in the picture and the fit as well would count it twice — keeping the
|
|
24
|
+
* transmission, which the picture cannot see; and the colour alone, which the spread light is
|
|
25
|
+
* multiplied by. \`skinBlur.ts\` is the rest.
|
|
25
26
|
*
|
|
26
27
|
* **The highlight** is two GGX lobes — 0.85 at the material's roughness and 0.15 at 0.6 of it, for
|
|
27
28
|
* the skin's oil — normalised, with Smith's masking and the Fresnel of index 1.4, in lamp units, so
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const BLOOM_DOWNSAMPLE_FRAG_WGSL = "struct Uniforms {\n uTexel: vec2<f32>,\n}\n\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn fetch_u0028_vf2_u003b(uv: ptr<function, vec2<f32>>) -> vec3<f32> {\n let _e27 = (*uv);\n let _e28 = textureSampleLevel(uSource_t, uSource_s, _e27, 0f);\n return _e28.xyz;\n}\n\nfn main_1() {\n var t: vec2<f32>;\n var a: vec3<f32>;\n var param: vec2<f32>;\n var b: vec3<f32>;\n var param_1: vec2<f32>;\n var c: vec3<f32>;\n var param_2: vec2<f32>;\n var d: vec3<f32>;\n var param_3: vec2<f32>;\n var e: vec3<f32>;\n var param_4: vec2<f32>;\n var f: vec3<f32>;\n var param_5: vec2<f32>;\n var g: vec3<f32>;\n var param_6: vec2<f32>;\n var h: vec3<f32>;\n var param_7: vec2<f32>;\n var i: vec3<f32>;\n var param_8: vec2<f32>;\n var j: vec3<f32>;\n var param_9: vec2<f32>;\n var k: vec3<f32>;\n var param_10: vec2<f32>;\n var l: vec3<f32>;\n var param_11: vec2<f32>;\n var m: vec3<f32>;\n var param_12: vec2<f32>;\n var box0_: vec3<f32>;\n var box1_: vec3<f32>;\n var box2_: vec3<f32>;\n var box3_: vec3<f32>;\n var box4_: vec3<f32>;\n\n let _e59 = unnamed.uTexel;\n t = _e59;\n let _e60 = vUv_1;\n let _e61 = t;\n param = (_e60 + (vec2<f32>(-2f, 2f) * _e61));\n let _e64 = fetch_u0028_vf2_u003b((¶m));\n a = _e64;\n let _e65 = vUv_1;\n let _e66 = t;\n param_1 = (_e65 + (vec2<f32>(0f, 2f) * _e66));\n let _e69 = fetch_u0028_vf2_u003b((¶m_1));\n b = _e69;\n let _e70 = vUv_1;\n let _e71 = t;\n param_2 = (_e70 + (vec2<f32>(2f, 2f) * _e71));\n let _e74 = fetch_u0028_vf2_u003b((¶m_2));\n c = _e74;\n let _e75 = vUv_1;\n let _e76 = t;\n param_3 = (_e75 + (vec2<f32>(-2f, 0f) * _e76));\n let _e79 = fetch_u0028_vf2_u003b((¶m_3));\n d = _e79;\n let _e80 = vUv_1;\n param_4 = _e80;\n let _e81 = fetch_u0028_vf2_u003b((¶m_4));\n e = _e81;\n let _e82 = vUv_1;\n let _e83 = t;\n param_5 = (_e82 + (vec2<f32>(2f, 0f) * _e83));\n let _e86 = fetch_u0028_vf2_u003b((¶m_5));\n f = _e86;\n let _e87 = vUv_1;\n let _e88 = t;\n param_6 = (_e87 + (vec2<f32>(-2f, -2f) * _e88));\n let _e91 = fetch_u0028_vf2_u003b((¶m_6));\n g = _e91;\n let _e92 = vUv_1;\n let _e93 = t;\n param_7 = (_e92 + (vec2<f32>(0f, -2f) * _e93));\n let _e96 = fetch_u0028_vf2_u003b((¶m_7));\n h = _e96;\n let _e97 = vUv_1;\n let _e98 = t;\n param_8 = (_e97 + (vec2<f32>(2f, -2f) * _e98));\n let _e101 = fetch_u0028_vf2_u003b((¶m_8));\n i = _e101;\n let _e102 = vUv_1;\n let _e103 = t;\n param_9 = (_e102 + (vec2<f32>(-1f, 1f) * _e103));\n let _e106 = fetch_u0028_vf2_u003b((¶m_9));\n j = _e106;\n let _e107 = vUv_1;\n let _e108 = t;\n param_10 = (_e107 + (vec2<f32>(1f, 1f) * _e108));\n let _e111 = fetch_u0028_vf2_u003b((¶m_10));\n k = _e111;\n let _e112 = vUv_1;\n let _e113 = t;\n param_11 = (_e112 + (vec2<f32>(-1f, -1f) * _e113));\n let _e116 = fetch_u0028_vf2_u003b((¶m_11));\n l = _e116;\n let _e117 = vUv_1;\n let _e118 = t;\n param_12 = (_e117 + (vec2<f32>(1f, -1f) * _e118));\n let _e121 = fetch_u0028_vf2_u003b((¶m_12));\n m = _e121;\n let _e122 = a;\n let _e123 = b;\n let _e125 = d;\n let _e127 = e;\n box0_ = ((((_e122 + _e123) + _e125) + _e127) * 0.25f);\n let _e130 = b;\n let _e131 = c;\n let _e133 = e;\n let _e135 = f;\n box1_ = ((((_e130 + _e131) + _e133) + _e135) * 0.25f);\n let _e138 = d;\n let _e139 = e;\n let _e141 = g;\n let _e143 = h;\n box2_ = ((((_e138 + _e139) + _e141) + _e143) * 0.25f);\n let _e146 = e;\n let _e147 = f;\n let _e149 = h;\n let _e151 = i;\n box3_ = ((((_e146 + _e147) + _e149) + _e151) * 0.25f);\n let _e154 = j;\n let _e155 = k;\n let _e157 = l;\n let _e159 = m;\n box4_ = ((((_e154 + _e155) + _e157) + _e159) * 0.25f);\n let _e162 = box4_;\n let _e164 = box0_;\n let _e165 = box1_;\n let _e167 = box2_;\n let _e169 = box3_;\n let _e172 = ((_e162 * 0.5f) + ((((_e164 + _e165) + _e167) + _e169) * 0.125f));\n fragColor = vec4<f32>(_e172.x, _e172.y, _e172.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vUv: vec2<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n main_1();\n let _e3 = fragColor;\n return _e3;\n}\n";
|
|
2
|
-
export declare const BLOOM_PREFILTER_FRAG_WGSL = "struct Uniforms {\n uTexel: vec2<f32>,\n uThreshold: f32,\n}\n\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn brightness_u0028_vf3_u003b(c: ptr<function, vec3<f32>>) -> f32 {\n let
|
|
3
|
-
export declare const BLOOM_UPSAMPLE_FRAG_WGSL = "struct Uniforms {\n uRadius: f32,\n}\n\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn main_1() {\n var r: f32;\n var a: vec3<f32>;\n var b: vec3<f32>;\n var c: vec3<f32>;\n var d: vec3<f32>;\n var e: vec3<f32>;\n var f: vec3<f32>;\n var g: vec3<f32>;\n var h: vec3<f32>;\n var i: vec3<f32>;\n var sum: vec3<f32>;\n\n let
|
|
2
|
+
export declare const BLOOM_PREFILTER_FRAG_WGSL = "struct Uniforms {\n uTexel: vec2<f32>,\n uThreshold: f32,\n uRamp: f32,\n}\n\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn brightness_u0028_vf3_u003b(c: ptr<function, vec3<f32>>) -> f32 {\n let _e36 = (*c)[0u];\n let _e38 = (*c)[1u];\n let _e40 = (*c)[2u];\n return max(_e36, max(_e38, _e40));\n}\n\nfn firefly_u0028_vf3_u003b(c_1: ptr<function, vec3<f32>>) -> f32 {\n var param: vec3<f32>;\n\n let _e36 = (*c_1);\n param = _e36;\n let _e37 = brightness_u0028_vf3_u003b((¶m));\n return (1f / (1f + _e37));\n}\n\nfn fetch_u0028_vf2_u003b(uv: ptr<function, vec2<f32>>) -> vec3<f32> {\n var c_2: vec3<f32>;\n var bright: f32;\n var param_1: vec3<f32>;\n\n let _e38 = (*uv);\n let _e39 = textureSampleLevel(uSource_t, uSource_s, _e38, 0f);\n c_2 = min(_e39.xyz, vec3<f32>(256f, 256f, 256f));\n let _e42 = c_2;\n param_1 = _e42;\n let _e43 = brightness_u0028_vf3_u003b((¶m_1));\n bright = _e43;\n let _e45 = unnamed.uRamp;\n if (_e45 > 0f) {\n let _e47 = c_2;\n let _e48 = bright;\n let _e50 = unnamed.uThreshold;\n let _e53 = unnamed.uRamp;\n return (_e47 * clamp(((_e48 - _e50) / _e53), 0f, 1f));\n }\n let _e57 = c_2;\n let _e58 = bright;\n let _e60 = unnamed.uThreshold;\n let _e63 = bright;\n return (_e57 * (max((_e58 - _e60), 0f) / max(_e63, 0.0001f)));\n}\n\nfn main_1() {\n var t: vec2<f32>;\n var a: vec3<f32>;\n var param_2: vec2<f32>;\n var b: vec3<f32>;\n var param_3: vec2<f32>;\n var c_3: vec3<f32>;\n var param_4: vec2<f32>;\n var d: vec3<f32>;\n var param_5: vec2<f32>;\n var e: vec3<f32>;\n var param_6: vec2<f32>;\n var f: vec3<f32>;\n var param_7: vec2<f32>;\n var g: vec3<f32>;\n var param_8: vec2<f32>;\n var h: vec3<f32>;\n var param_9: vec2<f32>;\n var i: vec3<f32>;\n var param_10: vec2<f32>;\n var j: vec3<f32>;\n var param_11: vec2<f32>;\n var k: vec3<f32>;\n var param_12: vec2<f32>;\n var l: vec3<f32>;\n var param_13: vec2<f32>;\n var m: vec3<f32>;\n var param_14: vec2<f32>;\n var box0_: vec3<f32>;\n var box1_: vec3<f32>;\n var box2_: vec3<f32>;\n var box3_: vec3<f32>;\n var box4_: vec3<f32>;\n var w0_: f32;\n var param_15: vec3<f32>;\n var w1_: f32;\n var param_16: vec3<f32>;\n var w2_: f32;\n var param_17: vec3<f32>;\n var w3_: f32;\n var param_18: vec3<f32>;\n var w4_: f32;\n var param_19: vec3<f32>;\n var sum: vec3<f32>;\n\n let _e78 = unnamed.uTexel;\n t = _e78;\n let _e79 = vUv_1;\n let _e80 = t;\n param_2 = (_e79 + (vec2<f32>(-2f, 2f) * _e80));\n let _e83 = fetch_u0028_vf2_u003b((¶m_2));\n a = _e83;\n let _e84 = vUv_1;\n let _e85 = t;\n param_3 = (_e84 + (vec2<f32>(0f, 2f) * _e85));\n let _e88 = fetch_u0028_vf2_u003b((¶m_3));\n b = _e88;\n let _e89 = vUv_1;\n let _e90 = t;\n param_4 = (_e89 + (vec2<f32>(2f, 2f) * _e90));\n let _e93 = fetch_u0028_vf2_u003b((¶m_4));\n c_3 = _e93;\n let _e94 = vUv_1;\n let _e95 = t;\n param_5 = (_e94 + (vec2<f32>(-2f, 0f) * _e95));\n let _e98 = fetch_u0028_vf2_u003b((¶m_5));\n d = _e98;\n let _e99 = vUv_1;\n param_6 = _e99;\n let _e100 = fetch_u0028_vf2_u003b((¶m_6));\n e = _e100;\n let _e101 = vUv_1;\n let _e102 = t;\n param_7 = (_e101 + (vec2<f32>(2f, 0f) * _e102));\n let _e105 = fetch_u0028_vf2_u003b((¶m_7));\n f = _e105;\n let _e106 = vUv_1;\n let _e107 = t;\n param_8 = (_e106 + (vec2<f32>(-2f, -2f) * _e107));\n let _e110 = fetch_u0028_vf2_u003b((¶m_8));\n g = _e110;\n let _e111 = vUv_1;\n let _e112 = t;\n param_9 = (_e111 + (vec2<f32>(0f, -2f) * _e112));\n let _e115 = fetch_u0028_vf2_u003b((¶m_9));\n h = _e115;\n let _e116 = vUv_1;\n let _e117 = t;\n param_10 = (_e116 + (vec2<f32>(2f, -2f) * _e117));\n let _e120 = fetch_u0028_vf2_u003b((¶m_10));\n i = _e120;\n let _e121 = vUv_1;\n let _e122 = t;\n param_11 = (_e121 + (vec2<f32>(-1f, 1f) * _e122));\n let _e125 = fetch_u0028_vf2_u003b((¶m_11));\n j = _e125;\n let _e126 = vUv_1;\n let _e127 = t;\n param_12 = (_e126 + (vec2<f32>(1f, 1f) * _e127));\n let _e130 = fetch_u0028_vf2_u003b((¶m_12));\n k = _e130;\n let _e131 = vUv_1;\n let _e132 = t;\n param_13 = (_e131 + (vec2<f32>(-1f, -1f) * _e132));\n let _e135 = fetch_u0028_vf2_u003b((¶m_13));\n l = _e135;\n let _e136 = vUv_1;\n let _e137 = t;\n param_14 = (_e136 + (vec2<f32>(1f, -1f) * _e137));\n let _e140 = fetch_u0028_vf2_u003b((¶m_14));\n m = _e140;\n let _e141 = a;\n let _e142 = b;\n let _e144 = d;\n let _e146 = e;\n box0_ = ((((_e141 + _e142) + _e144) + _e146) * 0.25f);\n let _e149 = b;\n let _e150 = c_3;\n let _e152 = e;\n let _e154 = f;\n box1_ = ((((_e149 + _e150) + _e152) + _e154) * 0.25f);\n let _e157 = d;\n let _e158 = e;\n let _e160 = g;\n let _e162 = h;\n box2_ = ((((_e157 + _e158) + _e160) + _e162) * 0.25f);\n let _e165 = e;\n let _e166 = f;\n let _e168 = h;\n let _e170 = i;\n box3_ = ((((_e165 + _e166) + _e168) + _e170) * 0.25f);\n let _e173 = j;\n let _e174 = k;\n let _e176 = l;\n let _e178 = m;\n box4_ = ((((_e173 + _e174) + _e176) + _e178) * 0.25f);\n let _e181 = box0_;\n param_15 = _e181;\n let _e182 = firefly_u0028_vf3_u003b((¶m_15));\n w0_ = (_e182 * 0.125f);\n let _e184 = box1_;\n param_16 = _e184;\n let _e185 = firefly_u0028_vf3_u003b((¶m_16));\n w1_ = (_e185 * 0.125f);\n let _e187 = box2_;\n param_17 = _e187;\n let _e188 = firefly_u0028_vf3_u003b((¶m_17));\n w2_ = (_e188 * 0.125f);\n let _e190 = box3_;\n param_18 = _e190;\n let _e191 = firefly_u0028_vf3_u003b((¶m_18));\n w3_ = (_e191 * 0.125f);\n let _e193 = box4_;\n param_19 = _e193;\n let _e194 = firefly_u0028_vf3_u003b((¶m_19));\n w4_ = (_e194 * 0.5f);\n let _e196 = box0_;\n let _e197 = w0_;\n let _e199 = box1_;\n let _e200 = w1_;\n let _e203 = box2_;\n let _e204 = w2_;\n let _e207 = box3_;\n let _e208 = w3_;\n let _e211 = box4_;\n let _e212 = w4_;\n sum = (((((_e196 * _e197) + (_e199 * _e200)) + (_e203 * _e204)) + (_e207 * _e208)) + (_e211 * _e212));\n let _e215 = sum;\n let _e216 = w0_;\n let _e217 = w1_;\n let _e219 = w2_;\n let _e221 = w3_;\n let _e223 = w4_;\n let _e227 = (_e215 / vec3(max(((((_e216 + _e217) + _e219) + _e221) + _e223), 0.0001f)));\n fragColor = vec4<f32>(_e227.x, _e227.y, _e227.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vUv: vec2<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n main_1();\n let _e3 = fragColor;\n return _e3;\n}\n";
|
|
3
|
+
export declare const BLOOM_UPSAMPLE_FRAG_WGSL = "struct Uniforms {\n uScale: vec3<f32>,\n uRadius: f32,\n}\n\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn main_1() {\n var r: f32;\n var a: vec3<f32>;\n var b: vec3<f32>;\n var c: vec3<f32>;\n var d: vec3<f32>;\n var e: vec3<f32>;\n var f: vec3<f32>;\n var g: vec3<f32>;\n var h: vec3<f32>;\n var i: vec3<f32>;\n var sum: vec3<f32>;\n\n let _e24 = unnamed.uRadius;\n r = _e24;\n let _e25 = vUv_1;\n let _e26 = r;\n let _e28 = r;\n let _e31 = textureSampleLevel(uSource_t, uSource_s, (_e25 + vec2<f32>(-(_e26), _e28)), 0f);\n a = _e31.xyz;\n let _e33 = vUv_1;\n let _e34 = r;\n let _e37 = textureSampleLevel(uSource_t, uSource_s, (_e33 + vec2<f32>(0f, _e34)), 0f);\n b = _e37.xyz;\n let _e39 = vUv_1;\n let _e40 = r;\n let _e41 = r;\n let _e44 = textureSampleLevel(uSource_t, uSource_s, (_e39 + vec2<f32>(_e40, _e41)), 0f);\n c = _e44.xyz;\n let _e46 = vUv_1;\n let _e47 = r;\n let _e51 = textureSampleLevel(uSource_t, uSource_s, (_e46 + vec2<f32>(-(_e47), 0f)), 0f);\n d = _e51.xyz;\n let _e53 = vUv_1;\n let _e54 = textureSampleLevel(uSource_t, uSource_s, _e53, 0f);\n e = _e54.xyz;\n let _e56 = vUv_1;\n let _e57 = r;\n let _e60 = textureSampleLevel(uSource_t, uSource_s, (_e56 + vec2<f32>(_e57, 0f)), 0f);\n f = _e60.xyz;\n let _e62 = vUv_1;\n let _e63 = r;\n let _e65 = r;\n let _e69 = textureSampleLevel(uSource_t, uSource_s, (_e62 + vec2<f32>(-(_e63), -(_e65))), 0f);\n g = _e69.xyz;\n let _e71 = vUv_1;\n let _e72 = r;\n let _e76 = textureSampleLevel(uSource_t, uSource_s, (_e71 + vec2<f32>(0f, -(_e72))), 0f);\n h = _e76.xyz;\n let _e78 = vUv_1;\n let _e79 = r;\n let _e80 = r;\n let _e84 = textureSampleLevel(uSource_t, uSource_s, (_e78 + vec2<f32>(_e79, -(_e80))), 0f);\n i = _e84.xyz;\n let _e86 = e;\n let _e88 = b;\n let _e89 = d;\n let _e91 = f;\n let _e93 = h;\n let _e97 = a;\n let _e98 = c;\n let _e100 = g;\n let _e102 = i;\n sum = (((_e86 * 4f) + ((((_e88 + _e89) + _e91) + _e93) * 2f)) + (((_e97 + _e98) + _e100) + _e102));\n let _e105 = sum;\n let _e108 = unnamed.uScale;\n let _e109 = ((_e105 * 0.0625f) * _e108);\n fragColor = vec4<f32>(_e109.x, _e109.y, _e109.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vUv: vec2<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n main_1();\n let _e3 = fragColor;\n return _e3;\n}\n";
|
|
4
4
|
/**
|
|
5
5
|
* What the transform assigned, so the renderer binds the same numbers.
|
|
6
6
|
*
|
|
@@ -39,6 +39,11 @@ export declare const BLOOM_BINDINGS: {
|
|
|
39
39
|
readonly size: 4;
|
|
40
40
|
readonly type: "float";
|
|
41
41
|
};
|
|
42
|
+
readonly uRamp: {
|
|
43
|
+
readonly offset: 12;
|
|
44
|
+
readonly size: 4;
|
|
45
|
+
readonly type: "float";
|
|
46
|
+
};
|
|
42
47
|
};
|
|
43
48
|
readonly textures: {
|
|
44
49
|
readonly uSource: {
|
|
@@ -52,8 +57,13 @@ export declare const BLOOM_BINDINGS: {
|
|
|
52
57
|
readonly uniforms: 1;
|
|
53
58
|
readonly uniformSize: 16;
|
|
54
59
|
readonly fields: {
|
|
55
|
-
readonly
|
|
60
|
+
readonly uScale: {
|
|
56
61
|
readonly offset: 0;
|
|
62
|
+
readonly size: 12;
|
|
63
|
+
readonly type: "vec3";
|
|
64
|
+
};
|
|
65
|
+
readonly uRadius: {
|
|
66
|
+
readonly offset: 12;
|
|
57
67
|
readonly size: 4;
|
|
58
68
|
readonly type: "float";
|
|
59
69
|
};
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* the next generation, and `npm run wgsl:check` fails the build when this is stale.
|
|
6
6
|
*/
|
|
7
7
|
export const BLOOM_DOWNSAMPLE_FRAG_WGSL = "struct Uniforms {\n uTexel: vec2<f32>,\n}\n\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn fetch_u0028_vf2_u003b(uv: ptr<function, vec2<f32>>) -> vec3<f32> {\n let _e27 = (*uv);\n let _e28 = textureSampleLevel(uSource_t, uSource_s, _e27, 0f);\n return _e28.xyz;\n}\n\nfn main_1() {\n var t: vec2<f32>;\n var a: vec3<f32>;\n var param: vec2<f32>;\n var b: vec3<f32>;\n var param_1: vec2<f32>;\n var c: vec3<f32>;\n var param_2: vec2<f32>;\n var d: vec3<f32>;\n var param_3: vec2<f32>;\n var e: vec3<f32>;\n var param_4: vec2<f32>;\n var f: vec3<f32>;\n var param_5: vec2<f32>;\n var g: vec3<f32>;\n var param_6: vec2<f32>;\n var h: vec3<f32>;\n var param_7: vec2<f32>;\n var i: vec3<f32>;\n var param_8: vec2<f32>;\n var j: vec3<f32>;\n var param_9: vec2<f32>;\n var k: vec3<f32>;\n var param_10: vec2<f32>;\n var l: vec3<f32>;\n var param_11: vec2<f32>;\n var m: vec3<f32>;\n var param_12: vec2<f32>;\n var box0_: vec3<f32>;\n var box1_: vec3<f32>;\n var box2_: vec3<f32>;\n var box3_: vec3<f32>;\n var box4_: vec3<f32>;\n\n let _e59 = unnamed.uTexel;\n t = _e59;\n let _e60 = vUv_1;\n let _e61 = t;\n param = (_e60 + (vec2<f32>(-2f, 2f) * _e61));\n let _e64 = fetch_u0028_vf2_u003b((¶m));\n a = _e64;\n let _e65 = vUv_1;\n let _e66 = t;\n param_1 = (_e65 + (vec2<f32>(0f, 2f) * _e66));\n let _e69 = fetch_u0028_vf2_u003b((¶m_1));\n b = _e69;\n let _e70 = vUv_1;\n let _e71 = t;\n param_2 = (_e70 + (vec2<f32>(2f, 2f) * _e71));\n let _e74 = fetch_u0028_vf2_u003b((¶m_2));\n c = _e74;\n let _e75 = vUv_1;\n let _e76 = t;\n param_3 = (_e75 + (vec2<f32>(-2f, 0f) * _e76));\n let _e79 = fetch_u0028_vf2_u003b((¶m_3));\n d = _e79;\n let _e80 = vUv_1;\n param_4 = _e80;\n let _e81 = fetch_u0028_vf2_u003b((¶m_4));\n e = _e81;\n let _e82 = vUv_1;\n let _e83 = t;\n param_5 = (_e82 + (vec2<f32>(2f, 0f) * _e83));\n let _e86 = fetch_u0028_vf2_u003b((¶m_5));\n f = _e86;\n let _e87 = vUv_1;\n let _e88 = t;\n param_6 = (_e87 + (vec2<f32>(-2f, -2f) * _e88));\n let _e91 = fetch_u0028_vf2_u003b((¶m_6));\n g = _e91;\n let _e92 = vUv_1;\n let _e93 = t;\n param_7 = (_e92 + (vec2<f32>(0f, -2f) * _e93));\n let _e96 = fetch_u0028_vf2_u003b((¶m_7));\n h = _e96;\n let _e97 = vUv_1;\n let _e98 = t;\n param_8 = (_e97 + (vec2<f32>(2f, -2f) * _e98));\n let _e101 = fetch_u0028_vf2_u003b((¶m_8));\n i = _e101;\n let _e102 = vUv_1;\n let _e103 = t;\n param_9 = (_e102 + (vec2<f32>(-1f, 1f) * _e103));\n let _e106 = fetch_u0028_vf2_u003b((¶m_9));\n j = _e106;\n let _e107 = vUv_1;\n let _e108 = t;\n param_10 = (_e107 + (vec2<f32>(1f, 1f) * _e108));\n let _e111 = fetch_u0028_vf2_u003b((¶m_10));\n k = _e111;\n let _e112 = vUv_1;\n let _e113 = t;\n param_11 = (_e112 + (vec2<f32>(-1f, -1f) * _e113));\n let _e116 = fetch_u0028_vf2_u003b((¶m_11));\n l = _e116;\n let _e117 = vUv_1;\n let _e118 = t;\n param_12 = (_e117 + (vec2<f32>(1f, -1f) * _e118));\n let _e121 = fetch_u0028_vf2_u003b((¶m_12));\n m = _e121;\n let _e122 = a;\n let _e123 = b;\n let _e125 = d;\n let _e127 = e;\n box0_ = ((((_e122 + _e123) + _e125) + _e127) * 0.25f);\n let _e130 = b;\n let _e131 = c;\n let _e133 = e;\n let _e135 = f;\n box1_ = ((((_e130 + _e131) + _e133) + _e135) * 0.25f);\n let _e138 = d;\n let _e139 = e;\n let _e141 = g;\n let _e143 = h;\n box2_ = ((((_e138 + _e139) + _e141) + _e143) * 0.25f);\n let _e146 = e;\n let _e147 = f;\n let _e149 = h;\n let _e151 = i;\n box3_ = ((((_e146 + _e147) + _e149) + _e151) * 0.25f);\n let _e154 = j;\n let _e155 = k;\n let _e157 = l;\n let _e159 = m;\n box4_ = ((((_e154 + _e155) + _e157) + _e159) * 0.25f);\n let _e162 = box4_;\n let _e164 = box0_;\n let _e165 = box1_;\n let _e167 = box2_;\n let _e169 = box3_;\n let _e172 = ((_e162 * 0.5f) + ((((_e164 + _e165) + _e167) + _e169) * 0.125f));\n fragColor = vec4<f32>(_e172.x, _e172.y, _e172.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vUv: vec2<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n main_1();\n let _e3 = fragColor;\n return _e3;\n}\n";
|
|
8
|
-
export const BLOOM_PREFILTER_FRAG_WGSL = "struct Uniforms {\n uTexel: vec2<f32>,\n uThreshold: f32,\n}\n\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn brightness_u0028_vf3_u003b(c: ptr<function, vec3<f32>>) -> f32 {\n let
|
|
9
|
-
export const BLOOM_UPSAMPLE_FRAG_WGSL = "struct Uniforms {\n uRadius: f32,\n}\n\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn main_1() {\n var r: f32;\n var a: vec3<f32>;\n var b: vec3<f32>;\n var c: vec3<f32>;\n var d: vec3<f32>;\n var e: vec3<f32>;\n var f: vec3<f32>;\n var g: vec3<f32>;\n var h: vec3<f32>;\n var i: vec3<f32>;\n var sum: vec3<f32>;\n\n let
|
|
8
|
+
export const BLOOM_PREFILTER_FRAG_WGSL = "struct Uniforms {\n uTexel: vec2<f32>,\n uThreshold: f32,\n uRamp: f32,\n}\n\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn brightness_u0028_vf3_u003b(c: ptr<function, vec3<f32>>) -> f32 {\n let _e36 = (*c)[0u];\n let _e38 = (*c)[1u];\n let _e40 = (*c)[2u];\n return max(_e36, max(_e38, _e40));\n}\n\nfn firefly_u0028_vf3_u003b(c_1: ptr<function, vec3<f32>>) -> f32 {\n var param: vec3<f32>;\n\n let _e36 = (*c_1);\n param = _e36;\n let _e37 = brightness_u0028_vf3_u003b((¶m));\n return (1f / (1f + _e37));\n}\n\nfn fetch_u0028_vf2_u003b(uv: ptr<function, vec2<f32>>) -> vec3<f32> {\n var c_2: vec3<f32>;\n var bright: f32;\n var param_1: vec3<f32>;\n\n let _e38 = (*uv);\n let _e39 = textureSampleLevel(uSource_t, uSource_s, _e38, 0f);\n c_2 = min(_e39.xyz, vec3<f32>(256f, 256f, 256f));\n let _e42 = c_2;\n param_1 = _e42;\n let _e43 = brightness_u0028_vf3_u003b((¶m_1));\n bright = _e43;\n let _e45 = unnamed.uRamp;\n if (_e45 > 0f) {\n let _e47 = c_2;\n let _e48 = bright;\n let _e50 = unnamed.uThreshold;\n let _e53 = unnamed.uRamp;\n return (_e47 * clamp(((_e48 - _e50) / _e53), 0f, 1f));\n }\n let _e57 = c_2;\n let _e58 = bright;\n let _e60 = unnamed.uThreshold;\n let _e63 = bright;\n return (_e57 * (max((_e58 - _e60), 0f) / max(_e63, 0.0001f)));\n}\n\nfn main_1() {\n var t: vec2<f32>;\n var a: vec3<f32>;\n var param_2: vec2<f32>;\n var b: vec3<f32>;\n var param_3: vec2<f32>;\n var c_3: vec3<f32>;\n var param_4: vec2<f32>;\n var d: vec3<f32>;\n var param_5: vec2<f32>;\n var e: vec3<f32>;\n var param_6: vec2<f32>;\n var f: vec3<f32>;\n var param_7: vec2<f32>;\n var g: vec3<f32>;\n var param_8: vec2<f32>;\n var h: vec3<f32>;\n var param_9: vec2<f32>;\n var i: vec3<f32>;\n var param_10: vec2<f32>;\n var j: vec3<f32>;\n var param_11: vec2<f32>;\n var k: vec3<f32>;\n var param_12: vec2<f32>;\n var l: vec3<f32>;\n var param_13: vec2<f32>;\n var m: vec3<f32>;\n var param_14: vec2<f32>;\n var box0_: vec3<f32>;\n var box1_: vec3<f32>;\n var box2_: vec3<f32>;\n var box3_: vec3<f32>;\n var box4_: vec3<f32>;\n var w0_: f32;\n var param_15: vec3<f32>;\n var w1_: f32;\n var param_16: vec3<f32>;\n var w2_: f32;\n var param_17: vec3<f32>;\n var w3_: f32;\n var param_18: vec3<f32>;\n var w4_: f32;\n var param_19: vec3<f32>;\n var sum: vec3<f32>;\n\n let _e78 = unnamed.uTexel;\n t = _e78;\n let _e79 = vUv_1;\n let _e80 = t;\n param_2 = (_e79 + (vec2<f32>(-2f, 2f) * _e80));\n let _e83 = fetch_u0028_vf2_u003b((¶m_2));\n a = _e83;\n let _e84 = vUv_1;\n let _e85 = t;\n param_3 = (_e84 + (vec2<f32>(0f, 2f) * _e85));\n let _e88 = fetch_u0028_vf2_u003b((¶m_3));\n b = _e88;\n let _e89 = vUv_1;\n let _e90 = t;\n param_4 = (_e89 + (vec2<f32>(2f, 2f) * _e90));\n let _e93 = fetch_u0028_vf2_u003b((¶m_4));\n c_3 = _e93;\n let _e94 = vUv_1;\n let _e95 = t;\n param_5 = (_e94 + (vec2<f32>(-2f, 0f) * _e95));\n let _e98 = fetch_u0028_vf2_u003b((¶m_5));\n d = _e98;\n let _e99 = vUv_1;\n param_6 = _e99;\n let _e100 = fetch_u0028_vf2_u003b((¶m_6));\n e = _e100;\n let _e101 = vUv_1;\n let _e102 = t;\n param_7 = (_e101 + (vec2<f32>(2f, 0f) * _e102));\n let _e105 = fetch_u0028_vf2_u003b((¶m_7));\n f = _e105;\n let _e106 = vUv_1;\n let _e107 = t;\n param_8 = (_e106 + (vec2<f32>(-2f, -2f) * _e107));\n let _e110 = fetch_u0028_vf2_u003b((¶m_8));\n g = _e110;\n let _e111 = vUv_1;\n let _e112 = t;\n param_9 = (_e111 + (vec2<f32>(0f, -2f) * _e112));\n let _e115 = fetch_u0028_vf2_u003b((¶m_9));\n h = _e115;\n let _e116 = vUv_1;\n let _e117 = t;\n param_10 = (_e116 + (vec2<f32>(2f, -2f) * _e117));\n let _e120 = fetch_u0028_vf2_u003b((¶m_10));\n i = _e120;\n let _e121 = vUv_1;\n let _e122 = t;\n param_11 = (_e121 + (vec2<f32>(-1f, 1f) * _e122));\n let _e125 = fetch_u0028_vf2_u003b((¶m_11));\n j = _e125;\n let _e126 = vUv_1;\n let _e127 = t;\n param_12 = (_e126 + (vec2<f32>(1f, 1f) * _e127));\n let _e130 = fetch_u0028_vf2_u003b((¶m_12));\n k = _e130;\n let _e131 = vUv_1;\n let _e132 = t;\n param_13 = (_e131 + (vec2<f32>(-1f, -1f) * _e132));\n let _e135 = fetch_u0028_vf2_u003b((¶m_13));\n l = _e135;\n let _e136 = vUv_1;\n let _e137 = t;\n param_14 = (_e136 + (vec2<f32>(1f, -1f) * _e137));\n let _e140 = fetch_u0028_vf2_u003b((¶m_14));\n m = _e140;\n let _e141 = a;\n let _e142 = b;\n let _e144 = d;\n let _e146 = e;\n box0_ = ((((_e141 + _e142) + _e144) + _e146) * 0.25f);\n let _e149 = b;\n let _e150 = c_3;\n let _e152 = e;\n let _e154 = f;\n box1_ = ((((_e149 + _e150) + _e152) + _e154) * 0.25f);\n let _e157 = d;\n let _e158 = e;\n let _e160 = g;\n let _e162 = h;\n box2_ = ((((_e157 + _e158) + _e160) + _e162) * 0.25f);\n let _e165 = e;\n let _e166 = f;\n let _e168 = h;\n let _e170 = i;\n box3_ = ((((_e165 + _e166) + _e168) + _e170) * 0.25f);\n let _e173 = j;\n let _e174 = k;\n let _e176 = l;\n let _e178 = m;\n box4_ = ((((_e173 + _e174) + _e176) + _e178) * 0.25f);\n let _e181 = box0_;\n param_15 = _e181;\n let _e182 = firefly_u0028_vf3_u003b((¶m_15));\n w0_ = (_e182 * 0.125f);\n let _e184 = box1_;\n param_16 = _e184;\n let _e185 = firefly_u0028_vf3_u003b((¶m_16));\n w1_ = (_e185 * 0.125f);\n let _e187 = box2_;\n param_17 = _e187;\n let _e188 = firefly_u0028_vf3_u003b((¶m_17));\n w2_ = (_e188 * 0.125f);\n let _e190 = box3_;\n param_18 = _e190;\n let _e191 = firefly_u0028_vf3_u003b((¶m_18));\n w3_ = (_e191 * 0.125f);\n let _e193 = box4_;\n param_19 = _e193;\n let _e194 = firefly_u0028_vf3_u003b((¶m_19));\n w4_ = (_e194 * 0.5f);\n let _e196 = box0_;\n let _e197 = w0_;\n let _e199 = box1_;\n let _e200 = w1_;\n let _e203 = box2_;\n let _e204 = w2_;\n let _e207 = box3_;\n let _e208 = w3_;\n let _e211 = box4_;\n let _e212 = w4_;\n sum = (((((_e196 * _e197) + (_e199 * _e200)) + (_e203 * _e204)) + (_e207 * _e208)) + (_e211 * _e212));\n let _e215 = sum;\n let _e216 = w0_;\n let _e217 = w1_;\n let _e219 = w2_;\n let _e221 = w3_;\n let _e223 = w4_;\n let _e227 = (_e215 / vec3(max(((((_e216 + _e217) + _e219) + _e221) + _e223), 0.0001f)));\n fragColor = vec4<f32>(_e227.x, _e227.y, _e227.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vUv: vec2<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n main_1();\n let _e3 = fragColor;\n return _e3;\n}\n";
|
|
9
|
+
export const BLOOM_UPSAMPLE_FRAG_WGSL = "struct Uniforms {\n uScale: vec3<f32>,\n uRadius: f32,\n}\n\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn main_1() {\n var r: f32;\n var a: vec3<f32>;\n var b: vec3<f32>;\n var c: vec3<f32>;\n var d: vec3<f32>;\n var e: vec3<f32>;\n var f: vec3<f32>;\n var g: vec3<f32>;\n var h: vec3<f32>;\n var i: vec3<f32>;\n var sum: vec3<f32>;\n\n let _e24 = unnamed.uRadius;\n r = _e24;\n let _e25 = vUv_1;\n let _e26 = r;\n let _e28 = r;\n let _e31 = textureSampleLevel(uSource_t, uSource_s, (_e25 + vec2<f32>(-(_e26), _e28)), 0f);\n a = _e31.xyz;\n let _e33 = vUv_1;\n let _e34 = r;\n let _e37 = textureSampleLevel(uSource_t, uSource_s, (_e33 + vec2<f32>(0f, _e34)), 0f);\n b = _e37.xyz;\n let _e39 = vUv_1;\n let _e40 = r;\n let _e41 = r;\n let _e44 = textureSampleLevel(uSource_t, uSource_s, (_e39 + vec2<f32>(_e40, _e41)), 0f);\n c = _e44.xyz;\n let _e46 = vUv_1;\n let _e47 = r;\n let _e51 = textureSampleLevel(uSource_t, uSource_s, (_e46 + vec2<f32>(-(_e47), 0f)), 0f);\n d = _e51.xyz;\n let _e53 = vUv_1;\n let _e54 = textureSampleLevel(uSource_t, uSource_s, _e53, 0f);\n e = _e54.xyz;\n let _e56 = vUv_1;\n let _e57 = r;\n let _e60 = textureSampleLevel(uSource_t, uSource_s, (_e56 + vec2<f32>(_e57, 0f)), 0f);\n f = _e60.xyz;\n let _e62 = vUv_1;\n let _e63 = r;\n let _e65 = r;\n let _e69 = textureSampleLevel(uSource_t, uSource_s, (_e62 + vec2<f32>(-(_e63), -(_e65))), 0f);\n g = _e69.xyz;\n let _e71 = vUv_1;\n let _e72 = r;\n let _e76 = textureSampleLevel(uSource_t, uSource_s, (_e71 + vec2<f32>(0f, -(_e72))), 0f);\n h = _e76.xyz;\n let _e78 = vUv_1;\n let _e79 = r;\n let _e80 = r;\n let _e84 = textureSampleLevel(uSource_t, uSource_s, (_e78 + vec2<f32>(_e79, -(_e80))), 0f);\n i = _e84.xyz;\n let _e86 = e;\n let _e88 = b;\n let _e89 = d;\n let _e91 = f;\n let _e93 = h;\n let _e97 = a;\n let _e98 = c;\n let _e100 = g;\n let _e102 = i;\n sum = (((_e86 * 4f) + ((((_e88 + _e89) + _e91) + _e93) * 2f)) + (((_e97 + _e98) + _e100) + _e102));\n let _e105 = sum;\n let _e108 = unnamed.uScale;\n let _e109 = ((_e105 * 0.0625f) * _e108);\n fragColor = vec4<f32>(_e109.x, _e109.y, _e109.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vUv: vec2<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n main_1();\n let _e3 = fragColor;\n return _e3;\n}\n";
|
|
10
10
|
/**
|
|
11
11
|
* What the transform assigned, so the renderer binds the same numbers.
|
|
12
12
|
*
|
|
@@ -44,6 +44,11 @@ export const BLOOM_BINDINGS = {
|
|
|
44
44
|
"offset": 8,
|
|
45
45
|
"size": 4,
|
|
46
46
|
"type": "float"
|
|
47
|
+
},
|
|
48
|
+
"uRamp": {
|
|
49
|
+
"offset": 12,
|
|
50
|
+
"size": 4,
|
|
51
|
+
"type": "float"
|
|
47
52
|
}
|
|
48
53
|
},
|
|
49
54
|
"textures": {
|
|
@@ -58,8 +63,13 @@ export const BLOOM_BINDINGS = {
|
|
|
58
63
|
"uniforms": 1,
|
|
59
64
|
"uniformSize": 16,
|
|
60
65
|
"fields": {
|
|
61
|
-
"
|
|
66
|
+
"uScale": {
|
|
62
67
|
"offset": 0,
|
|
68
|
+
"size": 12,
|
|
69
|
+
"type": "vec3"
|
|
70
|
+
},
|
|
71
|
+
"uRadius": {
|
|
72
|
+
"offset": 12,
|
|
63
73
|
"size": 4,
|
|
64
74
|
"type": "float"
|
|
65
75
|
}
|