@genex-ai/cli-demo 0.6.1 → 0.6.2

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/package.json +1 -1
  2. package/templates/skills/genex-threejs-atmosphere-aerial-perspective/SKILL.md +30 -18
  3. package/templates/skills/genex-threejs-atmosphere-aerial-perspective/references/atmosphere.md +204 -20
  4. package/templates/skills/genex-threejs-bloom/SKILL.md +29 -18
  5. package/templates/skills/genex-threejs-bloom/references/bloom.md +176 -20
  6. package/templates/skills/genex-threejs-camera-direction/SKILL.md +38 -26
  7. package/templates/skills/genex-threejs-camera-direction/references/camera-rigs.md +359 -27
  8. package/templates/skills/genex-threejs-exposure-color-grading/SKILL.md +27 -18
  9. package/templates/skills/genex-threejs-exposure-color-grading/references/exposure-grading.md +196 -21
  10. package/templates/skills/genex-threejs-image-pipeline/SKILL.md +38 -17
  11. package/templates/skills/genex-threejs-image-pipeline/references/image-pipeline.md +185 -29
  12. package/templates/skills/genex-threejs-procedural-animation/SKILL.md +34 -21
  13. package/templates/skills/genex-threejs-procedural-animation/references/procedural-motion.md +353 -24
  14. package/templates/skills/genex-threejs-procedural-architecture/SKILL.md +36 -17
  15. package/templates/skills/genex-threejs-procedural-architecture/references/architecture-systems.md +500 -22
  16. package/templates/skills/genex-threejs-procedural-fields/SKILL.md +59 -24
  17. package/templates/skills/genex-threejs-procedural-fields/references/field-systems.md +222 -25
  18. package/templates/skills/genex-threejs-procedural-geometry/SKILL.md +34 -20
  19. package/templates/skills/genex-threejs-procedural-geometry/references/mesh-systems.md +192 -26
  20. package/templates/skills/genex-threejs-procedural-materials/SKILL.md +55 -18
  21. package/templates/skills/genex-threejs-procedural-materials/references/material-systems.md +189 -22
  22. package/templates/skills/genex-threejs-procedural-planets/SKILL.md +36 -18
  23. package/templates/skills/genex-threejs-procedural-planets/references/planet-systems.md +489 -21
  24. package/templates/skills/genex-threejs-procedural-vegetation/SKILL.md +35 -25
  25. package/templates/skills/genex-threejs-procedural-vegetation/references/vegetation-systems.md +304 -27
  26. package/templates/skills/genex-threejs-procedural-vfx/SKILL.md +26 -18
  27. package/templates/skills/genex-threejs-procedural-vfx/references/vfx-systems.md +208 -20
  28. package/templates/skills/genex-threejs-raymarched-space-effects/SKILL.md +25 -18
  29. package/templates/skills/genex-threejs-raymarched-space-effects/references/space-effects.md +185 -21
  30. package/templates/skills/genex-threejs-screen-space-ambient-occlusion/SKILL.md +23 -17
  31. package/templates/skills/genex-threejs-screen-space-ambient-occlusion/references/ambient-occlusion.md +430 -20
  32. package/templates/skills/genex-threejs-shadow-systems/SKILL.md +29 -18
  33. package/templates/skills/genex-threejs-shadow-systems/references/shadow-systems.md +420 -21
  34. package/templates/skills/genex-threejs-skill-router/SKILL.md +21 -21
  35. package/templates/skills/genex-threejs-spectral-ocean/SKILL.md +30 -20
  36. package/templates/skills/genex-threejs-spectral-ocean/references/spectral-ocean.md +462 -22
  37. package/templates/skills/genex-threejs-temporal-surfaces/SKILL.md +26 -17
  38. package/templates/skills/genex-threejs-temporal-surfaces/references/temporal-surfaces.md +198 -20
  39. package/templates/skills/genex-threejs-visual-validation/SKILL.md +34 -18
  40. package/templates/skills/genex-threejs-visual-validation/references/visual-validation.md +396 -32
  41. package/templates/skills/genex-threejs-volumetric-clouds/SKILL.md +33 -17
  42. package/templates/skills/genex-threejs-volumetric-clouds/references/volumetric-clouds.md +570 -21
  43. package/templates/skills/genex-threejs-water-optics/SKILL.md +33 -18
  44. package/templates/skills/genex-threejs-water-optics/references/water-optics.md +184 -20
@@ -1,35 +1,232 @@
1
- # Field Systems
1
+ # Procedural field-stack recipes
2
2
 
3
- Use this guide to build reusable fields for Genex scenes.
3
+ Use this reference to construct coherent field bundles for spherical terrain, altitude-filtered detail, terrain wetness, water optics, and structured stochastic placement.
4
4
 
5
- ## Field stack
5
+ ## Contents
6
6
 
7
- - `base`: low-frequency silhouette or terrain structure.
8
- - `detail`: mid-frequency material and shape variation.
9
- - `micro`: high-frequency normals or roughness, filtered by distance.
10
- - `mask`: semantic influence such as water, biome, damage, snow, or wear.
11
- - `flow`: vector direction for wind, particles, waves, or erosion.
7
+ - Stable coordinate ownership
8
+ - planet-space implementation sphere fields
9
+ - Altitude filtering
10
+ - pooled VFX system terrain coupling
11
+ - atlas-based renderer water field coupling
12
+ - Structured stochastic placement
13
+ - Cross-system implementation contract
14
+ - Diagnostics
12
15
 
13
- ## Domain rules
14
16
 
15
- - World-space fields should not swim when objects move.
16
- - Object-space fields should travel with the mesh.
17
- - UV-space fields should be reserved for authored assets or atlases.
18
- - Screen-space fields should never drive persistent world identity.
17
+ ## Stable coordinate ownership
19
18
 
20
- ## Diagnostics
19
+ The strongest common rule is that one stable coordinate domain owns related
20
+ visual channels.
21
+
22
+ planet-space implementation stores normalized undeformed sphere direction in a
23
+ `surfaceDirection` attribute. Terrain shader fields sample:
24
+
25
+ ```text
26
+ terrainCoordinateKm = normalize(surfaceDirection) * radiusKm
27
+ ```
28
+
29
+ They do not sample the interpolated displaced position. This prevents noise
30
+ stretching over steep relief and allows orbit/close-detail filtering in the
31
+ same kilometer domain.
32
+
33
+ pooled VFX system terrain samples `positionWorld`, because wetness is tied to a world water
34
+ height. atlas-based renderer water also samples world XZ so near tiles and far ocean quads
35
+ share wave phase.
36
+
37
+ Choose coordinates from the cause:
38
+
39
+ ```text
40
+ planet geology -> undeformed radial direction * physical radius
41
+ water/wetness -> shared world plane
42
+ tree growth -> branch-local longitudinal and radial coordinates
43
+ ```
44
+
45
+ ## planet-space implementation sphere fields
46
+
47
+ The planet material performs tangential warp:
48
+
49
+ ```text
50
+ warp = three seeded noise channels - 0.5
51
+ tangentWarp = warp - radial * dot(warp, radial)
52
+ warpAmplitudeKm = max(radiusKm * 0.012, 36)
53
+ warped = normalize(terrainKm + tangentWarp * warpAmplitudeKm) * radiusKm
54
+ ```
55
+
56
+ Its broad terrain synthesis uses separated bands:
57
+
58
+ ```text
59
+ macro A frequency = 0.00034, weight 0.52
60
+ macro B frequency = 0.00092, internal scale 0.52, weight 0.33
61
+ ridge frequency = 0.0029, weight 0.25
62
+ crater-like frequency = 0.0069, exponent 2.9
63
+ ```
64
+
65
+ The CPU geometry uses a different deterministic value-noise stack:
66
+
67
+ ```text
68
+ continental: 5 octaves, lacunarity 2.03, gain 0.50
69
+ highlands: 4 octaves, lacunarity 2.15, gain 0.55
70
+ ridges: 4 octaves, lacunarity 2.08, gain 0.52
71
+ crater-like: 3 octaves, pow(1 - noise, 3.2)
72
+ ```
73
+
74
+ This mismatch is an observed defect, not a recommended pattern. The material
75
+ mixes only `8%` actual geometry displacement into shader macro height. A new
76
+ implementation should share one deterministic field or validate CPU/GPU parity
77
+ at fixed sphere directions.
78
+
79
+ Derived climate causes in this field stack:
80
+
81
+ ```text
82
+ humidity =
83
+ 0.65 * broadNoise(0.0022)
84
+ + 0.35 * detailNoise(0.0075)
85
+
86
+ temperature =
87
+ (1 - abs(latitude)^1.35) * 0.85
88
+ + 0.15
89
+ - macroHeight * 0.32
90
+
91
+ slope =
92
+ 1 - abs(dot(localNormal, radialDirection))
93
+ ```
94
+
95
+ Snow, arid, lush, and rock masks combine those fields with altitude, ridges,
96
+ and a smaller jitter field. The important mechanism is causal reuse, not the
97
+ specific color palette.
98
+
99
+ ## Altitude filtering
100
+
101
+ planet-space implementation computes:
102
+
103
+ ```text
104
+ cameraAltitude = max(distance(camera, center) - radius, 0)
105
+ detailAltitude = min(cameraAltitude, externally supplied detail altitude)
106
+
107
+ near = max(radius * 0.022, 6.5)
108
+ mid = max(radius * 0.11, 24)
109
+ far = max(radius * 0.50, 140)
110
+
111
+ nearWeight = 1 - smoothstep(near, mid, detailAltitude)
112
+ farWeight = smoothstep(mid, far, detailAltitude)
113
+ midWeight = clamp(1 - nearWeight - farWeight, 0, 1)
114
+ ```
115
+
116
+ These weights attenuate bump, coastline sharpness, wave detail, clearcoat, and
117
+ micro material variation. The frequencies remain stable; contribution fades.
21
118
 
22
- Expose a way to render:
119
+ ## pooled VFX system terrain coupling
23
120
 
24
- - raw field values;
25
- - threshold masks;
26
- - gradient or normal direction;
27
- - warped versus unwarped domains;
28
- - seed variations;
29
- - near and far camera views.
121
+ The pooled VFX system terrain material uses three world-space noise bands:
122
+
123
+ ```text
124
+ noise1: position * (0.2, 1, 0.2), amplitude 0.05, bias 0.2
125
+ noise2: position * 9, amplitude 0.4, bias 0.5
126
+ noise3: position * (14, 3, 14), amplitude 2, bias 0.5
127
+ soilNoise = noise1 + noise2 + noise3
128
+ ```
129
+
130
+ Surface identity derives from geometry orientation:
131
+
132
+ ```text
133
+ grassness = smoothstep(0.01, 1, normalWorld.y^1.6)
134
+ color = mix(soilColor, grassColor, grassness)
135
+ ```
136
+
137
+ The same identity blends soil and grass roughness fields. World height adds a
138
+ wetness response near the water level:
139
+
140
+ ```text
141
+ wetness = smoothstep(-1, -7, positionWorld.y) * noise1 * 3.5
142
+ roughness -= wetness
143
+ ```
144
+
145
+ The reversed-looking edges are intentional GLSL `smoothstep` usage in the
146
+ source but are undefined by the GLSL specification when `edge0 > edge1`.
147
+ Rewrite as `1 - smoothstep(-7, -1, y)` for portable behavior.
148
+
149
+ ## atlas-based renderer water field coupling
150
+
151
+ atlas-based renderer evaluates six directional wave bands in one function and returns:
152
+
153
+ ```text
154
+ RGB = analytic normal from summed gradients
155
+ A = crest metric derived from the same slopes and phases
156
+ ```
157
+
158
+ Wavelengths:
159
+
160
+ ```text
161
+ 12, 6, 2.5, 5.25, 3.0, 1.5 world units
162
+ ```
163
+
164
+ Amplitudes relative to the base:
165
+
166
+ ```text
167
+ 1.0, 0.55, 0.22, 0.12, 0.08, 0.05
168
+ ```
169
+
170
+ The three smallest bands are attenuated from screen derivatives using their
171
+ wavenumbers. Foam consumes the returned crest metric; it does not sample an
172
+ unrelated scrolling mask.
173
+
174
+ ## Structured stochastic placement
175
+
176
+ `branch-growth implementation` demonstrates a different kind of field: constrained discrete
177
+ placement. Child branches use stratified longitudinal slots and independently
178
+ permuted angular slots. Randomness selects within valid slots rather than
179
+ choosing every position freely.
180
+
181
+ That same mechanism applies to:
182
+
183
+ ```text
184
+ branch emergence
185
+ façade variants
186
+ particle burst directions
187
+ crater distribution
188
+ cloud-cell placement
189
+ ```
190
+
191
+ When a pattern must remain authored, stratify the domain before applying
192
+ random jitter.
193
+
194
+ ## Cross-system implementation contract
195
+
196
+ Before coding, record:
197
+
198
+ ```text
199
+ coordinate domain
200
+ physical/perceptual units
201
+ primary fields
202
+ derived causes
203
+ consuming channels
204
+ filtering rule
205
+ CPU/GPU parity requirement
206
+ seed ownership
207
+ ```
208
+
209
+ Reject a field stack when:
210
+
211
+ - color, roughness, and normal use unrelated structure;
212
+ - geometry and shading claim the same feature but evaluate different functions;
213
+ - a categorical mask is only a narrow noise threshold;
214
+ - high-frequency terms survive after their projected footprint is subpixel;
215
+ - world effects use object coordinates or planetary effects use flat world Y;
216
+ - random placement has no strata, budget, or semantic constraints.
217
+
218
+ ## Diagnostics
30
219
 
31
- ## Performance
220
+ Expose:
32
221
 
33
- - Share field functions between CPU generation and shader paths when possible.
34
- - Cache generated textures that do not change every frame.
35
- - Use lower resolution or fewer octaves for far-distance fields.
222
+ ```text
223
+ source coordinates
224
+ tangential warp vector
225
+ each frequency band
226
+ actual geometry height versus shader height
227
+ humidity, temperature, slope, and identity masks
228
+ near/mid/far weights
229
+ water normal and crest from the same evaluation
230
+ wetness by world height
231
+ seed and stratification cells
232
+ ```
@@ -5,26 +5,40 @@ description: Build procedural mesh systems for Genex Three.js games. Use for mes
5
5
 
6
6
  # Genex Three.js Procedural Geometry
7
7
 
8
- Procedural geometry should have semantic structure, stable normals, and a clear
9
- budget. Build mesh writers that explain what they emit.
10
-
11
- Read [references/mesh-systems.md](references/mesh-systems.md) for profile
12
- sweeps, mesh writers, normals, UVs, and validation.
8
+ Generate geometry from a semantic plan and an explicit coordinate frame. Triangle emission is the final compilation step, not the design model.
13
9
 
14
10
  ## Build order
15
11
 
16
- 1. Define semantic parts and gameplay purpose before vertices.
17
- 2. Choose topology: instanced primitives, merged mesh, skinned mesh, or custom
18
- buffer geometry.
19
- 3. Emit positions, normals, UVs, indices, material groups, and bounds together.
20
- 4. Keep resolution tied to screen distance or gameplay importance.
21
- 5. Generate collision/proxy geometry separately when needed.
22
- 6. Add debug modes for wireframe, normals, groups, UV density, and bounds.
23
-
24
- ## Rules
25
-
26
- - Avoid procedural meshes with unnamed arrays and no semantic parts.
27
- - Keep winding, normals, and tangent expectations consistent.
28
- - Use material groups deliberately; do not create one material per tiny piece.
29
- - Recompute bounds after generated changes.
30
- - Dispose old geometries and materials on regeneration.
12
+ 1. Define dimensions and semantic segments.
13
+ 2. Generate a centerline, boundary, profile, or placement plan.
14
+ 3. Build the mechanism-appropriate local parameterization or branch orientation.
15
+ 4. Emit vertices with intentional seams and material ownership.
16
+ 5. Generate UVs from real distance.
17
+ 6. Validate winding, normals, tangents, bounds, and degenerates.
18
+ 7. Select merging, instancing, or LOD by update and material behavior.
19
+
20
+ Read [references/mesh-systems.md](references/mesh-systems.md)
21
+ for the exact sculpted-frame profile, rail emission, tree rings, semantic mesh
22
+ writer, and their observed scaling limits.
23
+
24
+ Read the
25
+ [authored financial tower compiler](../threejs-procedural-architecture/examples/authored-financial-tower/building-system.js)
26
+ for semantic placement compilation and material-slot instancing at building
27
+ scale.
28
+
29
+ ## Failure conditions
30
+
31
+ - profile orientation flips along a curve;
32
+ - caps reuse side vertices and create averaged edge normals;
33
+ - UV scale changes with segment count;
34
+ - arbitrary vertex merging destroys hard edges or material boundaries;
35
+ - generated dimensions are hidden in magic multipliers;
36
+ - instancing is used despite per-instance topology differences;
37
+ - triangle count is the only reported complexity metric.
38
+
39
+ ## Routing boundary
40
+
41
+ This skill owns reusable mesh emission. Use
42
+ `$genex-threejs-procedural-architecture` for a building grammar and
43
+ `$genex-threejs-procedural-vegetation` for a growth hierarchy; those subject skills
44
+ may then apply these geometry mechanisms.
@@ -1,36 +1,202 @@
1
- # Mesh Systems
1
+ # Sculpted profiles and semantic mesh emission
2
2
 
3
- Use this guide for reusable procedural mesh writers.
3
+ Use this reference for reusable profile sweeps, rail skins and caps, oriented branch rings, semantic mesh writers, material slots, and geometry-level diagnostics.
4
4
 
5
- ## Mesh writer contract
5
+ ## Contents
6
6
 
7
- A mesh writer should declare:
7
+ - selective gallery pipeline sculpted frame profile
8
+ - Rail mesh emission
9
+ - Semantic dimensions and material fit
10
+ - Tree ring emission
11
+ - production WebGPU pipeline mesh writer
12
+ - Selection and LOD
13
+ - Observed limitations
14
+ - Diagnostics
8
15
 
9
- - input seed and parameters;
10
- - emitted semantic parts;
11
- - vertex and triangle budget;
12
- - material slots;
13
- - UV convention;
14
- - bounds and collision proxy behavior;
15
- - regeneration and disposal policy.
16
16
 
17
- ## Profile sweeps
17
+ ## selective gallery pipeline sculpted frame profile
18
18
 
19
- - Define a 2D profile with named control points.
20
- - Sweep along a path with stable tangent, normal, and binormal frames.
21
- - Add caps intentionally.
22
- - Keep UV length proportional to world distance.
23
- - Expose cross-section debug lines.
19
+ The frame is not a beveled box. A normalized rail coordinate `t` drives a
20
+ profile assembled from named lobes:
24
21
 
25
- ## Normals and UVs
22
+ ```text
23
+ crown:
24
+ 0.355 * scale * sin(pi*t)^0.56
26
25
 
27
- - Use smooth normals for organic forms and split normals for hard surfaces.
28
- - Avoid accidental smoothing across material or silhouette seams.
29
- - Keep UV density consistent across parts that share a material.
30
- - Validate mirrored or repeated UV islands against normal maps.
26
+ inner bead:
27
+ 0.105 * scale * exp(-((t - 0.085) / 0.033)^2)
31
28
 
32
- ## Instancing
29
+ outer bead:
30
+ 0.092 * scale * exp(-((t - 0.905) / 0.038)^2)
33
31
 
34
- Use instancing when many pieces share geometry and material. Avoid instancing
35
- when each piece needs unique topology, unique material state, or separate
36
- collision behavior that dominates the cost.
32
+ inner groove:
33
+ -0.115 * scale * exp(-((t - 0.205) / 0.043)^2)
34
+
35
+ outer groove:
36
+ -0.102 * scale * exp(-((t - 0.735) / 0.052)^2)
37
+
38
+ shoulder:
39
+ 0.045 * scale * exp(-((t - 0.42) / 0.15)^2)
40
+
41
+ cove:
42
+ -0.035 * scale * exp(-((t - 0.61) / 0.095)^2)
43
+ ```
44
+
45
+ `scale = railWidth / 0.75`. The inner and outer ends are blended to controlled
46
+ terminal depths, preventing a crown shape from meeting the artwork or wall
47
+ with an accidental vertical edge.
48
+
49
+ The profile uses `92` samples. This is deliberate high curvature
50
+ resolution for close hero framing, not a universal default.
51
+
52
+ ## Rail mesh emission
53
+
54
+ Each of four orientations has its own coordinate mapping. The profile travels
55
+ across the rail width while `s` travels along the frame side. Top/bottom rails
56
+ use `132` length segments; left/right use `156`.
57
+
58
+ For every profile sample and length sample, emit:
59
+
60
+ ```text
61
+ top vertex at profile depth
62
+ bottom vertex at fixed backing depth
63
+ UV = (s, t)
64
+ ```
65
+
66
+ Then emit:
67
+
68
+ ```text
69
+ top skin
70
+ bottom skin
71
+ inner wall
72
+ outer wall
73
+ two end caps
74
+ ```
75
+
76
+ The index winding helper emits:
77
+
78
+ ```text
79
+ a, b, c
80
+ b, d, c
81
+ ```
82
+
83
+ Normals are computed after all faces are assembled; a bounding sphere is also
84
+ computed. Four rail meshes meet at miter-like endpoints because their length
85
+ shrinks/expands as `t` moves from inner to outer edge.
86
+
87
+ ## Semantic dimensions and material fit
88
+
89
+ The frame dimensions are derived:
90
+
91
+ ```text
92
+ innerWidth = postWidth
93
+ innerHeight = innerWidth / embedAspectRatio
94
+ railWidthX = (outerWidth - innerWidth) / 2
95
+ railWidthY = (outerHeight - innerHeight) / 2
96
+ profileRailWidth = min(railWidthX, railWidthY)
97
+ art card Z = rail offset + profileDepth(innerRimT)
98
+ ```
99
+
100
+ This keeps artwork, mat, frame profile, and backing coupled. Avoid tuning their
101
+ Z positions independently.
102
+
103
+ The same file pairs the geometry with walnut, antique-gold, and ebony material
104
+ bundles. Geometry is judged under grazing spotlights and shadow maps, so profile
105
+ depth must create readable highlights without bloom.
106
+
107
+ ## Tree ring emission
108
+
109
+ `branch-growth implementation` emits branches as oriented rings. Every branch section owns:
110
+
111
+ ```text
112
+ center
113
+ orientation
114
+ radius
115
+ longitudinal fraction
116
+ branch level
117
+ ```
118
+
119
+ Ring vertices use branch-local radial angle and an explicit seam. Bark UV
120
+ length follows branch length and circumference instead of normalizing every
121
+ branch to identical density.
122
+
123
+ Child branches are generated from the growth hierarchy before geometry is
124
+ batched. This separation makes it possible to lower radial segments by level
125
+ without changing topology ownership.
126
+
127
+ Leaf cards use canopy-oriented normals rather than only card-plane normals,
128
+ showing that generated shading attributes can intentionally differ from
129
+ geometric face normals.
130
+
131
+ ## production WebGPU pipeline mesh writer
132
+
133
+ The architecture compiler accumulates vertices and indices by
134
+ material slot. Modules emit semantic geometry into a shared writer rather than
135
+ constructing one `Mesh` each.
136
+
137
+ Preserve this contract:
138
+
139
+ ```text
140
+ module plan
141
+ -> transformed semantic vertices
142
+ -> triangles tagged with material slot
143
+ -> grouped BufferGeometry
144
+ ```
145
+
146
+ The writer also keeps module transforms and real dimensions outside raw buffer
147
+ code. This allows façade, roof, cornice, and ornament generators to share
148
+ emission without sharing design logic.
149
+
150
+ ## Selection and LOD
151
+
152
+ Use:
153
+
154
+ ```text
155
+ custom profile mesh
156
+ when silhouette and grazing response define identity
157
+
158
+ oriented rings
159
+ when hierarchy and taper define identity
160
+
161
+ semantic mesh writer
162
+ when many varied modules must batch by material
163
+
164
+ instancing
165
+ only when topology is identical and variation is attribute/transform based
166
+ ```
167
+
168
+ Derive LOD from the generator:
169
+
170
+ - reduce profile samples while retaining crown and groove extrema;
171
+ - reduce branch radial segments by branch level;
172
+ - replace ornaments with relief only after silhouette contribution is small;
173
+ - preserve UV density and material slots across levels.
174
+
175
+ ## Observed limitations
176
+
177
+ - selective gallery pipeline computes smooth normals across all connected frame faces. If hard
178
+ backing edges become visible, duplicate vertices by smoothing group.
179
+ - Its profile and segment counts are expensive for many frames. Cache geometry
180
+ by dimension set and add a lower-detail authored profile.
181
+ - The four rails are separate meshes; a larger gallery may need material-based
182
+ merging after transforms are fixed.
183
+ - Global `computeVertexNormals()` cannot infer semantic hard edges.
184
+ - Generic mesh decimation may erase the narrow beads and grooves that create
185
+ the frame’s material response.
186
+
187
+ ## Diagnostics
188
+
189
+ Expose:
190
+
191
+ ```text
192
+ profile curve with named lobe contributions
193
+ profile sample indices
194
+ rail orientation and top/bottom skins
195
+ face winding and normal direction
196
+ UV checker
197
+ frame/art/backing depth relationship
198
+ tree branch rings and seams
199
+ material groups from the mesh writer
200
+ triangle, vertex, group, and draw counts
201
+ LOD overlay at the design camera
202
+ ```
@@ -5,26 +5,63 @@ description: Author production procedural materials for Genex Three.js games. Us
5
5
 
6
6
  # Genex Three.js Procedural Materials
7
7
 
8
- Materials should communicate object identity, state, and gameplay affordance.
9
- Build them from shared fields and inspectable parameters.
8
+ Build a material from surface identity and causes. Color, roughness, metalness, normal, transmission, and emission should describe the same surface—not unrelated noise textures.
10
9
 
11
- Read [references/material-systems.md](references/material-systems.md) for PBR
12
- roles, filtering, masks, and shader handoff patterns.
10
+ ## Material graph order
13
11
 
14
- ## Build order
12
+ ```text
13
+ stable coordinates
14
+ → structural fields
15
+ → material identity weights
16
+ → causal modifiers
17
+ → filtered microstructure
18
+ → PBR channels
19
+ → lighting/shadow extensions
20
+ ```
15
21
 
16
- 1. Define material identity: base color family, metalness, roughness, normal
17
- scale, edge wear, and gameplay state.
18
- 2. Choose field causes for variation before writing shader code.
19
- 3. Derive color, roughness, normals, wetness, and emission from named masks.
20
- 4. Add distance-aware filtering for micro detail.
21
- 5. Keep a no-post preview where the material still reads.
22
- 6. Expose debug toggles for albedo, roughness, normals, masks, and emission.
22
+ Read [references/material-systems.md](references/material-systems.md)
23
+ for atlas filtering, specular AA, planetary coordinates,
24
+ world-height wetness, per-instance dissolve, and authored PBR response bundles.
23
25
 
24
- ## Rules
26
+ Read the
27
+ [sculpted gallery frame geometry](../threejs-procedural-geometry/examples/sculpted-gallery-frame/frame-geometry.js)
28
+ for walnut, antique-gold, and ebony texture/roughness/metalness/clearcoat
29
+ bundles under a grazing-light setup.
25
30
 
26
- - Do not rely on bloom or grading to make a weak material interesting.
27
- - Keep roughness variation physically plausible for the object.
28
- - Filter high-frequency normals and atlas lookups to reduce shimmer.
29
- - Treat emission as authored signal, not a blanket glow.
30
- - Make damage, wetness, heat, or dissolve follow a stable mask.
31
+ Read the
32
+ [procedural planet surface](../threejs-procedural-planets/examples/procedural-planet-surface/planet-system.js)
33
+ for shared geological, climate, water, biome, roughness, and derivative-normal
34
+ causes on a procedural planetary surface.
35
+
36
+ Read the
37
+ [analytic wave optics](../threejs-water-optics/examples/analytic-wave-optics/water-system.js)
38
+ for coupled reflection, refraction, absorption, filtered microstructure,
39
+ resolved crest response, and their diagnostic channels.
40
+
41
+ ## Required controls
42
+
43
+ - real or perceptual texture scale;
44
+ - material identity weights;
45
+ - roughness range and micro-normal strength;
46
+ - the causal fields required by the selected material pattern;
47
+ - distance/derivative filtering;
48
+ - specular antialiasing;
49
+ - channel and mask debug modes.
50
+ - emissive-material debug modes when the material owns glow or volumetric
51
+ accumulation.
52
+
53
+ ## Failure conditions
54
+
55
+ - every PBR channel samples independent noise;
56
+ - roughness is a scalar afterthought;
57
+ - high-frequency normals survive below one pixel;
58
+ - triplanar projection has visible orientation or scale seams;
59
+ - atlas padding is ignored under mipmapping;
60
+ - custom lighting removes energy conservation without an explicit stylized goal;
61
+ - post-processing is used to hide unstable highlights.
62
+
63
+ ## Routing boundary
64
+
65
+ Use `$genex-threejs-procedural-fields` when the main problem is designing shared
66
+ scalar/vector causes. Use `$genex-threejs-procedural-planets` for a complete
67
+ orbit-to-close-approach body, not merely its material.