@vib3code/sdk 2.0.3-canary.3349130 → 2.0.3-canary.3b3ca18

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.
Files changed (44) hide show
  1. package/DOCS/EXPANSION_DESIGN.md +977 -0
  2. package/DOCS/EXPANSION_DESIGN_ULTRA.md +387 -0
  3. package/DOCS/MASTER_PLAN_2026-01-31.md +2 -2
  4. package/DOCS/OPTIMIZATION_PLAN_MATH.md +118 -0
  5. package/DOCS/SYSTEM_INVENTORY.md +2 -2
  6. package/DOCS/WEBGPU_STATUS.md +119 -38
  7. package/DOCS/archive/WEBGPU_STATUS_2026-02-15_STALE.md +38 -0
  8. package/DOCS/dev-tracks/DEV_TRACK_SESSION_2026-02-16.md +108 -0
  9. package/DOCS/dev-tracks/PERF_UPGRADE_2026-02-16.md +308 -0
  10. package/docs/webgpu-live.html +1 -1
  11. package/package.json +1 -1
  12. package/src/agent/mcp/MCPServer.js +195 -136
  13. package/src/agent/mcp/tools.js +45 -32
  14. package/src/experimental/GameLoop.js +72 -0
  15. package/src/experimental/LatticePhysics.js +100 -0
  16. package/src/experimental/LiveDirector.js +143 -0
  17. package/src/experimental/PlayerController4D.js +154 -0
  18. package/src/experimental/VIB3Actor.js +138 -0
  19. package/src/experimental/VIB3Compositor.js +117 -0
  20. package/src/experimental/VIB3Link.js +122 -0
  21. package/src/experimental/VIB3Orchestrator.js +146 -0
  22. package/src/experimental/VIB3Universe.js +109 -0
  23. package/src/experimental/demos/CrystalLabyrinth.js +202 -0
  24. package/src/faceted/FacetedSystem.js +19 -6
  25. package/src/geometry/generators/Crystal.js +2 -2
  26. package/src/holograms/HolographicVisualizer.js +58 -89
  27. package/src/math/Mat4x4.js +225 -36
  28. package/src/math/Rotor4D.js +93 -39
  29. package/src/math/Vec4.js +200 -103
  30. package/src/quantum/QuantumVisualizer.js +24 -20
  31. package/src/render/ShaderLoader.js +38 -0
  32. package/src/render/ShaderProgram.js +4 -4
  33. package/src/render/UnifiedRenderBridge.js +1 -1
  34. package/src/render/backends/WebGPUBackend.js +8 -4
  35. package/src/shaders/common/geometry24.glsl +65 -0
  36. package/src/shaders/common/geometry24.wgsl +54 -0
  37. package/src/shaders/common/rotation4d.glsl +4 -4
  38. package/src/shaders/common/rotation4d.wgsl +2 -2
  39. package/src/shaders/common/uniforms.wgsl +15 -8
  40. package/src/shaders/faceted/faceted.frag.wgsl +19 -6
  41. package/src/shaders/holographic/holographic.frag.wgsl +7 -5
  42. package/src/shaders/quantum/quantum.frag.wgsl +7 -5
  43. package/src/ui/adaptive/renderers/webgpu/WebGPURenderer.ts +2 -2
  44. package/tools/shader-sync-verify.js +6 -4
@@ -6,6 +6,17 @@
6
6
 
7
7
  import { GeometryLibrary } from '../geometry/GeometryLibrary.js';
8
8
 
9
+ // Role-specific intensity values for 5-layer canvas architecture.
10
+ // IMPORTANT: Must stay in sync with shader epsilon comparisons in the fragment shader
11
+ // at the "LAYER-BY-LAYER COLOR SYSTEM" section (search for layerIndex).
12
+ const ROLE_INTENSITIES = {
13
+ 'background': 0.4,
14
+ 'shadow': 0.6,
15
+ 'content': 1.0,
16
+ 'highlight': 1.3,
17
+ 'accent': 1.6
18
+ };
19
+
9
20
  export class QuantumHolographicVisualizer {
10
21
  constructor(canvasIdOrElement, role, reactivity, variant) {
11
22
  this.canvas = (canvasIdOrElement instanceof HTMLCanvasElement)
@@ -14,6 +25,7 @@ export class QuantumHolographicVisualizer {
14
25
  this.role = role;
15
26
  this.reactivity = reactivity;
16
27
  this.variant = variant;
28
+ this._canvasLabel = typeof canvasIdOrElement === 'string' ? canvasIdOrElement : canvasIdOrElement?.id || 'unknown';
17
29
 
18
30
  // CRITICAL FIX: Define contextOptions as instance property to match SmartCanvasPool
19
31
  this.contextOptions = {
@@ -34,9 +46,9 @@ export class QuantumHolographicVisualizer {
34
46
  this.canvas.getContext('experimental-webgl', this.contextOptions);
35
47
 
36
48
  if (!this.gl) {
37
- console.error(`WebGL not supported for ${canvasId}`);
49
+ console.error(`WebGL not supported for ${this._canvasLabel}`);
38
50
  if (window.mobileDebug) {
39
- window.mobileDebug.log(`❌ ${canvasId}: WebGL context creation failed`);
51
+ window.mobileDebug.log(`❌ ${this._canvasLabel}: WebGL context creation failed`);
40
52
  }
41
53
  // Show user-friendly error instead of white screen
42
54
  this.showWebGLError();
@@ -44,7 +56,7 @@ export class QuantumHolographicVisualizer {
44
56
  } else {
45
57
  if (window.mobileDebug) {
46
58
  const version = this.gl.getParameter(this.gl.VERSION);
47
- window.mobileDebug.log(`✅ ${canvasId}: WebGL context created - ${version}`);
59
+ window.mobileDebug.log(`✅ ${this._canvasLabel}: WebGL context created - ${version}`);
48
60
  }
49
61
  }
50
62
 
@@ -59,15 +71,15 @@ export class QuantumHolographicVisualizer {
59
71
  this._onContextLost = (e) => {
60
72
  e.preventDefault();
61
73
  this._contextLost = true;
62
- console.warn(`WebGL context lost for ${canvasId}`);
74
+ console.warn(`WebGL context lost for ${this._canvasLabel}`);
63
75
  };
64
76
  this._onContextRestored = () => {
65
- console.log(`WebGL context restored for ${canvasId}`);
77
+ console.log(`WebGL context restored for ${this._canvasLabel}`);
66
78
  this._contextLost = false;
67
79
  try {
68
80
  this.init();
69
81
  } catch (err) {
70
- console.error(`Failed to reinit after context restore for ${canvasId}:`, err);
82
+ console.error(`Failed to reinit after context restore for ${this._canvasLabel}:`, err);
71
83
  }
72
84
  };
73
85
  this.canvas.addEventListener('webglcontextlost', this._onContextLost);
@@ -688,11 +700,12 @@ void main() {
688
700
 
689
701
  // LAYER-BY-LAYER COLOR SYSTEM with user hue/saturation/intensity controls
690
702
  // Determine canvas layer from role/variant (0=background, 1=shadow, 2=content, 3=highlight, 4=accent)
703
+ // Values must match ROLE_INTENSITIES in JS: bg=0.4, shadow=0.6, content=1.0, highlight=1.3, accent=1.6
691
704
  int layerIndex = 0;
692
- if (u_roleIntensity == 0.7) layerIndex = 1; // shadow layer
693
- else if (u_roleIntensity == 1.0) layerIndex = 2; // content layer
694
- else if (u_roleIntensity == 0.85) layerIndex = 3; // highlight layer
695
- else if (u_roleIntensity == 0.6) layerIndex = 4; // accent layer
705
+ if (abs(u_roleIntensity - 0.6) < 0.05) layerIndex = 1; // shadow layer
706
+ else if (abs(u_roleIntensity - 1.0) < 0.05) layerIndex = 2; // content layer
707
+ else if (abs(u_roleIntensity - 1.3) < 0.05) layerIndex = 3; // highlight layer
708
+ else if (abs(u_roleIntensity - 1.6) < 0.05) layerIndex = 4; // accent layer
696
709
 
697
710
  // Get layer-specific base color using user hue/saturation controls
698
711
  float colorTime = timeSpeed * 2.0 + value * 3.0;
@@ -1016,15 +1029,6 @@ void main() {
1016
1029
  this._renderParamsLogged = true;
1017
1030
  }
1018
1031
 
1019
- // Role-specific intensity for quantum effects
1020
- const roleIntensities = {
1021
- 'background': 0.4,
1022
- 'shadow': 0.6,
1023
- 'content': 1.0,
1024
- 'highlight': 1.3,
1025
- 'accent': 1.6
1026
- };
1027
-
1028
1032
  const time = Date.now() - this.startTime;
1029
1033
 
1030
1034
  // Set uniforms
@@ -1068,7 +1072,7 @@ void main() {
1068
1072
  this.gl.uniform1f(this.uniforms.rot4dZW, this.params.rot4dZW || 0.0);
1069
1073
  this.gl.uniform1f(this.uniforms.mouseIntensity, this.mouseIntensity);
1070
1074
  this.gl.uniform1f(this.uniforms.clickIntensity, this.clickIntensity);
1071
- this.gl.uniform1f(this.uniforms.roleIntensity, roleIntensities[this.role] || 1.0);
1075
+ this.gl.uniform1f(this.uniforms.roleIntensity, ROLE_INTENSITIES[this.role] || 1.0);
1072
1076
  this.gl.uniform1f(this.uniforms.breath, this.params.breath || 0.0);
1073
1077
 
1074
1078
  this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4);
@@ -199,6 +199,44 @@ export class ShaderLoader {
199
199
  return results;
200
200
  }
201
201
 
202
+ /**
203
+ * Resolve #include directives in shader source.
204
+ * GLSL: #include "common/rotation4d.glsl"
205
+ * WGSL: // @include "common/rotation4d.wgsl"
206
+ *
207
+ * Includes are resolved from the loader's cache (call loadCommonLibrary() first).
208
+ * Non-recursive — only resolves one level of includes.
209
+ *
210
+ * @param {string} source - Shader source with include directives
211
+ * @returns {string} Resolved shader source
212
+ */
213
+ resolveIncludes(source) {
214
+ if (!source) return source;
215
+
216
+ // GLSL: #include "path"
217
+ // WGSL: // @include "path"
218
+ const includeRegex = /(?:^|\n)\s*(?:#include|\/\/\s*@include)\s+"([^"]+)"\s*(?:\n|$)/g;
219
+
220
+ return source.replace(includeRegex, (match, path) => {
221
+ const cached = this._cache.get(path);
222
+ if (cached) {
223
+ return '\n// --- included from ' + path + ' ---\n' + cached + '\n// --- end ' + path + ' ---\n';
224
+ }
225
+ console.warn(`ShaderLoader: Include not found in cache: "${path}" — load it first via loadCommonLibrary()`);
226
+ return match; // Leave directive in place if not found
227
+ });
228
+ }
229
+
230
+ /**
231
+ * Load a shader file and resolve includes.
232
+ * @param {string} relativePath
233
+ * @returns {Promise<string|null>}
234
+ */
235
+ async loadAndResolve(relativePath) {
236
+ const source = await this.load(relativePath);
237
+ return source ? this.resolveIncludes(source) : null;
238
+ }
239
+
202
240
  /**
203
241
  * Clear all cached shaders.
204
242
  */
@@ -384,10 +384,10 @@ export const ShaderLib = {
384
384
  mat4 rotateXZ(float angle) {
385
385
  float c = cos(angle), s = sin(angle);
386
386
  return mat4(
387
- c, 0, -s, 0,
388
- 0, 1, 0, 0,
389
- s, 0, c, 0,
390
- 0, 0, 0, 1
387
+ c, 0, s, 0,
388
+ 0, 1, 0, 0,
389
+ -s, 0, c, 0,
390
+ 0, 0, 0, 1
391
391
  );
392
392
  }
393
393
 
@@ -25,7 +25,7 @@ import { createWebGPUBackend, isWebGPUSupported, WGSLShaderLib } from './backend
25
25
  * @returns {Float32Array}
26
26
  */
27
27
  function packVIB3Uniforms(uniforms) {
28
- // Total: 32 floats = 128 bytes → aligned to 256 bytes in buffer
28
+ // Total: 33 floats (indices 0-32) = 132 bytes → padded to 256 bytes in buffer
29
29
  const data = new Float32Array(64); // 256 bytes
30
30
 
31
31
  data[0] = uniforms.u_time || 0;
@@ -152,10 +152,14 @@ struct VIB3Uniforms {
152
152
  layerScale: f32,
153
153
  layerOpacity: f32,
154
154
  _pad1: f32,
155
- layerColor: vec3<f32>,
155
+ layerColorR: f32,
156
+ layerColorG: f32,
157
+ layerColorB: f32,
156
158
  densityMult: f32,
157
159
  speedMult: f32,
158
- _pad2: vec3<f32>,
160
+
161
+ // Vitality
162
+ breath: f32,
159
163
  };
160
164
  `;
161
165
 
@@ -178,9 +182,9 @@ fn rotateXZ(angle: f32) -> mat4x4<f32> {
178
182
  let c = cos(angle);
179
183
  let s = sin(angle);
180
184
  return mat4x4<f32>(
181
- vec4<f32>(c, 0.0, -s, 0.0),
185
+ vec4<f32>( c, 0.0, s, 0.0),
182
186
  vec4<f32>(0.0, 1.0, 0.0, 0.0),
183
- vec4<f32>(s, 0.0, c, 0.0),
187
+ vec4<f32>(-s, 0.0, c, 0.0),
184
188
  vec4<f32>(0.0, 0.0, 0.0, 1.0)
185
189
  );
186
190
  }
@@ -53,6 +53,71 @@ float hypertetrahedronCore(vec4 p, float baseType) {
53
53
  return max(baseShape, tetraField);
54
54
  }
55
55
 
56
+ // ── Polytope Core Warp Functions ──
57
+ // Requires: rotation matrices from rotation4d.glsl, project4Dto3D, and u_* uniforms
58
+
59
+ vec3 warpHypersphereCore(vec3 p, int geometryIndex, vec2 mouseDelta) {
60
+ float radius = length(p);
61
+ float morphBlend = clamp(u_morphFactor * 0.6 + (u_dimension - 3.0) * 0.25, 0.0, 2.0);
62
+ float w = sin(radius * (1.3 + float(geometryIndex) * 0.12) + u_time * 0.0008 * u_speed);
63
+ w *= (0.4 + morphBlend * 0.45);
64
+
65
+ vec4 p4d = vec4(p * (1.0 + morphBlend * 0.2), w);
66
+ p4d = rotateXY(u_rot4dXY) * p4d;
67
+ p4d = rotateXZ(u_rot4dXZ) * p4d;
68
+ p4d = rotateYZ(u_rot4dYZ) * p4d;
69
+ p4d = rotateXW(u_rot4dXW) * p4d;
70
+ p4d = rotateYW(u_rot4dYW) * p4d;
71
+ p4d = rotateZW(u_rot4dZW) * p4d;
72
+
73
+ vec3 projected = project4Dto3D(p4d);
74
+ return mix(p, projected, clamp(0.45 + morphBlend * 0.35, 0.0, 1.0));
75
+ }
76
+
77
+ vec3 warpHypertetraCore(vec3 p, int geometryIndex, vec2 mouseDelta) {
78
+ vec3 c1 = normalize(vec3(1.0, 1.0, 1.0));
79
+ vec3 c2 = normalize(vec3(-1.0, -1.0, 1.0));
80
+ vec3 c3 = normalize(vec3(-1.0, 1.0, -1.0));
81
+ vec3 c4 = normalize(vec3(1.0, -1.0, -1.0));
82
+
83
+ float morphBlend = clamp(u_morphFactor * 0.8 + (u_dimension - 3.0) * 0.2, 0.0, 2.0);
84
+ float basisMix = dot(p, c1) * 0.14 + dot(p, c2) * 0.1 + dot(p, c3) * 0.08;
85
+ float w = sin(basisMix * 5.5 + u_time * 0.0009 * u_speed);
86
+ w *= cos(dot(p, c4) * 4.2 - u_time * 0.0007 * u_speed);
87
+ w *= (0.5 + morphBlend * 0.4);
88
+
89
+ vec3 offset = vec3(dot(p, c1), dot(p, c2), dot(p, c3)) * 0.1 * morphBlend;
90
+ vec4 p4d = vec4(p + offset, w);
91
+ p4d = rotateXY(u_rot4dXY) * p4d;
92
+ p4d = rotateXZ(u_rot4dXZ) * p4d;
93
+ p4d = rotateYZ(u_rot4dYZ) * p4d;
94
+ p4d = rotateXW(u_rot4dXW) * p4d;
95
+ p4d = rotateYW(u_rot4dYW) * p4d;
96
+ p4d = rotateZW(u_rot4dZW) * p4d;
97
+
98
+ vec3 projected = project4Dto3D(p4d);
99
+ float planeInfluence = min(min(abs(dot(p, c1)), abs(dot(p, c2))),
100
+ min(abs(dot(p, c3)), abs(dot(p, c4))));
101
+ vec3 blended = mix(p, projected, clamp(0.45 + morphBlend * 0.35, 0.0, 1.0));
102
+ return mix(blended, blended * (1.0 - planeInfluence * 0.55), 0.2 + morphBlend * 0.2);
103
+ }
104
+
105
+ vec3 applyCoreWarp(vec3 p, float geometryType, vec2 mouseDelta) {
106
+ float totalBase = 8.0;
107
+ float coreFloat = floor(geometryType / totalBase);
108
+ int coreIndex = int(clamp(coreFloat, 0.0, 2.0));
109
+ float baseGeomFloat = geometryType - floor(geometryType / totalBase) * totalBase;
110
+ int geometryIndex = int(clamp(floor(baseGeomFloat + 0.5), 0.0, totalBase - 1.0));
111
+
112
+ if (coreIndex == 1) {
113
+ return warpHypersphereCore(p, geometryIndex, mouseDelta);
114
+ }
115
+ if (coreIndex == 2) {
116
+ return warpHypertetraCore(p, geometryIndex, mouseDelta);
117
+ }
118
+ return p;
119
+ }
120
+
56
121
  // Main geometry dispatcher (0-23)
57
122
  float geometry(vec4 p, float type) {
58
123
  if (type < 8.0) {
@@ -47,6 +47,60 @@ fn hypertetrahedronCore(p: vec4<f32>, baseType: f32) -> f32 {
47
47
  return max(baseGeometry(p, baseType), tf);
48
48
  }
49
49
 
50
+ // ── Polytope Core Warp Functions ──
51
+ // Requires: rotation functions from rotation4d.wgsl and u: VIB3Uniforms
52
+
53
+ fn warpHypersphereCore_common(p: vec3<f32>, geomIdx: i32) -> vec3<f32> {
54
+ let radius = length(p);
55
+ let morphBlend = clamp(u.morphFactor * 0.6 + (u.dimension - 3.0) * 0.25, 0.0, 2.0);
56
+ let w = sin(radius * (1.3 + f32(geomIdx) * 0.12) + u.time * 0.0008 * u.speed)
57
+ * (0.4 + morphBlend * 0.45);
58
+ var p4d = vec4<f32>(p * (1.0 + morphBlend * 0.2), w);
59
+ p4d = rotateXY(u.rot4dXY) * p4d;
60
+ p4d = rotateXZ(u.rot4dXZ) * p4d;
61
+ p4d = rotateYZ(u.rot4dYZ) * p4d;
62
+ p4d = rotateXW(u.rot4dXW) * p4d;
63
+ p4d = rotateYW(u.rot4dYW) * p4d;
64
+ p4d = rotateZW(u.rot4dZW) * p4d;
65
+ let proj = project4Dto3D(p4d);
66
+ return mix(p, proj, clamp(0.45 + morphBlend * 0.35, 0.0, 1.0));
67
+ }
68
+
69
+ fn warpHypertetraCore_common(p: vec3<f32>, geomIdx: i32) -> vec3<f32> {
70
+ let c1 = normalize(vec3<f32>(1.0, 1.0, 1.0));
71
+ let c2 = normalize(vec3<f32>(-1.0, -1.0, 1.0));
72
+ let c3 = normalize(vec3<f32>(-1.0, 1.0, -1.0));
73
+ let c4 = normalize(vec3<f32>(1.0, -1.0, -1.0));
74
+ let morphBlend = clamp(u.morphFactor * 0.8 + (u.dimension - 3.0) * 0.2, 0.0, 2.0);
75
+ let basisMix = dot(p, c1) * 0.14 + dot(p, c2) * 0.1 + dot(p, c3) * 0.08;
76
+ let w = sin(basisMix * 5.5 + u.time * 0.0009 * u.speed)
77
+ * cos(dot(p, c4) * 4.2 - u.time * 0.0007 * u.speed)
78
+ * (0.5 + morphBlend * 0.4);
79
+ let offset = vec3<f32>(dot(p, c1), dot(p, c2), dot(p, c3)) * 0.1 * morphBlend;
80
+ var p4d = vec4<f32>(p + offset, w);
81
+ p4d = rotateXY(u.rot4dXY) * p4d;
82
+ p4d = rotateXZ(u.rot4dXZ) * p4d;
83
+ p4d = rotateYZ(u.rot4dYZ) * p4d;
84
+ p4d = rotateXW(u.rot4dXW) * p4d;
85
+ p4d = rotateYW(u.rot4dYW) * p4d;
86
+ p4d = rotateZW(u.rot4dZW) * p4d;
87
+ let proj = project4Dto3D(p4d);
88
+ let planeInf = min(min(abs(dot(p, c1)), abs(dot(p, c2))),
89
+ min(abs(dot(p, c3)), abs(dot(p, c4))));
90
+ let blended = mix(p, proj, clamp(0.45 + morphBlend * 0.35, 0.0, 1.0));
91
+ return mix(blended, blended * (1.0 - planeInf * 0.55), 0.2 + morphBlend * 0.2);
92
+ }
93
+
94
+ fn applyCoreWarp_common(p: vec3<f32>, geomType: f32) -> vec3<f32> {
95
+ let coreFloat = floor(geomType / 8.0);
96
+ let coreIndex = i32(clamp(coreFloat, 0.0, 2.0));
97
+ let baseFloat = geomType - floor(geomType / 8.0) * 8.0;
98
+ let geomIdx = i32(clamp(floor(baseFloat + 0.5), 0.0, 7.0));
99
+ if (coreIndex == 1) { return warpHypersphereCore_common(p, geomIdx); }
100
+ if (coreIndex == 2) { return warpHypertetraCore_common(p, geomIdx); }
101
+ return p;
102
+ }
103
+
50
104
  fn geometry(p: vec4<f32>, t: f32) -> f32 {
51
105
  if (t < 8.0) { return baseGeometry(p, t); }
52
106
  else if (t < 16.0) { return hypersphereCore(p, t - 8.0); }
@@ -16,10 +16,10 @@ mat4 rotateXZ(float angle) {
16
16
  float c = cos(angle);
17
17
  float s = sin(angle);
18
18
  return mat4(
19
- c, 0, -s, 0,
20
- 0, 1, 0, 0,
21
- s, 0, c, 0,
22
- 0, 0, 0, 1
19
+ c, 0, s, 0,
20
+ 0, 1, 0, 0,
21
+ -s, 0, c, 0,
22
+ 0, 0, 0, 1
23
23
  );
24
24
  }
25
25
 
@@ -16,9 +16,9 @@ fn rotateXZ(angle: f32) -> mat4x4<f32> {
16
16
  let c = cos(angle);
17
17
  let s = sin(angle);
18
18
  return mat4x4<f32>(
19
- vec4<f32>(c, 0.0, -s, 0.0),
19
+ vec4<f32>( c, 0.0, s, 0.0),
20
20
  vec4<f32>(0.0, 1.0, 0.0, 0.0),
21
- vec4<f32>(s, 0.0, c, 0.0),
21
+ vec4<f32>(-s, 0.0, c, 0.0),
22
22
  vec4<f32>(0.0, 0.0, 0.0, 1.0)
23
23
  );
24
24
  }
@@ -1,16 +1,19 @@
1
1
  // VIB3+ Common Uniform Struct (WGSL)
2
2
  // Shared across all visualization systems
3
+ // Canonical layout — must match packVIB3Uniforms() in UnifiedRenderBridge.js
4
+ // All fields are f32 (except resolution vec2) to avoid alignment surprises.
5
+ // Total: 33 floats (132 bytes), buffer padded to 256 bytes.
3
6
 
4
7
  struct VIB3Uniforms {
5
- // Time and resolution
8
+ // Time and resolution (indices 0-3)
6
9
  time: f32,
7
10
  _pad0: f32,
8
11
  resolution: vec2<f32>,
9
12
 
10
- // Geometry selection (0-23)
13
+ // Geometry selection 0-23 (index 4)
11
14
  geometry: f32,
12
15
 
13
- // 6D Rotation (radians)
16
+ // 6D Rotation in radians (indices 5-10)
14
17
  rot4dXY: f32,
15
18
  rot4dXZ: f32,
16
19
  rot4dYZ: f32,
@@ -18,7 +21,7 @@ struct VIB3Uniforms {
18
21
  rot4dYW: f32,
19
22
  rot4dZW: f32,
20
23
 
21
- // Visual parameters
24
+ // Visual parameters (indices 11-18)
22
25
  dimension: f32,
23
26
  gridDensity: f32,
24
27
  morphFactor: f32,
@@ -28,21 +31,25 @@ struct VIB3Uniforms {
28
31
  intensity: f32,
29
32
  saturation: f32,
30
33
 
31
- // Reactivity
34
+ // Reactivity (indices 19-23)
32
35
  mouseIntensity: f32,
33
36
  clickIntensity: f32,
34
37
  bass: f32,
35
38
  mid: f32,
36
39
  high: f32,
37
40
 
38
- // Layer parameters (holographic multi-layer)
41
+ // Layer parameters (indices 24-31)
39
42
  layerScale: f32,
40
43
  layerOpacity: f32,
41
44
  _pad1: f32,
42
- layerColor: vec3<f32>,
45
+ layerColorR: f32,
46
+ layerColorG: f32,
47
+ layerColorB: f32,
43
48
  densityMult: f32,
44
49
  speedMult: f32,
45
- _pad2: vec3<f32>,
50
+
51
+ // Vitality (index 32)
52
+ breath: f32,
46
53
  };
47
54
 
48
55
  @group(0) @binding(0) var<uniform> u: VIB3Uniforms;
@@ -4,7 +4,7 @@
4
4
 
5
5
  struct VIB3Uniforms {
6
6
  time: f32,
7
- speed: f32,
7
+ _pad0: f32,
8
8
  resolution: vec2<f32>,
9
9
  geometry: f32,
10
10
  rot4dXY: f32,
@@ -17,18 +17,24 @@ struct VIB3Uniforms {
17
17
  gridDensity: f32,
18
18
  morphFactor: f32,
19
19
  chaos: f32,
20
+ speed: f32,
20
21
  hue: f32,
21
22
  intensity: f32,
22
23
  saturation: f32,
23
24
  mouseIntensity: f32,
24
25
  clickIntensity: f32,
25
- roleIntensity: f32,
26
26
  bass: f32,
27
27
  mid: f32,
28
28
  high: f32,
29
+ layerScale: f32,
30
+ layerOpacity: f32,
31
+ _pad1: f32,
32
+ layerColorR: f32,
33
+ layerColorG: f32,
34
+ layerColorB: f32,
35
+ densityMult: f32,
36
+ speedMult: f32,
29
37
  breath: f32,
30
- mouse: vec2<f32>,
31
- _pad1: vec2<f32>,
32
38
  };
33
39
 
34
40
  @group(0) @binding(0) var<uniform> u: VIB3Uniforms;
@@ -131,8 +137,15 @@ fn geometryFunction_w(p: vec4<f32>) -> f32 {
131
137
  let gt = i32(clamp(floor(baseFloat + 0.5), 0.0, 7.0));
132
138
  let d = u.gridDensity * 0.08;
133
139
  if (gt == 0) {
134
- let pos = fract(p * d); let dist = min(pos, 1.0 - pos);
135
- return min(min(dist.x, dist.y), min(dist.z, dist.w)) * u.morphFactor;
140
+ // Tetrahedron tetrahedral symmetry planes
141
+ let c1 = normalize(vec3<f32>(1.0, 1.0, 1.0));
142
+ let c2 = normalize(vec3<f32>(-1.0, -1.0, 1.0));
143
+ let c3 = normalize(vec3<f32>(-1.0, 1.0, -1.0));
144
+ let c4 = normalize(vec3<f32>(1.0, -1.0, -1.0));
145
+ let q = fract(p.xyz * d + 0.5) - 0.5;
146
+ let minPlane = min(min(abs(dot(q, c1)), abs(dot(q, c2))),
147
+ min(abs(dot(q, c3)), abs(dot(q, c4))));
148
+ return (1.0 - smoothstep(0.0, 0.05, minPlane)) * u.morphFactor;
136
149
  } else if (gt == 1) {
137
150
  let pos = fract(p * d); let dist = min(pos, 1.0 - pos);
138
151
  return min(min(dist.x, dist.y), min(dist.z, dist.w)) * u.morphFactor;
@@ -28,11 +28,13 @@ struct VIB3Uniforms {
28
28
  high: f32,
29
29
  layerScale: f32,
30
30
  layerOpacity: f32,
31
- breath: f32,
32
- layerColor: vec3<f32>,
31
+ _pad1: f32,
32
+ layerColorR: f32,
33
+ layerColorG: f32,
34
+ layerColorB: f32,
33
35
  densityMult: f32,
34
36
  speedMult: f32,
35
- _pad2: vec3<f32>,
37
+ breath: f32,
36
38
  };
37
39
 
38
40
  @group(0) @binding(0) var<uniform> u: VIB3Uniforms;
@@ -52,8 +54,8 @@ fn rotateXY(angle: f32) -> mat4x4<f32> {
52
54
  fn rotateXZ(angle: f32) -> mat4x4<f32> {
53
55
  let c = cos(angle); let s = sin(angle);
54
56
  return mat4x4<f32>(
55
- vec4<f32>(c, 0.0, -s, 0.0), vec4<f32>(0.0, 1.0, 0.0, 0.0),
56
- vec4<f32>(s, 0.0, c, 0.0), vec4<f32>(0.0, 0.0, 0.0, 1.0));
57
+ vec4<f32>(c, 0.0, s, 0.0), vec4<f32>(0.0, 1.0, 0.0, 0.0),
58
+ vec4<f32>(-s, 0.0, c, 0.0), vec4<f32>(0.0, 0.0, 0.0, 1.0));
57
59
  }
58
60
  fn rotateYZ(angle: f32) -> mat4x4<f32> {
59
61
  let c = cos(angle); let s = sin(angle);
@@ -28,11 +28,13 @@ struct VIB3Uniforms {
28
28
  high: f32,
29
29
  layerScale: f32,
30
30
  layerOpacity: f32,
31
- breath: f32,
32
- layerColor: vec3<f32>,
31
+ _pad1: f32,
32
+ layerColorR: f32,
33
+ layerColorG: f32,
34
+ layerColorB: f32,
33
35
  densityMult: f32,
34
36
  speedMult: f32,
35
- _pad2: vec3<f32>,
37
+ breath: f32,
36
38
  };
37
39
 
38
40
  @group(0) @binding(0) var<uniform> u: VIB3Uniforms;
@@ -52,8 +54,8 @@ fn rotateXY(angle: f32) -> mat4x4<f32> {
52
54
  fn rotateXZ(angle: f32) -> mat4x4<f32> {
53
55
  let c = cos(angle); let s = sin(angle);
54
56
  return mat4x4<f32>(
55
- vec4<f32>(c, 0.0, -s, 0.0), vec4<f32>(0.0, 1.0, 0.0, 0.0),
56
- vec4<f32>(s, 0.0, c, 0.0), vec4<f32>(0.0, 0.0, 0.0, 1.0));
57
+ vec4<f32>(c, 0.0, s, 0.0), vec4<f32>(0.0, 1.0, 0.0, 0.0),
58
+ vec4<f32>(-s, 0.0, c, 0.0), vec4<f32>(0.0, 0.0, 0.0, 1.0));
57
59
  }
58
60
  fn rotateYZ(angle: f32) -> mat4x4<f32> {
59
61
  let c = cos(angle); let s = sin(angle);
@@ -546,9 +546,9 @@ fn rotateXZ(angle: f32) -> mat4x4<f32> {
546
546
  let c = cos(angle);
547
547
  let s = sin(angle);
548
548
  return mat4x4<f32>(
549
- vec4<f32>(c, 0.0, -s, 0.0),
549
+ vec4<f32>( c, 0.0, s, 0.0),
550
550
  vec4<f32>(0.0, 1.0, 0.0, 0.0),
551
- vec4<f32>(s, 0.0, c, 0.0),
551
+ vec4<f32>(-s, 0.0, c, 0.0),
552
552
  vec4<f32>(0.0, 0.0, 0.0, 1.0)
553
553
  );
554
554
  }
@@ -602,6 +602,7 @@ const FACETED_GLSL_FRAGMENT = `
602
602
  precision highp float;
603
603
  uniform float u_time;
604
604
  uniform vec2 u_resolution;
605
+ uniform vec2 u_mouse;
605
606
  uniform float u_geometry;
606
607
  uniform float u_rot4dXY;
607
608
  uniform float u_rot4dXZ;
@@ -619,6 +620,7 @@ uniform float u_saturation;
619
620
  uniform float u_speed;
620
621
  uniform float u_mouseIntensity;
621
622
  uniform float u_clickIntensity;
623
+ uniform float u_roleIntensity;
622
624
  uniform float u_bass;
623
625
  uniform float u_mid;
624
626
  uniform float u_high;
@@ -667,7 +669,8 @@ struct VIB3Uniforms {
667
669
 
668
670
  /**
669
671
  * Holographic system GLSL fragment shader uniforms (from HolographicVisualizer.js).
670
- * This system uses non-standard names for several uniforms.
672
+ * Uses standard names (u_gridDensity, u_morphFactor, u_geometry) plus many
673
+ * system-specific uniforms for audio/touch/scroll reactivity.
671
674
  */
672
675
  const HOLOGRAPHIC_GLSL_FRAGMENT = `
673
676
  precision highp float;
@@ -675,7 +678,7 @@ uniform vec2 u_resolution;
675
678
  uniform float u_time;
676
679
  uniform vec2 u_mouse;
677
680
  uniform float u_geometry;
678
- uniform float u_density;
681
+ uniform float u_gridDensity;
679
682
  uniform float u_speed;
680
683
  uniform vec3 u_color;
681
684
  uniform float u_intensity;
@@ -686,9 +689,8 @@ uniform float u_chaosIntensity;
686
689
  uniform float u_mouseIntensity;
687
690
  uniform float u_clickIntensity;
688
691
  uniform float u_densityVariation;
689
- uniform float u_geometryType;
690
692
  uniform float u_chaos;
691
- uniform float u_morph;
693
+ uniform float u_morphFactor;
692
694
  uniform float u_touchMorph;
693
695
  uniform float u_touchChaos;
694
696
  uniform float u_scrollParallax;