Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Hero loop: rebuild the chip fab as a cleanroom bay with moving hoist vehicles and walking engineers

Nguyen Xuan An0ba7b945b788
diff --git a/public/showcase/chipfab/credits.json b/public/showcase/chipfab/credits.json
new file mode 100644
index 00000000..b359e024
--- /dev/null
+++ b/public/showcase/chipfab/credits.json
@@ -0,0 +1,6 @@
+[
+ { "label": "Chip fab cleanroom bay, built in Blender for 67js (made-up tools, no real vendor)", "licence": "MIT", "href": "https://github.com/codepawl/67.js" },
+ { "label": "Universal Base Characters and Universal Animation Library (engineer body and walk cycle) by Quaternius", "licence": "CC0", "href": "https://quaternius.com/" },
+ { "label": "studio_small_09 (reflection light) by Poly Haven", "licence": "CC0", "href": "https://polyhaven.com/a/studio_small_09" },
+ { "label": "Perforated floor tile texture, generated for this scene", "licence": "MIT", "href": "https://github.com/codepawl/67.js" }
+]
diff --git a/public/showcase/chipfab/scene.glb b/public/showcase/chipfab/scene.glb
index 4fc7ddb7..344dd8fc 100644
Binary files a/public/showcase/chipfab/scene.glb and b/public/showcase/chipfab/scene.glb differ
diff --git a/public/showcase/chipfab/scene.json b/public/showcase/chipfab/scene.json
index dd8d2f46..7b997011 100644
--- a/public/showcase/chipfab/scene.json
+++ b/public/showcase/chipfab/scene.json
@@ -1,29 +1,260 @@
{
"id": "chipfab",
"title": "Chip fab",
- "blurb": "A semiconductor fab: cleanroom bays, overhead rail and wafer carriers.",
+ "blurb": "A semiconductor cleanroom bay: lithography scanners under yellow light, etch clusters, wet benches, stockers and overhead hoist rails carrying wafer pods.",
"glb": "/showcase/chipfab/scene.glb",
"hdri": "/showcase/chipfab/sky.hdr",
- "hdriOptions": { "intensity": 0.8, "rotation": 0, "showBackground": true, "backgroundBlur": 0.8 },
- "gltfOptions": { "maxTexturePixels": 33554432 },
- "exposure": 1,
+ "hdriOptions": {
+ "intensity": 1.0,
+ "rotation": 0,
+ "showBackground": false,
+ "backgroundBlur": 0
+ },
+ "gltfOptions": {
+ "maxTexturePixels": 33554432
+ },
+ "exposure": 0.88,
"renderer": {
"ground": false,
"hdr": true,
"samples": 4,
"environment": {
- "lightDirection": [-0.4, 0.8, 0.45],
- "keyColor": [2.4, 2.4, 2.5],
- "keyIntensity": 1,
- "fillIntensity": 0.5,
- "ambientIntensity": 0.9,
- "fogColor": [0.03, 0.04, 0.06],
- "fogDensity": 0.0009
+ "lightDirection": [
+ 0.2,
+ 1,
+ 0.1
+ ],
+ "keyColor": [
+ 1,
+ 1,
+ 1
+ ],
+ "keyIntensity": 0.0001,
+ "fillIntensity": 0.8,
+ "ambientIntensity": 1,
+ "fogColor": [
+ 0.78,
+ 0.84,
+ 0.92
+ ],
+ "fogDensity": 0.0016,
+ "pointLights": [
+ {
+ "position": [
+ 4,
+ 6.3,
+ 1.2
+ ],
+ "color": [
+ 1,
+ 0.72,
+ 0.3
+ ],
+ "intensity": 120,
+ "radius": 0.6,
+ "range": 26
+ },
+ {
+ "position": [
+ 13.7,
+ 6.3,
+ -1.2
+ ],
+ "color": [
+ 1,
+ 0.72,
+ 0.3
+ ],
+ "intensity": 120,
+ "radius": 0.6,
+ "range": 26
+ },
+ {
+ "position": [
+ 23.4,
+ 6.3,
+ 1.2
+ ],
+ "color": [
+ 1,
+ 0.72,
+ 0.3
+ ],
+ "intensity": 120,
+ "radius": 0.6,
+ "range": 26
+ },
+ {
+ "position": [
+ 33.1,
+ 6.3,
+ -1.2
+ ],
+ "color": [
+ 1,
+ 0.72,
+ 0.3
+ ],
+ "intensity": 120,
+ "radius": 0.6,
+ "range": 26
+ },
+ {
+ "position": [
+ 42.8,
+ 6.3,
+ 1.2
+ ],
+ "color": [
+ 0.86,
+ 0.92,
+ 1
+ ],
+ "intensity": 110,
+ "radius": 0.6,
+ "range": 26
+ },
+ {
+ "position": [
+ 52.5,
+ 6.3,
+ -1.2
+ ],
+ "color": [
+ 0.86,
+ 0.92,
+ 1
+ ],
+ "intensity": 110,
+ "radius": 0.6,
+ "range": 26
+ },
+ {
+ "position": [
+ 62.2,
+ 6.3,
+ 1.2
+ ],
+ "color": [
+ 0.86,
+ 0.92,
+ 1
+ ],
+ "intensity": 110,
+ "radius": 0.6,
+ "range": 26
+ },
+ {
+ "position": [
+ 71.9,
+ 6.3,
+ -1.2
+ ],
+ "color": [
+ 0.86,
+ 0.92,
+ 1
+ ],
+ "intensity": 110,
+ "radius": 0.6,
+ "range": 26
+ },
+ {
+ "position": [
+ 81.6,
+ 6.3,
+ 1.2
+ ],
+ "color": [
+ 0.86,
+ 0.92,
+ 1
+ ],
+ "intensity": 110,
+ "radius": 0.6,
+ "range": 26
+ },
+ {
+ "position": [
+ 91.3,
+ 6.3,
+ -1.2
+ ],
+ "color": [
+ 0.86,
+ 0.92,
+ 1
+ ],
+ "intensity": 110,
+ "radius": 0.6,
+ "range": 26
+ },
+ {
+ "position": [
+ 101,
+ 6.3,
+ 1.2
+ ],
+ "color": [
+ 0.86,
+ 0.92,
+ 1
+ ],
+ "intensity": 110,
+ "radius": 0.6,
+ "range": 26
+ },
+ {
+ "position": [
+ 110.7,
+ 6.3,
+ -1.2
+ ],
+ "color": [
+ 0.86,
+ 0.92,
+ 1
+ ],
+ "intensity": 110,
+ "radius": 0.6,
+ "range": 26
+ }
+ ]
+ }
+ },
+ "frame": {
+ "fov": 55,
+ "near": 0.3,
+ "far": 400,
+ "effects": {
+ "ambientOcclusion": 1.0,
+ "bloom": {
+ "strength": 0.25,
+ "threshold": 1,
+ "radius": 0.9
+ },
+ "saturation": 1.05,
+ "vignette": 0.25
}
},
- "frame": { "fov": 38, "near": 0.5, "far": 4000, "effects": { "ambientOcclusion": 0.6, "saturation": 1.05, "vignette": 0.2 } },
"credits": [
- { "model": "Chip fab world, built in code", "author": "CodePawl", "licence": "MIT", "source": "https://github.com/codepawl/67.js" },
- { "model": "rooftop_night (sky lighting, 128 x 64 average)", "author": "Poly Haven", "licence": "CC0", "source": "https://polyhaven.com/a/rooftop_night" }
+ {
+ "model": "Chip fab cleanroom bay, built in Blender for 67js",
+ "author": "CodePawl",
+ "licence": "MIT",
+ "source": "https://github.com/codepawl/67.js"
+ },
+ {
+ "model": "Universal Base Characters, Universal Animation Library",
+ "author": "Quaternius",
+ "licence": "CC0",
+ "source": "https://quaternius.com/"
+ },
+ {
+ "model": "studio_small_09 (reflection light)",
+ "author": "Poly Haven",
+ "licence": "CC0",
+ "source": "https://polyhaven.com/a/studio_small_09"
+ }
]
}
diff --git a/public/showcase/chipfab/sky.hdr b/public/showcase/chipfab/sky.hdr
index 4f759c4e..e9a2d227 100644
Binary files a/public/showcase/chipfab/sky.hdr and b/public/showcase/chipfab/sky.hdr differ
diff --git a/src/hero-lab/loop/scenes.js b/src/hero-lab/loop/scenes.js
index d6ab09e0..0dc6b37e 100644
--- a/src/hero-lab/loop/scenes.js
+++ b/src/hero-lab/loop/scenes.js
@@ -47,12 +47,16 @@ export const SCENES = [
description: '/showcase/chipfab/scene.json',
seconds: 10,
scrim: 0.6,
- near: 0.5,
- far: 4000,
+ near: 0.3,
+ far: 400,
+ // Cleanroom bay, 124 m long, in glTF units (Y up). FLIGHT NOTES: low down the aisle (y 1.5 to 2.8) between the tool rows
+ // (rows start at |z| 5.2, pods and rails at |z| 4.4), then up to 4.8 m under the hoist rails (5.8 m). Ends before the x = 88 rail crossing.
keys: [
- { at: 0, eye: [80.7, 76.4, 118.6], target: [77.6, 69.3, 109.4], fov: 30 },
- { at: 0.5, eye: [64, 75, 114], target: [60, 69, 107], fov: 32 },
- { at: 1, eye: [46, 76, 116], target: [42, 69, 108], fov: 34 },
+ { at: 0, eye: [0.5, 1.5, 0.8], target: [24, 1.7, -0.5], fov: 58 },
+ { at: 0.3, eye: [14, 1.7, -0.6], target: [40, 1.9, 0.4], fov: 58 },
+ { at: 0.6, eye: [30, 2.7, 0.2], target: [58, 2.6, 0], fov: 56 },
+ { at: 0.85, eye: [40, 4.2, 0], target: [60, 4.6, 2.5], fov: 54 },
+ { at: 1, eye: [46, 4.7, -1.2], target: [64, 5.0, 4], fov: 52 },
],
credits: [],
},
diff --git a/src/hero-lab/loop/world.js b/src/hero-lab/loop/world.js
index 1f9c9488..e3ed4b7b 100644
--- a/src/hero-lab/loop/world.js
+++ b/src/hero-lab/loop/world.js
@@ -41,8 +41,10 @@ export async function buildWorld(download, canvas, overrides = {}) {
const { description, paths, models, sky } = download;
const sharedTextures = createSharedTextures();
const files = [];
+ let animated = null;
for (const [index, model] of models.entries()) {
const loaded = await loadGltf(model, { baseUrl: baseUrlOf(paths[index]), sharedTextures, ...description.gltfOptions });
+ if (loaded.animations?.length) animated = loaded;
files.push({ parts: loaded.parts, ranks: await readPartRanks(model) });
}
const options = description.renderer;
@@ -67,6 +69,7 @@ export async function buildWorld(download, canvas, overrides = {}) {
detachReflection();
detachReflection = attachWaterReflection(renderer, whole.surface);
}
+ let animationOrigin = null;
const frame = { ...description.frame, exposure: description.exposure ?? 1 };
return {
id: description.id,
@@ -74,6 +77,11 @@ export async function buildWorld(download, canvas, overrides = {}) {
description,
canvas,
render(camera, seconds) {
+ // A GLB with an animation clip (vehicles on rails, people walking) plays from the world's first drawn frame.
+ if (animated) {
+ animationOrigin ??= seconds;
+ renderer.updateParts(animated.applyAnimation(seconds - animationOrigin, 0));
+ }
renderer.render({ ...frame, eye: camera.eye, target: camera.target, fov: camera.fov, time: seconds });
},
resize: () => renderer.resize(),