跳到正文
网页珍奇柜Web Curio

无尽世界

Infinite World,Bruno Simon,2022 年

正在布展…

本柜的现场复刻:按原作的技术思路从零编写,不含原作的代码和素材。为什么不直接展出原作:原作需要从源码编译才能运行,仓库里也没有许可证文件(只在 package.json 写了 ISC),所以本柜用 three.js 从零复刻了这片无尽的草原。原作请点上方「去看原作」。

它是怎么做的

  1. 第 1 步以玩家为中心的四叉树/分块 LOD,地形在 Web Worker 中用噪声生成
  2. 第 2 步地形块离开视距即回收复用
  3. 第 3 步天空与太阳方向驱动地形着色,实现昼夜循环
  4. 第 4 步草地用大量实例化叶片 + 顶点着色器风动

复刻配方

一段技术配方,可以直接交给 AI 编程助手,也可以自己照着写。想指定技术栈、位置和性能预算,就把它加入实现方案。

Split the world into square chunks keyed by integer coordinates and keep only chunks within a radius of the player, subdividing near chunks for more detail. Generate each chunk's heights from layered simplex noise inside a Web Worker and transfer the Float32Array back to build the geometry. Color terrain in the shader by height and slope, tinted by a sun direction uniform that rotates over time for a day/night cycle. Add instanced grass blades whose vertices sway with a time-based noise offset.

档案

能不能拿来用

原作以 ISC 许可开源:可以阅读源码学习,按许可证条款使用;在自己的项目里引用时保留原作者署名。

性能开销

视觉强度

实现难度

尺度为策展判断(1 到 5),用于比较和推荐。

核实记录:Demo loads (200); repo exists; no LICENSE file, package.json declares ISC.