跳到正文
网页珍奇柜Web Curio

程序化星空生成器

Space 3D,Rye Terrell (wwwtyro),2015 年

正在布展…

原作直展:这是 Rye Terrell (wwwtyro) 的原始作品,按 Unlicense 公有领域(附带 dat.GUI 为 Apache-2.0,打包内 gl-matrix 等为 MIT) 许可证收录(版本 67578c3)。原样展出作者在 master 分支提交的构建,只删去了 Google Analytics 统计代码。拖动旋转天空盒,左侧面板可换种子、开关星云与亮星;“Download skybox”在沙箱里无法下载。 许可证全文 · 收录说明

它是怎么做的

  1. 第 1 步种子决定随机数序列,保证同一种子结果一致
  2. 第 2 步先在立方体的六个面上用点精灵渲染大量暗星
  3. 第 3 步星云用多层三维噪声在着色器中按方向采样并上色叠加
  4. 第 4 步少量亮星用带光晕的着色器绘制
  5. 第 5 步结果烘焙到立方体贴图,用作可旋转的天空盒或导出 PNG

复刻配方

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

Use a seeded PRNG so a text seed always yields the same sky. For each of the six cube faces, render into a framebuffer: first thousands of tiny point stars at random directions, then several additive nebula layers computed in a fragment shader from 3D fractal noise sampled by the view direction with a random colour and offset, then a handful of bright stars with soft radial falloff. Store the six textures as a cubemap and display it on a skybox the user can orbit, with an export button that saves each face.

档案

能不能拿来用

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

性能开销

视觉强度

实现难度

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

核实记录:Opened https://wwwtyro.github.io/space-3d (200); repo wwwtyro/space-3d exists, licence Unlicense via GitHub API.