ai21.net
語言

從房間縮放到誇克的3D場景

示範影片

從房間縮放到誇克的3D場景 — 1從房間縮放到誇克的3D場景 — 2

提示詞

INFINIZOOM

Build infinizoom: a procedural infinite-zoom world. The deliverable is a
self-contained BunJS project. Running `bun run server` must build and serve it
(wire up the corresponding "server" script in package.json). Three local assets
exist in this directory and must be used: ./macbook_interior.png (a real MacBook
Pro teardown photo), ./apple_m4_scheme.png (Apple's M4 die floorplan diagram),
and ./wallpaper.jpg (a 1920×1200 desktop wallpaper photo). Load the wallpaper
from this local file — never fetch content from external servers (the sole
exception: three.js itself may be imported from a CDN by URL).

The world

A single 3D world is traveled indefinitely along a fixed camera track that zooms
through these levels:

Main route: a room → a desk → a MacBook Pro → inside the chassis → the logic
board → the Apple M4 package → the M4 die → a performance core → an integer ALU
block → a standard logic cell → a FinFET transistor → a material cross-section
inside the fin → the silicon crystal lattice → one unit cell → an atom → its
nucleus → a nucleon → a quark. Logic gates and circuits (AND, OR, etc.) should
be animated as it computes.

Screen branch: exactly one bifurcation, hovering above the MacBook. Choosing the
other side dives into the display instead: the screen → the display panel →
pixel tiles → a pixel block → one pixel → its R/G/B sub-pixel LEDs → the
emissive layer → an emitter molecule → and converges to the same atom → nucleus
→ nucleon → quark tail. The leds must be accurate: 1-to-1 mapping from screen
pixels to leds, and their colors must match the color of that pixel. The screen
is animated and the LEDs are updated to match the animation in real time.

Riding the track forward IS zooming in; riding backward is zooming out. The
design must extend additively: adding a new structure = one render function +
one call in its parent; adding a bifurcation = one more route; a future backward
extension (t < 0: out the window → city → planet → universe) must require only
prepending track levels. A time parameter must be threaded through everything so
all animation stays possible at any depth.

Architecture (hard constraints)

- Mutable state is EXACTLY: one float t (position along the track), one branch
  bitstring (0 = left/A, 1 = right/D; a bit is pushed when passing a fork and
  popped when backing out below it), and raw input (keys held, mouse position).
  Every frame is a pure function of (t, branches, raw input, wall-clock time).
  No other state — no scene graph, no node objects, no stored world data, no
  caches of world structure.
- Renderers are pure functions that call their children directly: render_room()
  calls render_desk() calls render_macbook() … down to render_quark(). No
  dispatch layer, no classes. The call stack is the scene traversal.
- Scale-space warping via local unit frames: floats cannot hold meters and
  femtometers at once, so every renderer works in its own ~unit-sized local
  frame, and the camera is re-expressed into each child frame. Geometry math is
  done camera-relative in doubles, cast to float only at the very end, so the
  picture is artifact-free across all ~17 decades of scale. The exact same
  layout constants must place structures for rendering AND author the track —
  one source of truth, or the camera drifts visibly off the line.
- Immediate-mode rendering over three.js: every frame, the recursion emits
  primitives into instanced pools; three.js is only a rasterizer. Nothing
  off-screen or sub-pixel is emitted or recursed into.

The track and the camera

- Speed: fast. The whole main ride should take roughly 20 seconds, with a
  comfortable, constant-feeling time per level (exponential zoom feel) and
  gentle easing near the fork and the track ends.
- Shape: gently curved arcs. Not wandering, roundabout, or random-direction —
  but also NOT dead-straight rays. Soft, purposeful curves.
- The green line: the track is always visible in-scene as a translucent green
  line. It must be an infinitesimal line: ~2 pixels wide on screen at EVERY
  distance, implemented as a true GL line primitive (not tubes, not rods, not
  meshes of any kind), transparent (never rock-solid), and it must NEVER grow
  wider as it approaches or passes the camera — it is literally a path line,
  visible both near and far.
- The camera must never look at nothing. At every instant of the ride the view
  must be filled with structure. Concretely: every level approach is a diagonal
  glide (roughly 45°) over the parent surface — never a low horizontal skim
  (which puts empty void in the upper half of the screen) and never a
  straight-down drop (which degenerates the camera roll). Every level must
  render rich, non-uniform content at the distance where the camera arrives —
  never a flat gray plate.
- Dive points land dead-center inside meaningful sub-structures. The line must
  enter the CENTER of one of the small colored squares (a specific core on the
  die, a specific block in the core, a specific pixel on the screen) — never a
  border, edge, gap, seam, or gray filler zone. The boundary transitions between
  levels (e.g. performance core → integer ALU block, "100 µm across") must be
  scrutinized: the camera must be looking at detailed structure the whole way
  through.
- Occlusion never pops: every shell the camera is about to pierce (the keyboard
  deck, the transistor's gate, the LED's cathode, the screen's cover glass…)
  fades away smoothly as a pure function of t shortly before the camera reaches
  it, and fades back identically when riding out.

Controls and HUD

- W rides deeper, S rides back.
- At the bifurcation: a big translucent ‹ on the left edge and › on the right
  edge of the screen, each labeled with its key (A / D), with the currently
  selected side highlighted/glowing. No sentence-style instruction text.
- Mouse moves the glance direction with a full 360° range — the rider can look
  all the way around, including behind.
- A title at the top-left always names where we are right now (e.g. "performance
  core") together with the current physical scale ("3.2 mm across").

Content — fidelity and density

Everything must be densely detailed — think "10× more detail than feels
sufficient" — and hiding must be un-aggressive: distant and peripheral objects
stay visible; more detail is always preferred over less. Everything plausible
must be animated and alive.

- The room and desk: a believable day-lit room (window, curtains, floor, walls,
  shelf, chair, door, rug, a wall clock whose hands actually run, lamps, cables)
  and a believable desk (the MacBook, a potted plant, paper, a mug, books,
  phone, pens…).
- The MacBook exterior: correct proportions, full keyboard with per-key legends,
  trackpad, ports, hinge, screen bezel with notch and camera.
- The MacBook interior: there are many components inside a MacBook — reproduce
  them in pixel-perfect locations matching ./macbook_interior.png: the two fans
  (with visibly SPINNING, clearly readable impeller blades — use few chunky
  blades, not a dense blur), the S-curved heat pipe and heat spreader, the black
  logic board carpeted in passives with EMI shields and chips, the antenna bar
  along the hinge, side port boards, the 4-corner + 2-tall-center battery cell
  layout with printed labels, aluminum struts, the trackpad flex cable running
  down the middle to its gold connector, the flanking speakers, tape, thermal
  pads, screws — all of it.
- The M4 die: block placement faithful to ./apple_m4_scheme.png (4 P-cores +
  shared L2, 6 E-cores + L2, 10 GPU cores, 16 Neural Engine cores, SLC,
  media/display engines, ISP, Secure Enclave, memory PHYs on the edges), with no
  bare/gray substrate anywhere — every area is a labeled block, and blocks show
  interior sub-structure at every intermediate zoom. The CPU interior (core
  floorplan: caches, decoders, schedulers, ALUs, FP units, register files…) must
  be greatly detailed, not a few flat rectangles.
- Digital circuits doing operations — explicitly a top-priority feature: the
  zoom must pass through logic that is visibly COMPUTING. Standard cells are
  real gates (AND/OR/NAND/NOR/XOR/NOT): their input nets carry live 0/1 signals
  (bright = 1, dark = 0), their output is the actual boolean function of the
  inputs, pulses race along wires when gates switch, and whole logic blocks
  twinkle with switching activity at every zoom level.
- Animated electronic simulation: the FinFET's gate runs a live drive waveform,
  and while it is open, charge carriers visibly flow from source to drain.
  Continue through real materials: gate oxide, dopants, the diamond-cubic
  silicon lattice at its true 0.543 nm pitch, into atoms with orbiting
  electrons, a nucleus with protons/neutrons and an animated gluon field, down
  to quarks.
- The screen must be REAL: a real image at real MacBook-panel fidelity — the
  bundled ./wallpaper.jpg photo as the desktop background, with a procedurally
  drawn OS on top (menu bar, dock with recognizable icons, overlapping
  application windows: a code editor with syntax-colored lines, a file browser,
  a terminal with a blinking cursor, and a video window that visibly plays,
  animating at full frame rate). Never a mosaic of colored squares. All levels
  of the screen (full panel → tiles → pixels → sub-pixel brightness) must sample
  the SAME image function so content never changes across zoom, and detail must
  increase strictly monotonically as the camera approaches — at no zoom distance
  may the screen become LESS detailed than it was a moment before.
- The sub-pixel LEDs: each LED is lit by the ACTUAL channel value of the
  on-screen image at that exact pixel — realistic and accurate, not default
  colors. Because the screen animates, the LEDs visibly CHANGE color over time.
  The dive targets a pixel inside the playing video, where R, G and B clearly
  differ from each other and keep changing. Inside, an LED is not a solid: model
  the full OLED stack — the TFT drive circuit with its data/scan lines and
  storage capacitor, the reflective anode, transport layers, the emission layer,
  the semi-transparent cathode, auxiliary wiring, spacers, encapsulation — with
  a live simulation: holes drift up, electrons drift down, they recombine in the
  emission layer with a flash, and photons fly up and out. Below that, the
  emissive layer resolves into a molecular film, then a single emitter molecule
  built of real atoms, joining the shared atomic tail.

Visual-quality laws

- Nothing ever pops, flickers, or z-fights — anywhere, at any scale, moving in
  either direction. In particular: never emit overlapping coplanar surfaces or
  nested coincident translucent volumes; and any material exempted from fog
  (emissive screens, glass, glow) must still be manually distance-faded and
  culled, or shells belonging to enclosing structures will haunt the camera at
  deep zooms as giant flickering planes.
- All LOD transitions are smooth morphs or strictly-finer refinements of
  identical content — never a swap to something coarser, blurrier, or
  differently colored.
- Spinning/periodic animations must be tuned to be perceptible (no temporal
  aliasing that freezes or scrambles them).
- Runs at 60 fps.

Code Quality

Ensure your implementation is concise, minimal, elegant. Use pure functions as
much as possible. Keep it very Haskell-like, even though it is TypeScript. Most
of the complexity of the function comes from the different objects that are
rendered, and each object is a render function. Each renderable object must live
in its own file at src/render/<name>.ts — that directory is the one that scales
as we add more renderables. Organize the project such that it can scale by just
adding more render functions/files under src/render/. Avoid unnecessary
complexity.

中文翻譯

INFINIZOOM

構建 infinizoom:一個程序化生成的無限縮放世界。交付物是一個自包含的 BunJS 項目。運行 `bun run server` 必須能構建並啓動服務(把 package.json 中對應的 "server" 腳本接好)。該目錄下存在三個本地資源,必須使用:./macbook_interior.png(一張真實的 MacBook Pro 拆解照片)、./apple_m4_scheme.png(Apple 的 M4 裸片平面圖)以及 ./wallpaper.jpg(一張 1920×1200 的桌面壁紙照片)。壁紙要從這個本地文件加載——絕不要從外部服務器獲取內容(唯一例外:three.js 本身可以通過 URL 從 CDN 導入)。

世界

沿着一條固定的相機軌道無限穿行於同一個 3D 世界,依次縮放穿過這些層級:

主路線:房間 → 書桌 → MacBook Pro → 機身內部 → 邏輯板 → Apple M4 封裝 → M4 裸片 → 一個性能核 → 一個整數 ALU 塊 → 一個標準邏輯單元 → 一個 FinFET 晶體管 → 鰭片內部的材料截面 → 硅晶體晶格 → 一個晶胞 → 一個原子 → 它的原子核 → 一個核子 → 一個誇克。邏輯門和電路(AND、OR 等)應在運算時播放動畫。

屏幕分支:恰好一個分叉,懸浮在 MacBook 上方。選擇另一側則會潛入顯示屏:屏幕 → 顯示面板 → 像素瓦片 → 一個像素塊 → 一個像素 → 它的 R/G/B 子像素 LED → 發光層 → 一個發光分子 → 並匯聚到同一個原子 → 原子核 → 核子 → 誇克尾段。LED 必須準確:從屏幕像素到 LED 是 1 對 1 映射,且它們的顏色必須與該像素的顏色一致。屏幕是動態的,LED 要實時更新以匹配動畫。

沿軌道向前行駛就是放大;向後行駛就是縮小。設計必須可增量擴展:新增一個結構 = 一個渲染函數 + 在其父級中的一次調用;新增一個分叉 = 多一條路線;未來的向後擴展(t < 0:飛出窗戶 → 城市 → 行星 → 宇宙)必須只需要在軌道層級前面追加。時間參數必須貫穿所有環節,以便在任何深度都保持一切動畫可用。

架構(硬性約束)

- 可變狀態恰好是:一個浮點數 t(沿軌道的位置)、一個分支位串(0 = 左/A,1 = 右/D;經過岔口時壓入一位,退回其下方時彈出該位),以及原始輸入(按住的按鍵、鼠標位置)。每一幀都是 (t、分支、原始輸入、牆上時鐘時間) 的純函數。沒有其他狀態——沒有場景圖、沒有節點對象、沒有存儲的世界數據、沒有世界結構的緩存。
- 渲染器是直接調用其子級的純函數:render_room() 調用 render_desk() 調用 render_macbook() ……一路到 render_quark()。沒有分發層,沒有類。調用棧就是場景遍歷。
- 通過局部單位座標系進行尺度空間扭曲:浮點數無法同時承載米和飛米,因此每個渲染器都在自己約單位大小的局部座標系中工作,相機則被重新表達到每個子級座標系中。幾何數學以雙精度、相對相機完成,只在最後才轉換爲浮點數,所以畫面在約 17 個數量級的尺度範圍內都沒有僞影。必須用完全相同的佈局常量來擺放渲染結構並編排軌道——單一事實來源,否則相機會明顯偏離線路。
- 基於 three.js 的即時模式渲染:每一幀,遞歸把圖元發射到實例化池中;three.js 只是一個光柵化器。任何屏幕外或亞像素的東西都不會被發射或遞歸進入。

軌道與相機

- 速度:快。整段主旅程大約用時 20 秒,每個層級的時間感覺舒適而恆定(指數縮放手感),並在分叉處和軌道兩端附近平緩地緩動。
- 形狀:平緩彎曲的弧線。不是遊移、繞行或隨機方向的——但也絕不是完全筆直的射線。柔和且有目的性的曲線。
- 綠線:軌道始終以一條半透明綠線的形式在場景中可見。它必須是一條無限細的線:在每一個距離上屏幕寬度都約爲 2 像素,以真正的 GL 線圖元實現(不是管、不是杆、不是任何形式的網格),透明(絕不實心),而且當它靠近或經過相機時絕不能變寬——它字面上就是一條路徑線,遠近都可見。
- 相機絕不能看向空無一物之處。旅程的每一個瞬間,視野都必須被結構填滿。具體來說:每次接近一個層級,都是在父級表面上方沿對角線滑翔(約 45°)——絕不是低空水平掠過(那會讓屏幕上半部分成爲空白虛空),也絕不是垂直下落(那會使相機滾轉退化)。每個層級都必須在相機抵達的距離上渲染出豐富、非均勻的內容——絕不是一個平坦的灰色平板。
- 下潛點要正落在有意義的子結構正中央。線路必須進入某個小的彩色方塊的中心(裸片上某個特定的核、核內某個特定的塊、屏幕上某個特定的像素)——絕不是邊界、邊緣、間隙、接縫或灰色填充區。層級之間的邊界過渡(例如性能核 → 整數 ALU 塊,"100 µm across")必須仔細檢查:相機在整個過程中都必須一直看着細節豐富的結構。
- 遮擋絕不突兀跳變:相機即將穿透的每一層外殼(鍵盤面、晶體管的柵極、LED 的陰極、屏幕的蓋板玻璃……)都會在相機抵達前不久,作爲 t 的純函數平滑淡出,並在向外返回時以相同方式淡回。

控制與 HUD

- W 向更深處行進,S 往回行進。
- 在分叉處:屏幕左邊緣有一個大的半透明 ‹,右邊緣有一個 ›,各自標註其按鍵(A / D),當前選中的一側高亮/發光。不要有句子式的說明文字。
- 鼠標以完整的 360° 範圍移動視線方向——乘坐者可以環顧一整圈,包括身後。
- 左上角始終有一個標題,標明我們此刻所在的位置(例如 "performance core"),以及當前的物理尺度("3.2 mm across")。

內容——保真度與密度

一切都必須細節密集——就按“比感覺足夠再多 10× 的細節”去想——並且隱藏必須不激進:遠處和周邊的物體保持可見;細節總是寧多勿少。一切說得通的東西都必須有動畫、有生命。

- 房間與書桌:一個可信的日間採光房間(窗戶、窗簾、地板、牆壁、架子、椅子、門、地毯、一個指針真的會走的掛鐘、檯燈、線纜)和一張可信的書桌(MacBook、一盆植物、紙張、一個馬克杯、書、手機、筆……)。
- MacBook 外觀:正確的比例、帶每個按鍵字符的完整鍵盤、觸控板、接口、轉軸、帶劉海和攝像頭的屏幕邊框。
- MacBook 內部:MacBook 內部有很多組件——按與 ./macbook_interior.png 一致的位置、像素級精確地復現它們:兩個風扇(葉輪葉片要能明顯看出正在旋轉、清晰可辨——用少量厚實的葉片,而不是一片密集的模糊)、S 形彎曲的熱管和均熱板、鋪滿無源元件並帶有 EMI 屏蔽罩和芯片的黑色邏輯板、沿轉軸的天線條、側邊接口板、帶印刷標籤的 4 個角部 + 2 個豎向中央的電池電芯佈局、鋁製支撐梁、從中間延伸至其金色連接器的觸控板排線、兩側的揚聲器、膠帶、導熱墊、螺絲——所有這些。
- M4 裸片:模塊佈局忠實於 ./apple_m4_scheme.png(4 個 P 核 + 共享 L2、6 個 E 核 + L2、10 個 GPU 核、16 個 Neural Engine 核、SLC、媒體/顯示引擎、ISP、Secure Enclave、邊緣的內存 PHY),任何地方都沒有裸露/灰色的基板——每個區域都是帶標籤的塊,且每箇中間縮放級別下這些塊都顯示出內部子結構。CPU 內部(核心平面圖:緩存、解碼器、調度器、ALU、FP 單元、寄存器堆……)必須高度詳細,而不是幾個扁平矩形。
- 正在執行運算的數字電路——明確列爲最高優先級特性:縮放必須穿過肉眼可見正在計算的邏輯。標準單元是真正的門(AND/OR/NAND/NOR/XOR/NOT):它們的輸入網絡承載實時的 0/1 信號(亮 = 1,暗 = 0),其輸出是輸入的真正布爾函數,門翻轉時脈衝沿導線飛馳,整個邏輯塊在每個縮放級別都隨開關活動閃爍。
- 動態電子仿真:FinFET 的柵極運行實時驅動波形,當其開啓時,電荷載流子明顯地從源極流向漏極。繼續穿過真實材料:柵氧化層、摻雜劑、真實 0.543 nm 間距的金剛石立方硅晶格,進入帶有軌道電子的原子、帶有質子/中子和動態膠子場的原子核,直到誇克。
- 屏幕必須是真實的:真實圖像,達到真實 MacBook 面板的保真度——以隨附的 ./wallpaper.jpg 照片作爲桌面背景,上面疊加程序化繪製的操作系統(菜單欄、帶可識別圖標的程序塢、相互重疊的應用窗口:一個帶語法着色代碼行的代碼編輯器、一個文件瀏覽器、一個光標閃爍的終端,以及一個能明顯播放、以完整幀率動畫的視頻窗口)。絕不要彩色方塊拼成的馬賽克。屏幕的所有層級(整個面板 → 瓦片 → 像素 → 子像素亮度)都必須採樣同一個圖像函數,使內容在縮放過程中永不改變,而且細節必須隨相機接近嚴格單調增加——在任何縮放距離上,屏幕都不能比前一瞬間更不精細。
- 子像素 LED:每個 LED 由該精確像素處屏幕圖像的實際通道值點亮——真實而準確,而不是默認顏色。由於屏幕是動態的,LED 的顏色會隨時間明顯變化。下潛目標是正在播放的視頻內的一個像素,那裏 R、G、B 三者明顯互不相同且持續變化。進入內部後,LED 不是實心體:建模完整的 OLED 堆棧——帶數據/掃描線和存儲電容的 TFT 驅動電路、反射陽極、傳輸層、發光層、半透明陰極、輔助佈線、間隔物、封裝——並配有實時仿真:空穴向上漂移,電子向下漂移,它們在發光層中複合併伴隨閃光,光子向上飛出。再往下,發光層解析爲分子薄膜,然後是由真實原子構成的單個發光分子,匯入共享的原子尾段。

視覺質量法則

- 任何東西都絕不突兀跳出、閃爍或發生 z-fighting——任何位置、任何尺度、任何移動方向。特別是:絕不發射相互重疊的共面表面或嵌套重合的半透明體;任何免於霧效的材質(自發光屏幕、玻璃、輝光)仍必須手動做距離淡出和剔除,否則屬於外層結構的外殼會在深度縮放時以巨大閃爍平面的形式縈繞在相機前。
- 所有 LOD 過渡都是平滑變形,或對相同內容的嚴格更精細細化——絕不是換成更粗糙、更模糊或顏色不同的東西。
- 旋轉/週期性動畫必須調到可感知的程度(不要出現讓它們凍結或錯亂的時間混疊)。
- 以 60 fps 運行。

代碼質量

確保你的實現簡潔、最小、優雅。儘可能使用純函數。即使它是 TypeScript,也要保持非常像 Haskell 的風格。函數的大部分複雜性來自被渲染的不同對象,而每個對象都是一個渲染函數。每個可渲染對象都必須位於 src/render/<name>.ts 自己的文件中——隨着我們添加更多可渲染對象,擴展的正是這個目錄。組織項目,使其只需在 src/render/ 下添加更多渲染函數/文件就能擴展。避免不必要的複雜性。

溯源

原作者
VictorTaelin
發佈日期
2026-09-25(由推文 ID 反解)
原始出處
查看原帖 ↗
收錄來源
yihui-dev/awesome-opus5-5-videos · victortaelin-875778 · MIT
zhuyansen/awesome-opus-5.5-video · 2103299766473875778 · 未聲明授權
本條由 2 個來源合併去重而來