@base2datadesign/viewer-kit 0.1.2 → 0.2.0
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/engine/types.d.ts +64 -0
- package/dist/engine/types.d.ts.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/materials/architectural.d.ts +6 -0
- package/dist/materials/architectural.d.ts.map +1 -0
- package/dist/materials/architectural.js +169 -0
- package/dist/materials/catalogue-data.d.ts +149 -0
- package/dist/materials/catalogue-data.d.ts.map +1 -0
- package/dist/materials/catalogue-data.js +158 -0
- package/dist/materials/catalogue.d.ts +5 -0
- package/dist/materials/catalogue.d.ts.map +1 -0
- package/dist/materials/catalogue.js +23 -0
- package/dist/materials/presets.d.ts +21 -0
- package/dist/materials/presets.d.ts.map +1 -0
- package/dist/materials/presets.js +217 -0
- package/dist/materials/renderMetadata.d.ts +15 -0
- package/dist/materials/renderMetadata.d.ts.map +1 -0
- package/dist/materials/renderMetadata.js +64 -0
- package/dist/materials/types.d.ts +50 -0
- package/dist/materials/types.d.ts.map +1 -0
- package/dist/materials/types.js +1 -0
- package/dist/presets/sciencePresets.d.ts +7 -0
- package/dist/presets/sciencePresets.d.ts.map +1 -0
- package/dist/presets/sciencePresets.js +473 -0
- package/dist/sky/scienceSky.d.ts +10 -0
- package/dist/sky/scienceSky.d.ts.map +1 -0
- package/dist/sky/scienceSky.js +68 -0
- package/dist/systems/debugSystem.d.ts.map +1 -1
- package/dist/systems/debugSystem.js +32 -9
- package/dist/systems/environmentSystem.d.ts +1 -0
- package/dist/systems/environmentSystem.d.ts.map +1 -1
- package/dist/systems/environmentSystem.js +19 -0
- package/dist/systems/lightingSystem.d.ts +1 -0
- package/dist/systems/lightingSystem.d.ts.map +1 -1
- package/dist/systems/lightingSystem.js +27 -0
- package/dist/systems/postfxSystem.d.ts +5 -0
- package/dist/systems/postfxSystem.d.ts.map +1 -1
- package/dist/systems/postfxSystem.js +57 -4
- package/package.json +1 -1
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
import { BASELINE_MATERIAL_PRESET_ID } from "../materials/presets";
|
|
2
|
+
const DEFAULT_LIGHTING_PRESET_ID = "architectural";
|
|
3
|
+
const DEFAULT_ENVIRONMENT_PRESET_ID = "architectural";
|
|
4
|
+
const DEFAULT_SCENE_EXTRAS = {
|
|
5
|
+
ground: true,
|
|
6
|
+
grid: true,
|
|
7
|
+
axes: true,
|
|
8
|
+
origin: true,
|
|
9
|
+
gridOpacity: 0.12,
|
|
10
|
+
gridDivisions: 80,
|
|
11
|
+
gridSize: 80,
|
|
12
|
+
groundRoughness: 0.8,
|
|
13
|
+
groundMetalness: 0.05,
|
|
14
|
+
lightTarget: [0, 1.5, 0],
|
|
15
|
+
originHighlight: true,
|
|
16
|
+
originLineColor: 0x94a3b8,
|
|
17
|
+
originLineLength: 40,
|
|
18
|
+
originLineThickness: 0.06,
|
|
19
|
+
axisLabelScale: 0.35,
|
|
20
|
+
axesLabels: {
|
|
21
|
+
lowerCase: true,
|
|
22
|
+
upperCase: true,
|
|
23
|
+
offset: 0.4,
|
|
24
|
+
secondaryOffset: 0.5,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
const PRESET_SCENE_EXTRAS = {
|
|
28
|
+
architectural: {
|
|
29
|
+
ground: true,
|
|
30
|
+
grid: true,
|
|
31
|
+
axes: true,
|
|
32
|
+
origin: true,
|
|
33
|
+
groundColor: 0xf5f5f5,
|
|
34
|
+
groundRoughness: 0.75,
|
|
35
|
+
groundMetalness: 0.0,
|
|
36
|
+
gridColor: 0xdedede,
|
|
37
|
+
gridColorSecondary: 0xeaeaea,
|
|
38
|
+
gridOpacity: 0.12,
|
|
39
|
+
gridDivisions: 100,
|
|
40
|
+
gridSize: 100,
|
|
41
|
+
gridHeightOffset: 0.09,
|
|
42
|
+
},
|
|
43
|
+
studio: {
|
|
44
|
+
ground: true,
|
|
45
|
+
grid: true,
|
|
46
|
+
axes: true,
|
|
47
|
+
origin: false,
|
|
48
|
+
groundColor: 0x1f2024,
|
|
49
|
+
groundRoughness: 0.9,
|
|
50
|
+
groundMetalness: 0.08,
|
|
51
|
+
gridColor: 0x353840,
|
|
52
|
+
gridOpacity: 0.12,
|
|
53
|
+
},
|
|
54
|
+
daylight: {
|
|
55
|
+
ground: true,
|
|
56
|
+
grid: true,
|
|
57
|
+
axes: true,
|
|
58
|
+
origin: true,
|
|
59
|
+
groundColor: 0xe2d5c2,
|
|
60
|
+
groundRoughness: 0.7,
|
|
61
|
+
groundMetalness: 0.04,
|
|
62
|
+
gridColor: 0xf6ead7,
|
|
63
|
+
gridOpacity: 0.2,
|
|
64
|
+
},
|
|
65
|
+
"gallery-spot": {
|
|
66
|
+
ground: true,
|
|
67
|
+
grid: true,
|
|
68
|
+
axes: true,
|
|
69
|
+
origin: false,
|
|
70
|
+
groundColor: 0x131419,
|
|
71
|
+
groundRoughness: 0.85,
|
|
72
|
+
groundMetalness: 0.02,
|
|
73
|
+
gridColor: 0x2c3242,
|
|
74
|
+
gridOpacity: 0.1,
|
|
75
|
+
lightTarget: [0, 1.2, 0],
|
|
76
|
+
},
|
|
77
|
+
"lab-neutral": {
|
|
78
|
+
ground: true,
|
|
79
|
+
grid: true,
|
|
80
|
+
axes: true,
|
|
81
|
+
origin: true,
|
|
82
|
+
groundColor: 0xf4f5f7,
|
|
83
|
+
groundRoughness: 0.78,
|
|
84
|
+
groundMetalness: 0.03,
|
|
85
|
+
gridColor: 0xd0d6de,
|
|
86
|
+
gridOpacity: 0.16,
|
|
87
|
+
},
|
|
88
|
+
"atrium-suntrack": {
|
|
89
|
+
ground: true,
|
|
90
|
+
grid: true,
|
|
91
|
+
axes: true,
|
|
92
|
+
origin: false,
|
|
93
|
+
groundColor: 0xe3c7a4,
|
|
94
|
+
groundRoughness: 0.72,
|
|
95
|
+
groundMetalness: 0.05,
|
|
96
|
+
gridColor: 0xf4dfc2,
|
|
97
|
+
gridOpacity: 0.18,
|
|
98
|
+
},
|
|
99
|
+
"flow-horizon": {
|
|
100
|
+
ground: true,
|
|
101
|
+
grid: true,
|
|
102
|
+
axes: true,
|
|
103
|
+
origin: false,
|
|
104
|
+
groundColor: 0x1c212f,
|
|
105
|
+
groundRoughness: 0.82,
|
|
106
|
+
groundMetalness: 0.03,
|
|
107
|
+
gridColor: 0xffa66a,
|
|
108
|
+
gridOpacity: 0.22,
|
|
109
|
+
gridDivisions: 120,
|
|
110
|
+
gridSize: 200,
|
|
111
|
+
},
|
|
112
|
+
"biophilic-soft": {
|
|
113
|
+
ground: true,
|
|
114
|
+
grid: true,
|
|
115
|
+
axes: true,
|
|
116
|
+
origin: true,
|
|
117
|
+
groundColor: 0xcad8c9,
|
|
118
|
+
groundRoughness: 0.78,
|
|
119
|
+
groundMetalness: 0.02,
|
|
120
|
+
gridColor: 0xe2efe0,
|
|
121
|
+
gridOpacity: 0.18,
|
|
122
|
+
lightTarget: [0, 1.6, 0],
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
const PRESET_SKY_OVERRIDES = {
|
|
126
|
+
architectural: { mode: "gradient" },
|
|
127
|
+
studio: { mode: "gradient" },
|
|
128
|
+
daylight: { mode: "gradient" },
|
|
129
|
+
"gallery-spot": { mode: "gradient" },
|
|
130
|
+
"lab-neutral": { mode: "gradient" },
|
|
131
|
+
"atrium-suntrack": { mode: "gradient" },
|
|
132
|
+
"flow-horizon": { mode: "gradient" },
|
|
133
|
+
"biophilic-soft": { mode: "gradient" },
|
|
134
|
+
};
|
|
135
|
+
const COOL_WHITE = 0xf6fbff;
|
|
136
|
+
const DEFAULT_INTERIOR_LIGHTS = [
|
|
137
|
+
{ position: [0, 2.5, 0], intensity: 1.15, distance: 40, color: COOL_WHITE },
|
|
138
|
+
{ position: [4, 2.5, 4], intensity: 0.55, distance: 25, color: COOL_WHITE },
|
|
139
|
+
{ position: [-4, 2.5, -4], intensity: 0.55, distance: 25, color: COOL_WHITE },
|
|
140
|
+
];
|
|
141
|
+
const PRESET_MATERIAL_OVERRIDES = {
|
|
142
|
+
architectural: BASELINE_MATERIAL_PRESET_ID,
|
|
143
|
+
studio: "studio",
|
|
144
|
+
daylight: "daylight",
|
|
145
|
+
"gallery-spot": "gallery-spot",
|
|
146
|
+
"lab-neutral": "lab-neutral",
|
|
147
|
+
"atrium-suntrack": "atrium-suntrack",
|
|
148
|
+
"flow-horizon": "flow-horizon",
|
|
149
|
+
"biophilic-soft": "biophilic-soft",
|
|
150
|
+
};
|
|
151
|
+
const LIGHTING_PRESET_DATA = {
|
|
152
|
+
architectural: {
|
|
153
|
+
id: "architectural",
|
|
154
|
+
label: "architectural white",
|
|
155
|
+
description: "bright diffuse envelope with matte walls and calibrated AO",
|
|
156
|
+
includeInteriorLights: true,
|
|
157
|
+
config: {
|
|
158
|
+
background: 0xffffff,
|
|
159
|
+
ambient: { color: 0xf5fbff, intensity: 1.0 },
|
|
160
|
+
hemisphere: { sky: 0xf8fbff, ground: 0xf1f4f8, intensity: 1.3 },
|
|
161
|
+
key: { color: 0xf8fcff, intensity: 2.0, position: [10, 15, 5] },
|
|
162
|
+
fill: { color: 0xeaf2ff, intensity: 0.85, position: [-10, 10, -5] },
|
|
163
|
+
shadows: true,
|
|
164
|
+
shadow: { cameraSize: 28, near: 0.5, far: 80, bias: -0.00008, radius: 2.5 },
|
|
165
|
+
ao: { enabled: true, intensity: 2.5, radius: 4.0, distanceFalloff: 1.0, halfRes: false },
|
|
166
|
+
toneMappingExposure: 1.05,
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
studio: {
|
|
170
|
+
id: "studio",
|
|
171
|
+
label: "studio lighting",
|
|
172
|
+
description: "three-point rig with dramatic contrast and deep background",
|
|
173
|
+
includeInteriorLights: false,
|
|
174
|
+
config: {
|
|
175
|
+
background: 0x1a1a1a,
|
|
176
|
+
ambient: { color: 0xffffff, intensity: 0.6 },
|
|
177
|
+
hemisphere: { sky: 0xffffff, ground: 0x1a1a1a, intensity: 0.6 },
|
|
178
|
+
key: { color: 0xffffff, intensity: 1.8, position: [12, 14, 8] },
|
|
179
|
+
fill: { color: 0xffffff, intensity: 0.9, position: [-8, 6, -6] },
|
|
180
|
+
shadows: true,
|
|
181
|
+
shadow: { cameraSize: 24, near: 0.4, far: 70, bias: -0.00006, radius: 2 },
|
|
182
|
+
ao: { enabled: true, intensity: 3.0, radius: 3.0, distanceFalloff: 1.2, halfRes: false },
|
|
183
|
+
toneMappingExposure: 1.1,
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
daylight: {
|
|
187
|
+
id: "daylight",
|
|
188
|
+
label: "natural daylight",
|
|
189
|
+
description: "outdoor sun and sky gradient for aperture studies",
|
|
190
|
+
includeInteriorLights: false,
|
|
191
|
+
config: {
|
|
192
|
+
background: 0x87ceeb,
|
|
193
|
+
ambient: { color: 0xffffff, intensity: 0.8 },
|
|
194
|
+
hemisphere: { sky: 0x87ceeb, ground: 0x8b7355, intensity: 1.0 },
|
|
195
|
+
key: { color: 0xfff5e1, intensity: 2.0, position: [20, 30, 15] },
|
|
196
|
+
fill: { color: 0xadd8e6, intensity: 0.3, position: [-5, 5, -10] },
|
|
197
|
+
shadows: true,
|
|
198
|
+
shadow: { cameraSize: 32, near: 0.5, far: 90, bias: -0.00008, radius: 2.8 },
|
|
199
|
+
ao: { enabled: true, intensity: 1.8, radius: 3.5, distanceFalloff: 1.0, halfRes: true },
|
|
200
|
+
toneMappingExposure: 1.2,
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
"gallery-spot": {
|
|
204
|
+
id: "gallery-spot",
|
|
205
|
+
label: "gallery spot",
|
|
206
|
+
description: "high contrast exhibit lighting with focused key beams",
|
|
207
|
+
includeInteriorLights: false,
|
|
208
|
+
config: {
|
|
209
|
+
background: 0x101012,
|
|
210
|
+
ambient: { color: 0x262626, intensity: 0.4 },
|
|
211
|
+
hemisphere: { sky: 0x2d2f38, ground: 0x131315, intensity: 0.5 },
|
|
212
|
+
key: { color: 0xfff1d6, intensity: 2.6, position: [6, 7, 2] },
|
|
213
|
+
fill: { color: 0x4f5a6a, intensity: 0.9, position: [-4, 5, -3] },
|
|
214
|
+
shadows: true,
|
|
215
|
+
shadow: { cameraSize: 18, near: 0.3, far: 45, bias: -0.00002, radius: 1.5 },
|
|
216
|
+
ao: { enabled: true, intensity: 3.2, radius: 3.2, distanceFalloff: 1.4, halfRes: false },
|
|
217
|
+
toneMappingExposure: 1.15,
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
"lab-neutral": {
|
|
221
|
+
id: "lab-neutral",
|
|
222
|
+
label: "lab neutral",
|
|
223
|
+
description: "low contrast neutral lab benchmark for sensory baselines",
|
|
224
|
+
includeInteriorLights: false,
|
|
225
|
+
config: {
|
|
226
|
+
background: 0xf5f6f8,
|
|
227
|
+
ambient: { color: 0xffffff, intensity: 1.1 },
|
|
228
|
+
hemisphere: { sky: 0xf0f4f9, ground: 0xdfe2e6, intensity: 1.0 },
|
|
229
|
+
key: { color: 0xf8fbff, intensity: 1.2, position: [8, 6, 4] },
|
|
230
|
+
fill: { color: 0xebeff5, intensity: 0.9, position: [-6, 5, -4] },
|
|
231
|
+
shadows: false,
|
|
232
|
+
shadow: { cameraSize: 24, near: 0.5, far: 60, bias: -0.00005, radius: 2 },
|
|
233
|
+
ao: { enabled: true, intensity: 1.2, radius: 2.5, distanceFalloff: 0.9, halfRes: true },
|
|
234
|
+
toneMappingExposure: 0.95,
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
"atrium-suntrack": {
|
|
238
|
+
id: "atrium-suntrack",
|
|
239
|
+
label: "atrium suntrack",
|
|
240
|
+
description: "zenith-focused atrium lighting with animated sun sweep",
|
|
241
|
+
includeInteriorLights: true,
|
|
242
|
+
config: {
|
|
243
|
+
background: 0xfdfcf8,
|
|
244
|
+
ambient: { color: 0xfff8ef, intensity: 0.9 },
|
|
245
|
+
hemisphere: { sky: 0xfff4d6, ground: 0xf3f0e6, intensity: 0.85 },
|
|
246
|
+
key: { color: 0xfff1cc, intensity: 2.4, position: [0, 18, 0] },
|
|
247
|
+
fill: { color: 0xd6e4f7, intensity: 0.6, position: [-10, 8, -5] },
|
|
248
|
+
shadows: true,
|
|
249
|
+
shadow: { cameraSize: 26, near: 0.4, far: 75, bias: -0.00004, radius: 2.3 },
|
|
250
|
+
ao: { enabled: true, intensity: 2.2, radius: 3.8, distanceFalloff: 1.1, halfRes: false },
|
|
251
|
+
toneMappingExposure: 1.08,
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
"flow-horizon": {
|
|
255
|
+
id: "flow-horizon",
|
|
256
|
+
label: "flow horizon",
|
|
257
|
+
description: "warm optic-flow horizon line for evening sequences",
|
|
258
|
+
includeInteriorLights: false,
|
|
259
|
+
config: {
|
|
260
|
+
background: 0x1a1f28,
|
|
261
|
+
ambient: { color: 0x3a3d44, intensity: 0.5 },
|
|
262
|
+
hemisphere: { sky: 0x2a3342, ground: 0x14181f, intensity: 0.6 },
|
|
263
|
+
key: { color: 0xffcba8, intensity: 2.2, position: [15, 6, -4] },
|
|
264
|
+
fill: { color: 0x93b6ff, intensity: 0.7, position: [-10, 4, 6] },
|
|
265
|
+
shadows: true,
|
|
266
|
+
shadow: { cameraSize: 18, near: 0.3, far: 45, bias: -0.00002, radius: 1.4 },
|
|
267
|
+
ao: { enabled: true, intensity: 2.6, radius: 3.0, distanceFalloff: 1.3, halfRes: false },
|
|
268
|
+
toneMappingExposure: 1.05,
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
"biophilic-soft": {
|
|
272
|
+
id: "biophilic-soft",
|
|
273
|
+
label: "biophilic soft",
|
|
274
|
+
description: "diffuse daylight with green bounce for recovery zones",
|
|
275
|
+
includeInteriorLights: true,
|
|
276
|
+
config: {
|
|
277
|
+
background: 0xeaf3ec,
|
|
278
|
+
ambient: { color: 0xf7fff2, intensity: 1.05 },
|
|
279
|
+
hemisphere: { sky: 0xe1f1e4, ground: 0xcad7c4, intensity: 0.9 },
|
|
280
|
+
key: { color: 0xffefd6, intensity: 1.9, position: [8, 9, 5] },
|
|
281
|
+
fill: { color: 0xb7d7ff, intensity: 0.7, position: [-6, 6, -4] },
|
|
282
|
+
shadows: true,
|
|
283
|
+
shadow: { cameraSize: 24, near: 0.4, far: 65, bias: -0.00005, radius: 2.2 },
|
|
284
|
+
ao: { enabled: true, intensity: 2.1, radius: 3.5, distanceFalloff: 1.05, halfRes: false },
|
|
285
|
+
toneMappingExposure: 1.03,
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
};
|
|
289
|
+
const ENVIRONMENT_PRESET_DATA = {
|
|
290
|
+
architectural: {
|
|
291
|
+
id: "architectural",
|
|
292
|
+
label: "architectural horizon",
|
|
293
|
+
topColor: 0xffffff,
|
|
294
|
+
horizonColor: 0xd8d8d8,
|
|
295
|
+
sunPosition: [0.3, 0.8, 0.4],
|
|
296
|
+
sunIntensity: 0.15,
|
|
297
|
+
sunSize: 0.08,
|
|
298
|
+
groundColor: 0xf5f5f5,
|
|
299
|
+
},
|
|
300
|
+
studio: {
|
|
301
|
+
id: "studio",
|
|
302
|
+
label: "studio dusk",
|
|
303
|
+
topColor: 0x111218,
|
|
304
|
+
horizonColor: 0x050608,
|
|
305
|
+
sunPosition: [0.2, 0.7, 0.4],
|
|
306
|
+
sunIntensity: 0.12,
|
|
307
|
+
sunSize: 0.05,
|
|
308
|
+
groundColor: 0x1a1a1d,
|
|
309
|
+
},
|
|
310
|
+
daylight: {
|
|
311
|
+
id: "daylight",
|
|
312
|
+
label: "daylight gradient",
|
|
313
|
+
topColor: 0xcfe7ff,
|
|
314
|
+
horizonColor: 0xf5d7ae,
|
|
315
|
+
sunPosition: [0.4, 0.85, 0.25],
|
|
316
|
+
sunIntensity: 0.22,
|
|
317
|
+
sunSize: 0.07,
|
|
318
|
+
groundColor: 0xe8ded0,
|
|
319
|
+
},
|
|
320
|
+
"gallery-spot": {
|
|
321
|
+
id: "gallery-spot",
|
|
322
|
+
label: "gallery noir",
|
|
323
|
+
topColor: 0x1b1d24,
|
|
324
|
+
horizonColor: 0x0c0d10,
|
|
325
|
+
sunPosition: [0.25, 0.75, 0.1],
|
|
326
|
+
sunIntensity: 0.14,
|
|
327
|
+
sunSize: 0.04,
|
|
328
|
+
groundColor: 0x0b0d12,
|
|
329
|
+
},
|
|
330
|
+
"lab-neutral": {
|
|
331
|
+
id: "lab-neutral",
|
|
332
|
+
label: "lab overcast",
|
|
333
|
+
topColor: 0xf0f2f5,
|
|
334
|
+
horizonColor: 0xe4e7eb,
|
|
335
|
+
sunPosition: [0.3, 0.8, 0.3],
|
|
336
|
+
sunIntensity: 0.16,
|
|
337
|
+
sunSize: 0.06,
|
|
338
|
+
groundColor: 0xf5f6f8,
|
|
339
|
+
},
|
|
340
|
+
"atrium-suntrack": {
|
|
341
|
+
id: "atrium-suntrack",
|
|
342
|
+
label: "atrium sun bloom",
|
|
343
|
+
topColor: 0xfff4d6,
|
|
344
|
+
horizonColor: 0xffd9a6,
|
|
345
|
+
sunPosition: [0.05, 0.95, 0.05],
|
|
346
|
+
sunIntensity: 0.28,
|
|
347
|
+
sunSize: 0.09,
|
|
348
|
+
groundColor: 0xe4c7a1,
|
|
349
|
+
},
|
|
350
|
+
"flow-horizon": {
|
|
351
|
+
id: "flow-horizon",
|
|
352
|
+
label: "flow horizon",
|
|
353
|
+
topColor: 0x0f1a2c,
|
|
354
|
+
horizonColor: 0xff8c4c,
|
|
355
|
+
sunPosition: [0.25, 0.6, -0.15],
|
|
356
|
+
sunIntensity: 0.32,
|
|
357
|
+
sunSize: 0.08,
|
|
358
|
+
groundColor: 0x0b0f19,
|
|
359
|
+
},
|
|
360
|
+
"biophilic-soft": {
|
|
361
|
+
id: "biophilic-soft",
|
|
362
|
+
label: "biophilic haze",
|
|
363
|
+
topColor: 0xdceedf,
|
|
364
|
+
horizonColor: 0xb6d3cc,
|
|
365
|
+
sunPosition: [0.3, 0.75, 0.2],
|
|
366
|
+
sunIntensity: 0.2,
|
|
367
|
+
sunSize: 0.07,
|
|
368
|
+
groundColor: 0xcadccf,
|
|
369
|
+
},
|
|
370
|
+
};
|
|
371
|
+
const colorToHex = (value) => `#${value.toString(16).padStart(6, "0")}`;
|
|
372
|
+
const buildSky = (environment, override) => {
|
|
373
|
+
if (override?.mode === "hdr" && "hdr" in override) {
|
|
374
|
+
return { mode: "hdr", hdr: override.hdr };
|
|
375
|
+
}
|
|
376
|
+
if (override?.mode === "cube" && "cube" in override) {
|
|
377
|
+
return { mode: "cube", cube: override.cube };
|
|
378
|
+
}
|
|
379
|
+
return {
|
|
380
|
+
mode: "gradient",
|
|
381
|
+
gradient: {
|
|
382
|
+
topColor: colorToHex(environment.topColor),
|
|
383
|
+
horizonColor: colorToHex(environment.horizonColor),
|
|
384
|
+
sunPosition: environment.sunPosition,
|
|
385
|
+
sunIntensity: environment.sunIntensity,
|
|
386
|
+
sunSize: environment.sunSize,
|
|
387
|
+
},
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
const buildLightingRig = (preset) => ({
|
|
391
|
+
rig: preset.id === "studio"
|
|
392
|
+
? "studio"
|
|
393
|
+
: preset.id === "gallery-spot"
|
|
394
|
+
? "gallery"
|
|
395
|
+
: preset.id === "lab-neutral"
|
|
396
|
+
? "neutral"
|
|
397
|
+
: undefined,
|
|
398
|
+
ambient: { color: colorToHex(preset.config.ambient.color), intensity: preset.config.ambient.intensity },
|
|
399
|
+
hemisphere: preset.config.hemisphere
|
|
400
|
+
? {
|
|
401
|
+
skyColor: colorToHex(preset.config.hemisphere.sky),
|
|
402
|
+
groundColor: colorToHex(preset.config.hemisphere.ground),
|
|
403
|
+
intensity: preset.config.hemisphere.intensity,
|
|
404
|
+
}
|
|
405
|
+
: undefined,
|
|
406
|
+
key: {
|
|
407
|
+
color: colorToHex(preset.config.key.color),
|
|
408
|
+
intensity: preset.config.key.intensity,
|
|
409
|
+
position: preset.config.key.position,
|
|
410
|
+
castShadow: preset.config.shadows,
|
|
411
|
+
},
|
|
412
|
+
fill: {
|
|
413
|
+
color: colorToHex(preset.config.fill.color),
|
|
414
|
+
intensity: preset.config.fill.intensity,
|
|
415
|
+
position: preset.config.fill.position,
|
|
416
|
+
},
|
|
417
|
+
shadow: preset.config.shadow,
|
|
418
|
+
});
|
|
419
|
+
const buildRendererConfig = (preset) => ({
|
|
420
|
+
toneMapping: "neutral",
|
|
421
|
+
toneMappingExposure: preset.config.toneMappingExposure,
|
|
422
|
+
outputColorSpace: "srgb",
|
|
423
|
+
antialias: true,
|
|
424
|
+
shadowMap: {
|
|
425
|
+
enabled: preset.config.shadows,
|
|
426
|
+
type: "pcfsoft",
|
|
427
|
+
},
|
|
428
|
+
});
|
|
429
|
+
const buildPostFxConfig = (preset) => ({
|
|
430
|
+
ao: preset.config.ao
|
|
431
|
+
? {
|
|
432
|
+
enabled: preset.config.ao.enabled,
|
|
433
|
+
intensity: preset.config.ao.intensity,
|
|
434
|
+
radius: preset.config.ao.radius,
|
|
435
|
+
distanceFalloff: preset.config.ao.distanceFalloff,
|
|
436
|
+
halfRes: preset.config.ao.halfRes,
|
|
437
|
+
}
|
|
438
|
+
: { enabled: false },
|
|
439
|
+
});
|
|
440
|
+
export const SCIENCE_PRESET_SUMMARIES = Object.fromEntries(Object.entries(LIGHTING_PRESET_DATA).map(([id, preset]) => [id, preset.description]));
|
|
441
|
+
export const SCIENCE_DEFAULT_PRESET_ID = DEFAULT_LIGHTING_PRESET_ID;
|
|
442
|
+
export function buildViewerPresets() {
|
|
443
|
+
const presets = {};
|
|
444
|
+
Object.entries(LIGHTING_PRESET_DATA).forEach(([id, lighting]) => {
|
|
445
|
+
const environment = ENVIRONMENT_PRESET_DATA[id] ?? ENVIRONMENT_PRESET_DATA[DEFAULT_ENVIRONMENT_PRESET_ID];
|
|
446
|
+
const sceneExtrasSource = PRESET_SCENE_EXTRAS[id] ?? DEFAULT_SCENE_EXTRAS;
|
|
447
|
+
const sceneExtras = { ...DEFAULT_SCENE_EXTRAS, ...sceneExtrasSource };
|
|
448
|
+
const includeInteriorLights = lighting.includeInteriorLights !== false;
|
|
449
|
+
const skyOverride = PRESET_SKY_OVERRIDES[id];
|
|
450
|
+
presets[id] = {
|
|
451
|
+
id,
|
|
452
|
+
label: lighting.label,
|
|
453
|
+
renderer: buildRendererConfig(lighting),
|
|
454
|
+
sky: buildSky(environment, skyOverride),
|
|
455
|
+
lighting: buildLightingRig(lighting),
|
|
456
|
+
postfx: buildPostFxConfig(lighting),
|
|
457
|
+
sceneExtras,
|
|
458
|
+
interiorLights: includeInteriorLights
|
|
459
|
+
? DEFAULT_INTERIOR_LIGHTS.map((light) => ({
|
|
460
|
+
position: light.position,
|
|
461
|
+
intensity: light.intensity,
|
|
462
|
+
distance: light.distance,
|
|
463
|
+
color: colorToHex(light.color ?? 0xffffff),
|
|
464
|
+
}))
|
|
465
|
+
: undefined,
|
|
466
|
+
materialsPresetId: PRESET_MATERIAL_OVERRIDES[id] ?? BASELINE_MATERIAL_PRESET_ID,
|
|
467
|
+
};
|
|
468
|
+
});
|
|
469
|
+
return presets;
|
|
470
|
+
}
|
|
471
|
+
// Legacy alias kept for existing consumers; use buildViewerPresets instead.
|
|
472
|
+
export const buildSciencePresets = buildViewerPresets;
|
|
473
|
+
export const SCIENCE_PRESETS = buildViewerPresets();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RenderPresetDefinition } from "../engine/types";
|
|
2
|
+
export type ScienceSkyOption = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
sky?: RenderPresetDefinition["sky"];
|
|
7
|
+
};
|
|
8
|
+
export declare function listScienceSkyOptions(): ScienceSkyOption[];
|
|
9
|
+
export declare function getScienceSkyOption(id: string): ScienceSkyOption | undefined;
|
|
10
|
+
//# sourceMappingURL=scienceSky.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scienceSky.d.ts","sourceRoot":"","sources":["../../src/sky/scienceSky.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAC;CACrC,CAAC;AAkEF,wBAAgB,qBAAqB,IAAI,gBAAgB,EAAE,CAE1D;AAED,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAE5E"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const HDR_BASE = "https://assets.treasury.space/science/hdr/shared";
|
|
2
|
+
const SCIENCE_SKY_OPTIONS = [
|
|
3
|
+
{
|
|
4
|
+
id: "preset",
|
|
5
|
+
label: "Preset Dome",
|
|
6
|
+
description: "Use the sky gradient defined by the active render preset.",
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
id: "canary-wharf",
|
|
10
|
+
label: "Canary Wharf",
|
|
11
|
+
description: "Golden-hour skyline reflections",
|
|
12
|
+
sky: {
|
|
13
|
+
mode: "hdr",
|
|
14
|
+
hdr: { src: `${HDR_BASE}/canary_wharf_4k.hdr`, exposure: 1.1 },
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "kloofendal",
|
|
19
|
+
label: "Kloofendal Sky",
|
|
20
|
+
description: "Bright partly cloudy daylight",
|
|
21
|
+
sky: {
|
|
22
|
+
mode: "hdr",
|
|
23
|
+
hdr: { src: `${HDR_BASE}/kloofendal_48d_partly_cloudy_puresky_4k.hdr`, exposure: 1.0 },
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "venetian-crossroads",
|
|
28
|
+
label: "Venetian Crossroads",
|
|
29
|
+
description: "Cool overcast reflections",
|
|
30
|
+
sky: {
|
|
31
|
+
mode: "hdr",
|
|
32
|
+
hdr: { src: `${HDR_BASE}/venetian_crossroads_4k.hdr`, exposure: 1.05 },
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "rural-road",
|
|
37
|
+
label: "Rural Evening",
|
|
38
|
+
description: "Warm sunset horizon",
|
|
39
|
+
sky: {
|
|
40
|
+
mode: "hdr",
|
|
41
|
+
hdr: { src: `${HDR_BASE}/rural_evening_road_4k.hdr`, exposure: 1.2 },
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "spruit-sunrise",
|
|
46
|
+
label: "Spruit Sunrise",
|
|
47
|
+
description: "Soft morning bounce",
|
|
48
|
+
sky: {
|
|
49
|
+
mode: "hdr",
|
|
50
|
+
hdr: { src: `${HDR_BASE}/spruit_sunrise_4k.hdr`, exposure: 1.08 },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: "dikhololo-night",
|
|
55
|
+
label: "Dikhololo Night",
|
|
56
|
+
description: "Night sky with subtle fill",
|
|
57
|
+
sky: {
|
|
58
|
+
mode: "hdr",
|
|
59
|
+
hdr: { src: `${HDR_BASE}/dikhololo_night_4k.hdr`, exposure: 0.65 },
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
export function listScienceSkyOptions() {
|
|
64
|
+
return SCIENCE_SKY_OPTIONS;
|
|
65
|
+
}
|
|
66
|
+
export function getScienceSkyOption(id) {
|
|
67
|
+
return SCIENCE_SKY_OPTIONS.find((option) => option.id === id);
|
|
68
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugSystem.d.ts","sourceRoot":"","sources":["../../src/systems/debugSystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAqB,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AASjF,qBAAa,WAAW;IACtB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,OAAO,CAAwB;gBAE3B,KAAK,EAAE,KAAK,CAAC,KAAK;IAI9B,KAAK,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"debugSystem.d.ts","sourceRoot":"","sources":["../../src/systems/debugSystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAqB,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AASjF,qBAAa,WAAW;IACtB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,OAAO,CAAwB;gBAE3B,KAAK,EAAE,KAAK,CAAC,KAAK;IAI9B,KAAK,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI;IAkE3C,OAAO,IAAI,IAAI;IAIf,OAAO,CAAC,GAAG;IAKX,OAAO,CAAC,KAAK;CAed"}
|
|
@@ -15,11 +15,12 @@ export class DebugSystem {
|
|
|
15
15
|
const extras = { ...DEFAULT_EXTRAS, ...(preset.sceneExtras ?? {}) };
|
|
16
16
|
this.clear();
|
|
17
17
|
if (extras.ground) {
|
|
18
|
-
const
|
|
18
|
+
const size = extras.groundSize ?? 300;
|
|
19
|
+
const groundGeometry = new THREE.PlaneGeometry(size, size);
|
|
19
20
|
const groundMaterial = new THREE.MeshStandardMaterial({
|
|
20
|
-
color: 0xf5f5f5,
|
|
21
|
-
roughness: 0.75,
|
|
22
|
-
metalness: 0.0,
|
|
21
|
+
color: extras.groundColor ?? 0xf5f5f5,
|
|
22
|
+
roughness: extras.groundRoughness ?? 0.75,
|
|
23
|
+
metalness: extras.groundMetalness ?? 0.0,
|
|
23
24
|
toneMapped: false,
|
|
24
25
|
});
|
|
25
26
|
const ground = new THREE.Mesh(groundGeometry, groundMaterial);
|
|
@@ -29,18 +30,40 @@ export class DebugSystem {
|
|
|
29
30
|
this.add(ground);
|
|
30
31
|
}
|
|
31
32
|
if (extras.grid) {
|
|
32
|
-
const
|
|
33
|
-
|
|
33
|
+
const gridSize = extras.gridSize ?? 100;
|
|
34
|
+
const divisions = extras.gridDivisions ?? 50;
|
|
35
|
+
const gridHelper = new THREE.GridHelper(gridSize, divisions, extras.gridColor ?? 0xdedede, extras.gridColorSecondary ?? 0xeaeaea);
|
|
36
|
+
gridHelper.position.y = extras.gridHeightOffset ?? -0.09;
|
|
37
|
+
const gridOpacity = extras.gridOpacity;
|
|
38
|
+
if (typeof gridOpacity === "number") {
|
|
39
|
+
const material = gridHelper.material;
|
|
40
|
+
const applyOpacity = (mat) => {
|
|
41
|
+
mat.opacity = gridOpacity;
|
|
42
|
+
mat.transparent = gridOpacity < 1;
|
|
43
|
+
};
|
|
44
|
+
if (Array.isArray(material)) {
|
|
45
|
+
material.forEach(applyOpacity);
|
|
46
|
+
}
|
|
47
|
+
else if (material) {
|
|
48
|
+
applyOpacity(material);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
34
51
|
this.add(gridHelper);
|
|
35
52
|
}
|
|
36
53
|
if (extras.axes) {
|
|
37
54
|
const axes = new THREE.AxesHelper(3);
|
|
38
|
-
|
|
55
|
+
if (extras.axesPosition) {
|
|
56
|
+
axes.position.set(...extras.axesPosition);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
axes.position.set(-15, 0.1, -15);
|
|
60
|
+
}
|
|
39
61
|
this.add(axes);
|
|
40
62
|
}
|
|
41
63
|
if (extras.origin) {
|
|
42
|
-
const
|
|
43
|
-
const
|
|
64
|
+
const originSize = extras.originSize ?? 0.1;
|
|
65
|
+
const originGeometry = new THREE.SphereGeometry(originSize, 16, 16);
|
|
66
|
+
const originMaterial = new THREE.MeshBasicMaterial({ color: extras.originColor ?? 0x666666 });
|
|
44
67
|
const origin = new THREE.Mesh(originGeometry, originMaterial);
|
|
45
68
|
origin.position.set(0, 0, 0);
|
|
46
69
|
this.add(origin);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environmentSystem.d.ts","sourceRoot":"","sources":["../../src/systems/environmentSystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAA8C,MAAM,iBAAiB,CAAC;AAEzH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,KAAK,GAAG,MAAM,CAAC;IAC3C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,aAAa,CAAC,CAAgB;IACtC,OAAO,CAAC,cAAc,CAAqC;IAE3D,OAAO,CAAC,cAAc,CAAwB;IAC9C,OAAO,CAAC,iBAAiB,CAAkD;IAC3E,OAAO,CAAC,kBAAkB,CAAkD;IAC5E,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,SAAS,CAAK;IAEtB,OAAO,CAAC,KAAK,CAAwF;gBAEzF,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,aAAa,EAAE,aAAa,CAAC,EAAE,aAAa;IAM5F,QAAQ,IAAI,gBAAgB;IAItB,KAAK,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IA2B1D,OAAO,IAAI,IAAI;IAQf,OAAO,CAAC,cAAc;
|
|
1
|
+
{"version":3,"file":"environmentSystem.d.ts","sourceRoot":"","sources":["../../src/systems/environmentSystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAA8C,MAAM,iBAAiB,CAAC;AAEzH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,KAAK,GAAG,MAAM,CAAC;IAC3C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,aAAa,CAAC,CAAgB;IACtC,OAAO,CAAC,cAAc,CAAqC;IAE3D,OAAO,CAAC,cAAc,CAAwB;IAC9C,OAAO,CAAC,iBAAiB,CAAkD;IAC3E,OAAO,CAAC,kBAAkB,CAAkD;IAC5E,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,SAAS,CAAK;IAEtB,OAAO,CAAC,KAAK,CAAwF;gBAEzF,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,aAAa,EAAE,aAAa,CAAC,EAAE,aAAa;IAM5F,QAAQ,IAAI,gBAAgB;IAItB,KAAK,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IA2B1D,OAAO,IAAI,IAAI;IAQf,OAAO,CAAC,cAAc;IAqCtB,OAAO,CAAC,gBAAgB;YA6CV,YAAY;YAaZ,WAAW;YAsDX,YAAY;IAoD1B,OAAO,CAAC,oBAAoB;CAY7B"}
|
|
@@ -70,6 +70,11 @@ export class EnvironmentSystem {
|
|
|
70
70
|
if (this.scene.environment === this.currentEnvironment) {
|
|
71
71
|
this.scene.environment = null;
|
|
72
72
|
}
|
|
73
|
+
const anyScene = this.scene;
|
|
74
|
+
if (anyScene.backgroundRotation?.set)
|
|
75
|
+
anyScene.backgroundRotation.set(0, 0, 0);
|
|
76
|
+
if (anyScene.environmentRotation?.set)
|
|
77
|
+
anyScene.environmentRotation.set(0, 0, 0);
|
|
73
78
|
if (this.currentBackground)
|
|
74
79
|
this.currentBackground.dispose();
|
|
75
80
|
if (this.currentEnvironment && this.currentEnvironment !== this.currentBackground) {
|
|
@@ -159,6 +164,7 @@ export class EnvironmentSystem {
|
|
|
159
164
|
if (typeof hdr.rotationY === "number") {
|
|
160
165
|
texture.rotation = hdr.rotationY;
|
|
161
166
|
}
|
|
167
|
+
this.applyRotationToScene(hdr.rotation, hdr.rotationY);
|
|
162
168
|
let environmentTexture = null;
|
|
163
169
|
if (lightingEnabled) {
|
|
164
170
|
if (usePmrem) {
|
|
@@ -207,6 +213,7 @@ export class EnvironmentSystem {
|
|
|
207
213
|
return;
|
|
208
214
|
}
|
|
209
215
|
texture.needsUpdate = true;
|
|
216
|
+
this.applyRotationToScene(cube.rotation, cube.rotationY);
|
|
210
217
|
let environmentTexture = null;
|
|
211
218
|
if (lightingEnabled) {
|
|
212
219
|
if (usePmrem) {
|
|
@@ -229,4 +236,16 @@ export class EnvironmentSystem {
|
|
|
229
236
|
}
|
|
230
237
|
this.state = { mode: "cube", backgroundEnabled, lightingEnabled };
|
|
231
238
|
}
|
|
239
|
+
applyRotationToScene(rotation, rotationY) {
|
|
240
|
+
const yaw = rotation?.yaw ?? rotationY ?? 0;
|
|
241
|
+
const pitch = rotation?.pitch ?? 0;
|
|
242
|
+
const roll = rotation?.roll ?? 0;
|
|
243
|
+
const anyScene = this.scene;
|
|
244
|
+
if (anyScene.backgroundRotation?.set) {
|
|
245
|
+
anyScene.backgroundRotation.set(pitch, yaw, roll);
|
|
246
|
+
}
|
|
247
|
+
if (anyScene.environmentRotation?.set) {
|
|
248
|
+
anyScene.environmentRotation.set(pitch, yaw, roll);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
232
251
|
}
|