@genex-ai/cli-demo 0.93.0 → 0.94.0-dev.249
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 +26 -5
- package/package.json +1 -1
- package/templates/skills/genex-ai-model/SKILL.md +3 -2
- package/templates/skills/genex-ai-skybox/SKILL.md +4 -4
- package/templates/skills/genex-ai-texture/SKILL.md +1 -1
- package/templates/skills/genex-ai-video/SKILL.md +1 -1
- package/templates/skills/genex-game-director/SKILL.md +321 -411
- package/templates/skills/genex-game-director/references/design-contract.md +130 -179
- package/templates/skills/genex-game-director/references/routing-map.md +242 -362
- package/templates/skills/genex-getting-started/SKILL.md +2 -2
- package/templates/skills/genex-threejs-exposure-color-grading/SKILL.md +3 -7
- package/templates/skills/genex-threejs-multiplayer/SKILL.md +19 -2
- package/templates/skills/genex-threejs-procedural-assets/SKILL.md +112 -0
- package/templates/skills/genex-threejs-procedural-materials/SKILL.md +3 -7
- package/templates/skills/genex-threejs-procedural-vfx/SKILL.md +6 -11
- package/templates/skills/genex-threejs-shadow-systems/SKILL.md +2 -3
- package/templates/skills/genex-threejs-visual-validation/SKILL.md +0 -4
- package/templates/skills/genex-updates/SKILL.md +1 -1
- package/templates/skills/genex-threejs-atmosphere-aerial-perspective/SKILL.md +0 -46
- package/templates/skills/genex-threejs-atmosphere-aerial-perspective/references/atmosphere.md +0 -213
- package/templates/skills/genex-threejs-bloom/SKILL.md +0 -44
- package/templates/skills/genex-threejs-bloom/references/bloom.md +0 -187
- package/templates/skills/genex-threejs-exposure-color-grading/references/exposure-grading.md +0 -205
- package/templates/skills/genex-threejs-game-content/SKILL.md +0 -198
- package/templates/skills/genex-threejs-game-content/references/content-tables.md +0 -269
- package/templates/skills/genex-threejs-image-pipeline/SKILL.md +0 -56
- package/templates/skills/genex-threejs-image-pipeline/references/image-pipeline.md +0 -197
- package/templates/skills/genex-threejs-lighting-design/SKILL.md +0 -144
- package/templates/skills/genex-threejs-lighting-design/references/light-recipes.md +0 -137
- package/templates/skills/genex-threejs-open-world/SKILL.md +0 -149
- package/templates/skills/genex-threejs-open-world/references/terrain-streaming.md +0 -215
- package/templates/skills/genex-threejs-precipitation-surfaces/SKILL.md +0 -59
- package/templates/skills/genex-threejs-precipitation-surfaces/references/precipitation-surfaces.md +0 -181
- package/templates/skills/genex-threejs-procedural-architecture/SKILL.md +0 -50
- package/templates/skills/genex-threejs-procedural-architecture/references/architecture-systems.md +0 -509
- package/templates/skills/genex-threejs-procedural-fields/SKILL.md +0 -61
- package/templates/skills/genex-threejs-procedural-fields/references/field-systems.md +0 -232
- package/templates/skills/genex-threejs-procedural-geometry/SKILL.md +0 -39
- package/templates/skills/genex-threejs-procedural-geometry/references/mesh-systems.md +0 -202
- package/templates/skills/genex-threejs-procedural-materials/references/material-systems.md +0 -198
- package/templates/skills/genex-threejs-procedural-planets/SKILL.md +0 -48
- package/templates/skills/genex-threejs-procedural-planets/references/planet-systems.md +0 -498
- package/templates/skills/genex-threejs-procedural-vegetation/SKILL.md +0 -52
- package/templates/skills/genex-threejs-procedural-vegetation/references/vegetation-systems.md +0 -314
- package/templates/skills/genex-threejs-procedural-vfx/references/vfx-systems.md +0 -218
- package/templates/skills/genex-threejs-raymarched-space-effects/SKILL.md +0 -37
- package/templates/skills/genex-threejs-raymarched-space-effects/references/space-effects.md +0 -194
- package/templates/skills/genex-threejs-screen-space-ambient-occlusion/SKILL.md +0 -35
- package/templates/skills/genex-threejs-screen-space-ambient-occlusion/references/ambient-occlusion.md +0 -441
- package/templates/skills/genex-threejs-spectral-ocean/SKILL.md +0 -52
- package/templates/skills/genex-threejs-spectral-ocean/references/spectral-ocean.md +0 -473
- package/templates/skills/genex-threejs-temporal-surfaces/SKILL.md +0 -41
- package/templates/skills/genex-threejs-temporal-surfaces/references/temporal-surfaces.md +0 -207
- package/templates/skills/genex-threejs-visual-validation/references/visual-validation.md +0 -427
- package/templates/skills/genex-threejs-volumetric-clouds/SKILL.md +0 -49
- package/templates/skills/genex-threejs-volumetric-clouds/references/volumetric-clouds.md +0 -579
- package/templates/skills/genex-threejs-water-optics/SKILL.md +0 -57
- package/templates/skills/genex-threejs-water-optics/references/water-optics.md +0 -195
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
# Procedural field-stack recipes
|
|
2
|
-
|
|
3
|
-
Use this reference to construct coherent field bundles for spherical terrain, altitude-filtered detail, terrain wetness, water optics, and structured stochastic placement.
|
|
4
|
-
|
|
5
|
-
## Contents
|
|
6
|
-
|
|
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
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## Stable coordinate ownership
|
|
18
|
-
|
|
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.
|
|
118
|
-
|
|
119
|
-
## pooled VFX system terrain coupling
|
|
120
|
-
|
|
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
|
|
219
|
-
|
|
220
|
-
Expose:
|
|
221
|
-
|
|
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
|
-
```
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: genex-threejs-procedural-geometry
|
|
3
|
-
description: Build procedural mesh systems for Genex Three.js games. Use for mesh writers, profile sweeps, rails, branches, frames, collision-aware shapes, UV density, custom normals, material groups, instancing decisions, and geometry that must hold up to close gameplay inspection.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Genex Three.js Procedural Geometry
|
|
7
|
-
|
|
8
|
-
Generate geometry from a semantic plan and an explicit coordinate frame. Triangle emission is the final compilation step, not the design model.
|
|
9
|
-
|
|
10
|
-
## Build order
|
|
11
|
-
|
|
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
|
-
## Failure conditions
|
|
25
|
-
|
|
26
|
-
- profile orientation flips along a curve;
|
|
27
|
-
- caps reuse side vertices and create averaged edge normals;
|
|
28
|
-
- UV scale changes with segment count;
|
|
29
|
-
- arbitrary vertex merging destroys hard edges or material boundaries;
|
|
30
|
-
- generated dimensions are hidden in magic multipliers;
|
|
31
|
-
- instancing is used despite per-instance topology differences;
|
|
32
|
-
- triangle count is the only reported complexity metric.
|
|
33
|
-
|
|
34
|
-
## Routing boundary
|
|
35
|
-
|
|
36
|
-
This skill owns reusable mesh emission. Use
|
|
37
|
-
`$genex-threejs-procedural-architecture` for a building grammar and
|
|
38
|
-
`$genex-threejs-procedural-vegetation` for a growth hierarchy; those subject skills
|
|
39
|
-
may then apply these geometry mechanisms.
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
# Sculpted profiles and semantic mesh emission
|
|
2
|
-
|
|
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
|
-
|
|
5
|
-
## Contents
|
|
6
|
-
|
|
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
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## selective gallery pipeline sculpted frame profile
|
|
18
|
-
|
|
19
|
-
The frame is not a beveled box. A normalized rail coordinate `t` drives a
|
|
20
|
-
profile assembled from named lobes:
|
|
21
|
-
|
|
22
|
-
```text
|
|
23
|
-
crown:
|
|
24
|
-
0.355 * scale * sin(pi*t)^0.56
|
|
25
|
-
|
|
26
|
-
inner bead:
|
|
27
|
-
0.105 * scale * exp(-((t - 0.085) / 0.033)^2)
|
|
28
|
-
|
|
29
|
-
outer bead:
|
|
30
|
-
0.092 * scale * exp(-((t - 0.905) / 0.038)^2)
|
|
31
|
-
|
|
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
|
-
```
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
# Procedural PBR material systems
|
|
2
|
-
|
|
3
|
-
Use this reference for atlas filtering, shared shadow and light causes, planet-space material fields, wetness, per-instance dissolve, and authored physical-material identities.
|
|
4
|
-
|
|
5
|
-
## Contents
|
|
6
|
-
|
|
7
|
-
- atlas-based renderer block material
|
|
8
|
-
- Atlas and minification response
|
|
9
|
-
- Shared shadow/light causes
|
|
10
|
-
- planet-space implementation planetary material
|
|
11
|
-
- pooled VFX system terrain and debris
|
|
12
|
-
- selective gallery pipeline authored PBR identities
|
|
13
|
-
- Selection rules and limitations
|
|
14
|
-
- Diagnostics
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## atlas-based renderer block material
|
|
18
|
-
|
|
19
|
-
The block material is a complete custom shader whose inputs include:
|
|
20
|
-
|
|
21
|
-
```text
|
|
22
|
-
atlas albedo and optional normal
|
|
23
|
-
per-vertex AO/skylight/tint color
|
|
24
|
-
sun direction/color
|
|
25
|
-
four custom shadow cascades
|
|
26
|
-
projected procedural cloud shadow
|
|
27
|
-
environment cube
|
|
28
|
-
roughness/metalness
|
|
29
|
-
daylight and starlight factors
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Its useful material mechanisms are:
|
|
33
|
-
|
|
34
|
-
1. world position and view-space depth remain available for cascade choice;
|
|
35
|
-
2. world-space shadow texel width scales bias and filter radius;
|
|
36
|
-
3. cloud shadow projects a receiver point to a cloud plane along sun direction;
|
|
37
|
-
4. normal derivatives increase effective roughness;
|
|
38
|
-
5. atlas sampling clamps to the current tile interior;
|
|
39
|
-
6. anisotropic minification chooses a major-axis multi-tap filter.
|
|
40
|
-
|
|
41
|
-
Specular antialiasing:
|
|
42
|
-
|
|
43
|
-
```text
|
|
44
|
-
variance =
|
|
45
|
-
max(dot(dFdx(N), dFdx(N)),
|
|
46
|
-
dot(dFdy(N), dFdy(N)))
|
|
47
|
-
|
|
48
|
-
filteredRoughness =
|
|
49
|
-
clamp(sqrt(roughness^2 + variance), 0, 1)
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
This is a practical filtering mechanism. It should still be compared against the
|
|
53
|
-
renderer’s current physical-material and normal-filtering behavior before
|
|
54
|
-
replacing built-in shading.
|
|
55
|
-
|
|
56
|
-
## Atlas and minification response
|
|
57
|
-
|
|
58
|
-
For an atlas with `atlasSize` tiles across and `tileSize` texels per tile:
|
|
59
|
-
|
|
60
|
-
```text
|
|
61
|
-
tile width = 1 / atlasSize
|
|
62
|
-
horizontal inset = 0.5 / (atlasSize * tileSize)
|
|
63
|
-
vertical inset = 0.5 / tileSize
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Estimate the `dFdx/dFdy` footprint in texels. When minification grows, blend
|
|
67
|
-
away from the base sample. If anisotropy exceeds `2`, sample `7` or `9` taps
|
|
68
|
-
along the major axis.
|
|
69
|
-
|
|
70
|
-
This avoids adjacent-tile bleed for direct taps, but shader clamping cannot fix
|
|
71
|
-
atlas mip levels that were generated without duplicated tile borders. Require
|
|
72
|
-
offline mip-safe padding when adopting this mechanism.
|
|
73
|
-
|
|
74
|
-
## Shared shadow/light causes
|
|
75
|
-
|
|
76
|
-
atlas-based renderer’s cloud shadow uses the same conceptual field as its visible cloud
|
|
77
|
-
layer:
|
|
78
|
-
|
|
79
|
-
```text
|
|
80
|
-
project receiver to cloud altitude along sun direction
|
|
81
|
-
advect by shared wind and time scale
|
|
82
|
-
evaluate the same five-octave cloud field
|
|
83
|
-
apply coverage and density shaping
|
|
84
|
-
attenuate direct sunlight
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
The material does not darken emission or all ambient response with this term.
|
|
88
|
-
Keep projected environmental shadows attached to direct-light ownership.
|
|
89
|
-
|
|
90
|
-
## planet-space implementation planetary material
|
|
91
|
-
|
|
92
|
-
planet-space implementation’s solid planets preserve an undeformed radial attribute and use it for
|
|
93
|
-
all geological sampling. Camera-altitude weights reduce high-frequency bump
|
|
94
|
-
and optical detail.
|
|
95
|
-
|
|
96
|
-
For gas and ice giants, seam-free longitude is represented as:
|
|
97
|
-
|
|
98
|
-
```text
|
|
99
|
-
longitude = atan(z, x)
|
|
100
|
-
longitude circle = (cos(longitude + advection), sin(longitude + advection))
|
|
101
|
-
coordinate = (circle.x, circle.y, latitude01)
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Latitude bands, seeded warp, turbulence, and storm masks share this coordinate.
|
|
105
|
-
Roughness responds to the same final mask. Limb haze and wrapped diffuse
|
|
106
|
-
lighting are added separately.
|
|
107
|
-
|
|
108
|
-
For solid bodies, procedural bump normal is derived from screen derivatives of
|
|
109
|
-
the height node and view position. This keeps the renderer’s material lighting
|
|
110
|
-
path while changing only the normal input.
|
|
111
|
-
|
|
112
|
-
The known debt is geometry/material field mismatch; see the planet and field
|
|
113
|
-
references. Do not infer that close bump can substitute for silhouette parity.
|
|
114
|
-
|
|
115
|
-
## pooled VFX system terrain and debris
|
|
116
|
-
|
|
117
|
-
Terrain identity:
|
|
118
|
-
|
|
119
|
-
```text
|
|
120
|
-
grassness = smoothstep(0.01, 1, normalWorld.y^1.6)
|
|
121
|
-
color = mix(shared-noise soil, shared-noise grass, grassness)
|
|
122
|
-
roughness = blend(soil response, grass response, grassness) - wetness
|
|
123
|
-
metalness = 0.2
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
Wetness comes from world height near the water plane and the broad noise field.
|
|
127
|
-
It changes roughness and color together.
|
|
128
|
-
|
|
129
|
-
Debris uses per-instance `isOrange` and `removalTimeSeconds`. Geometry-space
|
|
130
|
-
noise controls discard as lifetime expires. Its color is reinforced at the rim
|
|
131
|
-
through Fresnel and receives a small environment term of `0.05`.
|
|
132
|
-
|
|
133
|
-
The reusable pattern is per-instance material state, not one cloned material
|
|
134
|
-
per object.
|
|
135
|
-
|
|
136
|
-
## selective gallery pipeline authored PBR identities
|
|
137
|
-
|
|
138
|
-
The gallery defines distinct frame surfaces with real texture and response
|
|
139
|
-
bundles:
|
|
140
|
-
|
|
141
|
-
| Surface | Roughness | Metalness | Clearcoat | Clearcoat roughness | Bump |
|
|
142
|
-
| --- | ---: | ---: | ---: | ---: | ---: |
|
|
143
|
-
| walnut | 0.42 | 0.04 | 0.62 | 0.28 | 0.022 |
|
|
144
|
-
| antique gold | 0.24 | 0.78 | 0.24 | 0.20 | 0.012 |
|
|
145
|
-
| ebony | 0.40 | 0.03 | 0.70 | 0.24 | 0.018 |
|
|
146
|
-
|
|
147
|
-
Wall plaster stays near roughness `0.94–0.96`, floor `0.92`, and mat board
|
|
148
|
-
`0.92`. These ranges preserve material separation before bloom.
|
|
149
|
-
|
|
150
|
-
Chandelier bloom meshes intentionally use `MeshBasicMaterial`, with bulb and
|
|
151
|
-
filament materials marked `toneMapped = false`. That is contribution ownership
|
|
152
|
-
for a stylized light source, not a physically based metal recipe.
|
|
153
|
-
|
|
154
|
-
## Selection rules and limitations
|
|
155
|
-
|
|
156
|
-
Use the material mechanisms according to representation:
|
|
157
|
-
|
|
158
|
-
```text
|
|
159
|
-
atlas voxel surface -> atlas-based renderer filtering and custom shadow hooks
|
|
160
|
-
planet surface -> planet-space implementation radial fields and altitude filtering
|
|
161
|
-
terrain/wetness -> pooled VFX system world-height causal blend
|
|
162
|
-
authored luxury material -> selective gallery pipeline response bundle
|
|
163
|
-
pooled effect debris -> pooled VFX system per-instance attributes
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
Do not combine every mechanism into one universal material.
|
|
167
|
-
|
|
168
|
-
Exact node/material extension hooks are version-sensitive. Inspect the
|
|
169
|
-
installed renderer before porting atlas-based renderer's full custom shader or adapting
|
|
170
|
-
planet-space implementation's node-material normal and emissive inputs.
|
|
171
|
-
|
|
172
|
-
Observed limits:
|
|
173
|
-
|
|
174
|
-
- atlas-based renderer replaces the full physical shader, increasing maintenance and making
|
|
175
|
-
backend migration harder.
|
|
176
|
-
- Its custom lighting must be checked for energy consistency and environment
|
|
177
|
-
parity.
|
|
178
|
-
- selective gallery pipeline’s chandelier basic materials rely on selective bloom and are not a
|
|
179
|
-
substitute for lit metal in non-emissive views.
|
|
180
|
-
- pooled VFX system uses undefined reversed-edge `smoothstep` in wetness expressions; write
|
|
181
|
-
portable equivalent logic.
|
|
182
|
-
- planet-space implementation has approximate rather than exact geometry/material field parity.
|
|
183
|
-
|
|
184
|
-
## Diagnostics
|
|
185
|
-
|
|
186
|
-
Expose:
|
|
187
|
-
|
|
188
|
-
```text
|
|
189
|
-
atlas tile and sample footprint
|
|
190
|
-
roughness before/after specular AA
|
|
191
|
-
cloud shadow field
|
|
192
|
-
shadow cascade and world texel size
|
|
193
|
-
planet coordinate, altitude weights, and material masks
|
|
194
|
-
terrain grassness and wetness
|
|
195
|
-
debris instance attributes and dissolve threshold
|
|
196
|
-
base frame material without post
|
|
197
|
-
raw emissive contribution for bloom-only materials
|
|
198
|
-
```
|