@genex-ai/cli-demo 0.6.0 → 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.
- package/dist/index.js +5 -0
- package/package.json +1 -1
- package/templates/skills/genex-threejs-atmosphere-aerial-perspective/SKILL.md +30 -18
- package/templates/skills/genex-threejs-atmosphere-aerial-perspective/references/atmosphere.md +204 -20
- package/templates/skills/genex-threejs-bloom/SKILL.md +29 -18
- package/templates/skills/genex-threejs-bloom/references/bloom.md +176 -20
- package/templates/skills/genex-threejs-camera-direction/SKILL.md +38 -26
- package/templates/skills/genex-threejs-camera-direction/references/camera-rigs.md +359 -27
- package/templates/skills/genex-threejs-exposure-color-grading/SKILL.md +27 -18
- package/templates/skills/genex-threejs-exposure-color-grading/references/exposure-grading.md +196 -21
- package/templates/skills/genex-threejs-image-pipeline/SKILL.md +38 -17
- package/templates/skills/genex-threejs-image-pipeline/references/image-pipeline.md +185 -29
- package/templates/skills/genex-threejs-procedural-animation/SKILL.md +34 -21
- package/templates/skills/genex-threejs-procedural-animation/references/procedural-motion.md +353 -24
- package/templates/skills/genex-threejs-procedural-architecture/SKILL.md +36 -17
- package/templates/skills/genex-threejs-procedural-architecture/references/architecture-systems.md +500 -22
- package/templates/skills/genex-threejs-procedural-fields/SKILL.md +59 -24
- package/templates/skills/genex-threejs-procedural-fields/references/field-systems.md +222 -25
- package/templates/skills/genex-threejs-procedural-geometry/SKILL.md +34 -20
- package/templates/skills/genex-threejs-procedural-geometry/references/mesh-systems.md +192 -26
- package/templates/skills/genex-threejs-procedural-materials/SKILL.md +55 -18
- package/templates/skills/genex-threejs-procedural-materials/references/material-systems.md +189 -22
- package/templates/skills/genex-threejs-procedural-planets/SKILL.md +36 -18
- package/templates/skills/genex-threejs-procedural-planets/references/planet-systems.md +489 -21
- package/templates/skills/genex-threejs-procedural-vegetation/SKILL.md +35 -25
- package/templates/skills/genex-threejs-procedural-vegetation/references/vegetation-systems.md +304 -27
- package/templates/skills/genex-threejs-procedural-vfx/SKILL.md +26 -18
- package/templates/skills/genex-threejs-procedural-vfx/references/vfx-systems.md +208 -20
- package/templates/skills/genex-threejs-raymarched-space-effects/SKILL.md +25 -18
- package/templates/skills/genex-threejs-raymarched-space-effects/references/space-effects.md +185 -21
- package/templates/skills/genex-threejs-screen-space-ambient-occlusion/SKILL.md +23 -17
- package/templates/skills/genex-threejs-screen-space-ambient-occlusion/references/ambient-occlusion.md +430 -20
- package/templates/skills/genex-threejs-shadow-systems/SKILL.md +29 -18
- package/templates/skills/genex-threejs-shadow-systems/references/shadow-systems.md +420 -21
- package/templates/skills/genex-threejs-skill-router/SKILL.md +21 -21
- package/templates/skills/genex-threejs-spectral-ocean/SKILL.md +30 -20
- package/templates/skills/genex-threejs-spectral-ocean/references/spectral-ocean.md +462 -22
- package/templates/skills/genex-threejs-temporal-surfaces/SKILL.md +26 -17
- package/templates/skills/genex-threejs-temporal-surfaces/references/temporal-surfaces.md +198 -20
- package/templates/skills/genex-threejs-visual-validation/SKILL.md +34 -18
- package/templates/skills/genex-threejs-visual-validation/references/visual-validation.md +396 -32
- package/templates/skills/genex-threejs-volumetric-clouds/SKILL.md +33 -17
- package/templates/skills/genex-threejs-volumetric-clouds/references/volumetric-clouds.md +570 -21
- package/templates/skills/genex-threejs-water-optics/SKILL.md +33 -18
- package/templates/skills/genex-threejs-water-optics/references/water-optics.md +184 -20
|
@@ -1,30 +1,498 @@
|
|
|
1
|
-
# Planet
|
|
1
|
+
# Planet field and atmosphere systems
|
|
2
2
|
|
|
3
|
-
Use this reference for
|
|
3
|
+
Use this reference for practical planet-space field, material, LOD, biome, giant-body, and atmosphere-handoff mechanisms, including known CPU/GPU parity failure modes.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Contents
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
-
|
|
7
|
+
1. Preserve undeformed sphere direction
|
|
8
|
+
2. Geometry terrain stack and LOD
|
|
9
|
+
3. Shader warp and parity debt
|
|
10
|
+
4. Altitude-filtered detail
|
|
11
|
+
5. Climate, biomes, and body-specific paths
|
|
12
|
+
6. Gas/ice giants and stars
|
|
13
|
+
7. Atmosphere handoff
|
|
14
|
+
8. Adaptation and diagnostics
|
|
11
15
|
|
|
12
|
-
##
|
|
16
|
+
## 1. Preserve undeformed sphere direction
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- Keep coastlines, large craters, and landmarks stable across LOD boundaries.
|
|
17
|
-
- Use debug captures at orbit, high altitude, gameplay altitude, and close view.
|
|
18
|
+
At geometry construction, write the normalized pre-displacement direction into
|
|
19
|
+
a dedicated attribute:
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
```ts
|
|
22
|
+
surfaceDirection[i] = normalize(originalSpherePosition)
|
|
23
|
+
```
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
- Derive spawn zones from slope, altitude, biome, and hazard masks.
|
|
23
|
-
- Keep planet-relative controls and camera up vectors consistent.
|
|
24
|
-
- Separate visual tessellation from gameplay collision when necessary.
|
|
25
|
+
Use that attribute for all shader geology:
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
```ts
|
|
28
|
+
const radial = attribute("surfaceDirection", "vec3").normalize()
|
|
29
|
+
const terrainCoordinateKm = radial * radiusKm
|
|
30
|
+
```
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
This prevents interpolated displaced positions from stretching noise on steep
|
|
33
|
+
slopes. It is stronger than reconstructing direction from `positionLocal`
|
|
34
|
+
after displacement.
|
|
35
|
+
|
|
36
|
+
## 2. Geometry terrain stack
|
|
37
|
+
|
|
38
|
+
The CPU geometry path uses deterministic value noise:
|
|
39
|
+
|
|
40
|
+
```text
|
|
41
|
+
base frequency:
|
|
42
|
+
moon 12.5
|
|
43
|
+
rocky 10.2
|
|
44
|
+
other solid 8.4
|
|
45
|
+
|
|
46
|
+
coordinate warp:
|
|
47
|
+
three value-noise channels at 0.75 frequency
|
|
48
|
+
amplitude 2.4 in local noise coordinates
|
|
49
|
+
|
|
50
|
+
continental:
|
|
51
|
+
5 octaves, frequency multiplier 0.55,
|
|
52
|
+
lacunarity 2.03, gain 0.50
|
|
53
|
+
|
|
54
|
+
highlands:
|
|
55
|
+
4 octaves, frequency multiplier 1.25,
|
|
56
|
+
lacunarity 2.15, gain 0.55
|
|
57
|
+
|
|
58
|
+
ridges:
|
|
59
|
+
4 octaves, frequency multiplier 2.7,
|
|
60
|
+
lacunarity 2.08, gain 0.52
|
|
61
|
+
transformed as 1 - abs(2n - 1)
|
|
62
|
+
|
|
63
|
+
crater-like depression for rocky/moon:
|
|
64
|
+
3 octaves at 6.8
|
|
65
|
+
pow(1 - saturate(noise), 3.2)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Composite:
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
height =
|
|
72
|
+
0.62 * continental
|
|
73
|
+
+ 0.24 * highlands
|
|
74
|
+
+ 0.34 * ridges
|
|
75
|
+
- 0.30 * craterLike
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Terrestrial bodies add a small latitude term. Rocky bodies reinforce ridges.
|
|
79
|
+
The result is remapped to `[-1, 1]` and multiplied by the body’s
|
|
80
|
+
`terrainAmplitude`.
|
|
81
|
+
|
|
82
|
+
This stack is effective for silhouette-scale relief, but its crater term is a
|
|
83
|
+
noise-shaped cavity field, not a crater model with explicit bowl/rim/ejecta
|
|
84
|
+
topology.
|
|
85
|
+
|
|
86
|
+
## 3. Geometry LOD contract
|
|
87
|
+
|
|
88
|
+
Build four complete sphere meshes and switch through `THREE.LOD` with `0.16`
|
|
89
|
+
hysteresis.
|
|
90
|
+
|
|
91
|
+
Terrestrial:
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
segments: 380, 296, 228, 172
|
|
95
|
+
altitude transitions: 2400, 5600, 7600 km
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Rocky:
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
segments: 344, 268, 206, 156
|
|
102
|
+
altitude transitions: 2200, 5000, 5800 km
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Generic displaced solid:
|
|
106
|
+
|
|
107
|
+
```text
|
|
108
|
+
segments: 320, 248, 192, 148
|
|
109
|
+
altitude transitions: 1800, 4000, 5200 km
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Distances are converted through the runtime render scale:
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
distanceWorld = (radiusKm + transitionAltitudeKm) * renderScale
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The same deterministic CPU height function runs for every LOD, preserving the
|
|
119
|
+
macro silhouette across switches.
|
|
120
|
+
|
|
121
|
+
Avoid storing four full high-density spheres when a chunked
|
|
122
|
+
quadtree/icosahedral patch system is required. Whole-sphere LOD is practical
|
|
123
|
+
for whole-body views, not ground-scale terrain streaming.
|
|
124
|
+
|
|
125
|
+
## 4. Shader tangential warp
|
|
126
|
+
|
|
127
|
+
The material path starts from radius-scaled sphere direction:
|
|
128
|
+
|
|
129
|
+
```text
|
|
130
|
+
warp coordinate = terrainKm * 0.00115 + seeded offset
|
|
131
|
+
warp = three independent noise channels - 0.5
|
|
132
|
+
warpTangent = warp - radial * dot(warp, radial)
|
|
133
|
+
warpAmplitudeKm = max(radiusKm * 0.012, 36)
|
|
134
|
+
warpedKm =
|
|
135
|
+
normalize(terrainKm + warpTangent * warpAmplitudeKm)
|
|
136
|
+
* radiusKm
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
This removes radial warp and reprojects to the shell, preventing region-scale
|
|
140
|
+
coordinate dilation.
|
|
141
|
+
|
|
142
|
+
Base material fields:
|
|
143
|
+
|
|
144
|
+
```text
|
|
145
|
+
macro A frequency 0.00034, weight 0.52
|
|
146
|
+
macro B frequency 0.00092, internal scale 0.52, composite weight 0.33
|
|
147
|
+
ridge frequency 0.0029, weight 0.25
|
|
148
|
+
crater-like frequency 0.0069, exponent 2.9
|
|
149
|
+
crater weight:
|
|
150
|
+
rocky/moon 0.34
|
|
151
|
+
other 0.09
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
The material mixes the synthesized macro field with the actual displaced
|
|
155
|
+
radius:
|
|
156
|
+
|
|
157
|
+
```text
|
|
158
|
+
macroHeight =
|
|
159
|
+
mix(shaderMacroSynthesis, geometryDisplacementHeight, 0.08)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
This is a visual alignment correction, not true function parity.
|
|
163
|
+
|
|
164
|
+
## 5. Objective geometry/material mismatch
|
|
165
|
+
|
|
166
|
+
The geometry path uses CPU value noise. The material path uses
|
|
167
|
+
`mx_noise_float` with different frequencies, seed offsets, warp behavior, and
|
|
168
|
+
body-specific fields.
|
|
169
|
+
|
|
170
|
+
Consequences:
|
|
171
|
+
|
|
172
|
+
```text
|
|
173
|
+
shader ridges can cross geometry valleys
|
|
174
|
+
close bump normals can imply relief absent from silhouette
|
|
175
|
+
biome altitude can disagree with actual displaced height
|
|
176
|
+
LOD silhouette remains stable, but material causes are only approximately tied
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Mitigate this mismatch by:
|
|
180
|
+
|
|
181
|
+
- preserving `surfaceDirection`;
|
|
182
|
+
- blending 8% actual displacement into material macro height;
|
|
183
|
+
- reducing detail by camera altitude;
|
|
184
|
+
- keeping geometric terrain amplitude modest.
|
|
185
|
+
|
|
186
|
+
The target skill should improve this when possible:
|
|
187
|
+
|
|
188
|
+
1. implement one shared deterministic field in CPU and shader forms;
|
|
189
|
+
2. validate sampled parity at fixed directions;
|
|
190
|
+
3. derive biome altitude from that shared field;
|
|
191
|
+
4. reserve material-only detail for sub-mesh-scale normal/roughness variation.
|
|
192
|
+
|
|
193
|
+
Do not cite planet-space implementation as evidence that independent geometry/material fields are
|
|
194
|
+
ideal.
|
|
195
|
+
|
|
196
|
+
## 6. Altitude-filtered detail
|
|
197
|
+
|
|
198
|
+
Compute camera altitude from body center and radius, then clamp against an
|
|
199
|
+
external detail-altitude uniform:
|
|
200
|
+
|
|
201
|
+
```text
|
|
202
|
+
detailAltitude =
|
|
203
|
+
min(cameraAltitude, surfaceDetailAltitude)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Thresholds:
|
|
207
|
+
|
|
208
|
+
```text
|
|
209
|
+
near = max(radius * 0.022, 6.5 world units)
|
|
210
|
+
mid = max(radius * 0.11, 24 world units)
|
|
211
|
+
far = max(radius * 0.50, 140 world units)
|
|
212
|
+
|
|
213
|
+
nearWeight = 1 - smoothstep(near, mid, altitude)
|
|
214
|
+
farWeight = smoothstep(mid, far, altitude)
|
|
215
|
+
midWeight = saturate(1 - nearWeight - farWeight)
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Use these weights for:
|
|
219
|
+
|
|
220
|
+
- normal perturbation;
|
|
221
|
+
- bump height;
|
|
222
|
+
- coastline edge width;
|
|
223
|
+
- wave detail;
|
|
224
|
+
- clearcoat;
|
|
225
|
+
- material micro-variation.
|
|
226
|
+
|
|
227
|
+
Do not change procedural frequency abruptly. Fade contribution strength.
|
|
228
|
+
|
|
229
|
+
## 7. Climate and biome causes
|
|
230
|
+
|
|
231
|
+
The shared solid-body material derives:
|
|
232
|
+
|
|
233
|
+
```text
|
|
234
|
+
humidity =
|
|
235
|
+
0.65 * broadNoise(0.0022)
|
|
236
|
+
+ 0.35 * detailNoise(0.0075)
|
|
237
|
+
|
|
238
|
+
temperature =
|
|
239
|
+
(1 - abs(latitude)^1.35) * 0.85
|
|
240
|
+
+ 0.15
|
|
241
|
+
- macroHeight * 0.32
|
|
242
|
+
|
|
243
|
+
slope =
|
|
244
|
+
1 - abs(dot(localNormal, radialDirection))
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Biome jitter uses a higher-frequency field at `0.018`.
|
|
248
|
+
|
|
249
|
+
Generic masks:
|
|
250
|
+
|
|
251
|
+
```text
|
|
252
|
+
snow: latitude + height + cold + small jitter
|
|
253
|
+
arid: inverse humidity + warmth - height + jitter
|
|
254
|
+
lush: humidity * temperature - aridity - slope + jitter
|
|
255
|
+
rock: slope + ridges + inverse humidity + jitter magnitude
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
The body-specific paths expand these causes rather than switching to arbitrary
|
|
259
|
+
color noise.
|
|
260
|
+
|
|
261
|
+
## 8. Pelagia terrestrial path
|
|
262
|
+
|
|
263
|
+
Pelagia’s definition:
|
|
264
|
+
|
|
265
|
+
```text
|
|
266
|
+
radius 12000 km
|
|
267
|
+
terrain amplitude 0.018
|
|
268
|
+
atmosphere height 200 km
|
|
269
|
+
atmosphere density 1.05
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Continents use an additional low-frequency three-channel warp with a fixed
|
|
273
|
+
`520 km` amplitude, followed by:
|
|
274
|
+
|
|
275
|
+
```text
|
|
276
|
+
continent frequencies: 0.00022, 0.00048, 0.00095
|
|
277
|
+
weights: 0.60, 0.28, 0.12
|
|
278
|
+
coast jitter: 0.0024
|
|
279
|
+
coast micro-jitter: 0.0085
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
The implementation keeps two coast widths:
|
|
283
|
+
|
|
284
|
+
```text
|
|
285
|
+
visual color edge:
|
|
286
|
+
altitude-filtered 0.016 -> 0.004
|
|
287
|
+
|
|
288
|
+
physical land/water edge:
|
|
289
|
+
altitude-filtered 0.006 -> 0.0014
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
This prevents orbit-view aliasing while keeping water material classification
|
|
293
|
+
sharper.
|
|
294
|
+
|
|
295
|
+
Terrain causes include:
|
|
296
|
+
|
|
297
|
+
- ridged tectonic chains and foothills;
|
|
298
|
+
- altitude lapse-rate cooling;
|
|
299
|
+
- subtropical aridity bands;
|
|
300
|
+
- forest coverage fields;
|
|
301
|
+
- tropical, temperate, boreal, desert, tundra, ice, rock, snow, and beach
|
|
302
|
+
weights;
|
|
303
|
+
- depth-graded ocean color;
|
|
304
|
+
- water currents and animated wave detail;
|
|
305
|
+
- wetness-driven roughness/specular/clearcoat.
|
|
306
|
+
|
|
307
|
+
This path is useful because land color, roughness, normal, snow, wetness, and
|
|
308
|
+
water identity share causes.
|
|
309
|
+
|
|
310
|
+
## 9. Astra rocky path
|
|
311
|
+
|
|
312
|
+
Astra’s definition:
|
|
313
|
+
|
|
314
|
+
```text
|
|
315
|
+
radius 5600 km
|
|
316
|
+
terrain amplitude 0.008
|
|
317
|
+
thin 45 km atmosphere
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Its material adds:
|
|
321
|
+
|
|
322
|
+
```text
|
|
323
|
+
basin-scale crater-like field at 0.00028
|
|
324
|
+
regional crater-like field at 0.0018
|
|
325
|
+
micro fields at 0.012 and 0.035
|
|
326
|
+
intercrater plains
|
|
327
|
+
bright ejecta-like ridges
|
|
328
|
+
lobate scarp-like ridges
|
|
329
|
+
volatile-loss hollow masks
|
|
330
|
+
three-band surface detail
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
Crater rims are estimated from offset-noise gradient magnitudes. Ejecta rays
|
|
334
|
+
are ridged noise correlated with the regional crater field.
|
|
335
|
+
|
|
336
|
+
This produces a rich Mercury-like material, but the “craters” remain
|
|
337
|
+
field-shaped rather than explicit geodesic crater stamps. Treat it as a
|
|
338
|
+
multi-scale material-causality pattern, not as a final crater geometry
|
|
339
|
+
algorithm.
|
|
340
|
+
|
|
341
|
+
## 10. Verdance rocky path
|
|
342
|
+
|
|
343
|
+
Verdance’s definition:
|
|
344
|
+
|
|
345
|
+
```text
|
|
346
|
+
radius 13600 km
|
|
347
|
+
terrain amplitude 0.02
|
|
348
|
+
200 km dusty atmosphere
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
Its Mars-like identity layers:
|
|
352
|
+
|
|
353
|
+
- hemispheric dichotomy with warped boundary;
|
|
354
|
+
- broad volcanic province and caldera mask;
|
|
355
|
+
- ridged equatorial canyon system;
|
|
356
|
+
- degraded highland and lowland crater fields;
|
|
357
|
+
- wind-aligned dunes;
|
|
358
|
+
- global dust mantling;
|
|
359
|
+
- dark slope streaks;
|
|
360
|
+
- limited basalt exposure;
|
|
361
|
+
- polar CO2 ice and layered polar terrain.
|
|
362
|
+
|
|
363
|
+
Wind-aligned dune coordinates are built from a fixed wind basis:
|
|
364
|
+
|
|
365
|
+
```text
|
|
366
|
+
u = dot(position, windDirection)
|
|
367
|
+
v = dot(position, perpendicularWindDirection)
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Macro and meso ridge fields are filtered with derivatives to reduce aliasing.
|
|
371
|
+
|
|
372
|
+
## 11. Gas and ice giants
|
|
373
|
+
|
|
374
|
+
Avoid longitude seams by representing longitude on a unit circle:
|
|
375
|
+
|
|
376
|
+
```text
|
|
377
|
+
longitude = atan(z, x)
|
|
378
|
+
advectedLongitude = longitude + time * jetSpeed(latitude)
|
|
379
|
+
longitudeVector = [cos(advectedLongitude), sin(advectedLongitude)]
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
Build the procedural coordinate from:
|
|
383
|
+
|
|
384
|
+
```text
|
|
385
|
+
[longitudeVector.x, longitudeVector.y, latitude01]
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
The band system combines:
|
|
389
|
+
|
|
390
|
+
- latitude-dependent advection;
|
|
391
|
+
- low-frequency warp;
|
|
392
|
+
- 20 gas-giant or 16 ice-giant bands;
|
|
393
|
+
- band noise;
|
|
394
|
+
- turbulent ridges;
|
|
395
|
+
- sparse storm masks and internal swirl;
|
|
396
|
+
- soft terminator;
|
|
397
|
+
- limb darkening and limb haze;
|
|
398
|
+
- wrapped diffuse illumination that keeps thick cloud decks faintly luminous
|
|
399
|
+
into the night-side edge.
|
|
400
|
+
|
|
401
|
+
This is a separate representation from solid terrain. Do not route gas giants
|
|
402
|
+
through the rocky biome stack.
|
|
403
|
+
|
|
404
|
+
## 12. Procedural bump and specular anti-aliasing
|
|
405
|
+
|
|
406
|
+
Derive a screen-space bump normal from height derivatives:
|
|
407
|
+
|
|
408
|
+
```text
|
|
409
|
+
sigmaX = normalize(dFdx(positionView))
|
|
410
|
+
sigmaY = normalize(dFdy(positionView))
|
|
411
|
+
dH = [dFdx(height), dFdy(height)] * bumpScale
|
|
412
|
+
|
|
413
|
+
r1 = cross(sigmaY, normalView)
|
|
414
|
+
r2 = cross(normalView, sigmaX)
|
|
415
|
+
det = dot(sigmaX, r1)
|
|
416
|
+
|
|
417
|
+
bumpNormal =
|
|
418
|
+
normalize(max(abs(det), epsilon) * normalView
|
|
419
|
+
- sign(det) * (dH.x * r1 + dH.y * r2))
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
Blend this with the broader perturbed normal using altitude weights.
|
|
423
|
+
|
|
424
|
+
Then increase roughness from normal variance:
|
|
425
|
+
|
|
426
|
+
```text
|
|
427
|
+
sigma² = max(dot(dFdx(N), dFdx(N)), dot(dFdy(N), dFdy(N)))
|
|
428
|
+
kernelRoughness = min(scale * sigma², 1)
|
|
429
|
+
filteredRoughness =
|
|
430
|
+
sqrt(baseRoughness² + kernelRoughness)
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
This is a directly reusable anti-sparkle contract for procedural planets.
|
|
434
|
+
|
|
435
|
+
## 13. Atmosphere handoff and limb clipping
|
|
436
|
+
|
|
437
|
+
The material applies distance-gated limb clipping for displaced atmospheric
|
|
438
|
+
bodies. It tests whether the camera ray to the fragment misses the base sphere
|
|
439
|
+
using an angular discriminant, avoiding catastrophic precision loss at large
|
|
440
|
+
distances.
|
|
441
|
+
|
|
442
|
+
Clip strength grows with:
|
|
443
|
+
|
|
444
|
+
```text
|
|
445
|
+
atmosphere visual height fraction
|
|
446
|
+
body radius fraction
|
|
447
|
+
minimum world-space fade range
|
|
448
|
+
camera detail altitude
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
Pelagia and Verdance disable the clip beyond about `10000 km` altitude with a
|
|
452
|
+
`1200 km` fade range.
|
|
453
|
+
|
|
454
|
+
Atmosphere rendering uses one model across shell and post paths, with
|
|
455
|
+
front/back shell opacity blended as the camera crosses the atmosphere. Preserve
|
|
456
|
+
that handoff; do not independently tune shell and post colors.
|
|
457
|
+
|
|
458
|
+
## 14. Refactor guidance
|
|
459
|
+
|
|
460
|
+
A visually rich all-body material can become very large and body-ID
|
|
461
|
+
conditional. Split it into atomic layers:
|
|
462
|
+
|
|
463
|
+
```text
|
|
464
|
+
shared planet coordinates and altitude LOD
|
|
465
|
+
shared climate/biome causes
|
|
466
|
+
solid-body material assembly
|
|
467
|
+
gas/ice giant band system
|
|
468
|
+
rocky cratered identity
|
|
469
|
+
terrestrial continent/ocean identity
|
|
470
|
+
dusty Mars identity
|
|
471
|
+
procedural bump + specular AA
|
|
472
|
+
atmosphere limb handoff
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
Keep body presets as data where possible. Use specialized code only when the
|
|
476
|
+
representation changes, such as gas giant bands versus solid terrain.
|
|
477
|
+
|
|
478
|
+
## 15. Required diagnostics
|
|
479
|
+
|
|
480
|
+
Expose:
|
|
481
|
+
|
|
482
|
+
```text
|
|
483
|
+
CPU geometry height
|
|
484
|
+
shader macro height
|
|
485
|
+
their absolute difference
|
|
486
|
+
tangential warp magnitude
|
|
487
|
+
near/mid/far detail weights
|
|
488
|
+
continent field and coast widths
|
|
489
|
+
climate humidity/temperature
|
|
490
|
+
biome masks
|
|
491
|
+
rock/snow/wetness
|
|
492
|
+
water depth classification
|
|
493
|
+
body-specific geological fields
|
|
494
|
+
procedural bump height
|
|
495
|
+
normal variance roughness
|
|
496
|
+
limb clip mask
|
|
497
|
+
shell/post atmosphere blend
|
|
498
|
+
```
|
|
@@ -5,28 +5,38 @@ description: Generate procedural vegetation for Genex Three.js games. Use for tr
|
|
|
5
5
|
|
|
6
6
|
# Genex Three.js Procedural Vegetation
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
8
|
+
Represent a plant as a growth hierarchy plus rendering adaptations. Do not model it as randomly scattered cylinders.
|
|
9
|
+
|
|
10
|
+
## Build sequence
|
|
11
|
+
|
|
12
|
+
1. Define a per-level species table: length, radius, taper, child count, emergence range, angle, twist, gnarliness, sections, radial segments.
|
|
13
|
+
2. Grow branches iteratively from a queue so recursion depth and budgets remain inspectable.
|
|
14
|
+
3. Emit each branch as oriented rings with an intentional UV seam.
|
|
15
|
+
4. Update section orientation from:
|
|
16
|
+
- inherited direction;
|
|
17
|
+
- stochastic curvature;
|
|
18
|
+
- tropism or external force;
|
|
19
|
+
- optional attraction constraints.
|
|
20
|
+
5. Spawn children with stratified longitudinal slots and independently permuted angular slots.
|
|
21
|
+
6. Generate leaves only after branch topology is stable.
|
|
22
|
+
7. Build foliage normals from both card orientation and local crown volume.
|
|
23
|
+
8. Choose wind scope explicitly. Leaf-root deformation, branch hierarchy deformation, and whole-tree sway are separate systems.
|
|
24
|
+
|
|
25
|
+
Read [references/vegetation-systems.md](references/vegetation-systems.md) and preserve its preset, continuation, child-placement, leaf, material, wind, and composition contracts before tuning.
|
|
26
|
+
|
|
27
|
+
## Visual failure conditions
|
|
28
|
+
|
|
29
|
+
- branches form visible helices;
|
|
30
|
+
- every child emerges at the same relative height;
|
|
31
|
+
- bark texture scale changes with branch radius;
|
|
32
|
+
- leaves reveal flat card normals under rotation;
|
|
33
|
+
- leaf wind moves card roots instead of remaining anchored;
|
|
34
|
+
- branch wind is claimed to match a reference whose branches are static;
|
|
35
|
+
- different seeds change species identity rather than controlled variation;
|
|
36
|
+
- geometry cost grows without a per-level budget.
|
|
37
|
+
|
|
38
|
+
## Routing boundary
|
|
39
|
+
|
|
40
|
+
Use `$genex-threejs-procedural-geometry` for generic branch-ring emission without a
|
|
41
|
+
growth model. This skill owns species tables, topology, child placement,
|
|
42
|
+
foliage, grass fields, roots, and hierarchical/rooted wind.
|