A physically-based rendering engine written entirely in MoonBit.
8 geometry types, 7 PBR materials, BVH acceleration, procedural textures,
volume rendering, post-processing, and an interactive web GUI.
# Default scene: Three Spheres (400×225, 100 spp)
# 默认场景:三球 (400×225, 100 spp)
moon run cmd/main > output.ppm
# Run full test suite / 运行完整测试套件
powershell -File test.ps1
Web GUI / 图形界面
python gui/server.py
# Open http://localhost:8088
# Or use the PowerShell launcher / 或使用 PowerShell 启动
powershell -File gui.ps1
The GUI features: scene selector, parameter sliders, quick presets, live PPM preview.
moon-ray
Pure MoonBit Monte Carlo Path Tracer
2026 MoonBit Open Source Ecosystem Competition
─────────────────────
A physically-based rendering engine written entirely in MoonBit. 8 geometry types, 7 PBR materials, BVH acceleration, procedural textures, volume rendering, post-processing, and an interactive web GUI.
─────────────────────
中文介绍
moon-ray 是一个纯 MoonBit 实现的蒙特卡洛路径追踪渲染器, 是 2026 MoonBit 国产基础软件开源大赛 参赛项目。
基于物理渲染(PBR)理论,从零实现了完整的 Monte Carlo 光线追踪管线。 支持 8 种几何体类型、7 种物理材质、BVH 加速结构、程序化纹理生成、 体积渲染(雾/烟)、后处理特效链以及交互式 Web 图形界面。
内置 13 个演示场景,覆盖经典三球、Cornell Box、材质对比、景深虚化、 大气雾效等效果。项目搭载完整 CI/CD 流水线,32 个单元测试全部通过, 已发布至 mooncakes.io 生态。
Features / 功能特性
Rendering / 渲染管线
中文
Geometry / 几何体 (8 Types)
geometry_sphere.mbtgeometry_plane.mbtgeometry_triangle.mbtgeometry_box.mbtgeometry_cylinder.mbtgeometry_disk.mbtgeometry_cone.mbtgeometry_torus.mbtgeometry_mesh.mbtMaterials / 材质 (7 Types)
Acceleration / 加速结构
Textures / 纹理
Camera / 相机
Post-Processing / 后处理
Output / 输出格式
Environment / 环境光
Volume / 体积渲染
Quick Start / 快速开始
Prerequisites
Install the MoonBit toolchain: https://www.moonbitlang.cn/download/
Build & Test / 构建与测试
Render / 渲染
Web GUI / 图形界面
The GUI features: scene selector, parameter sliders, quick presets, live PPM preview.
中文
图形界面功能:场景选择器、参数滑动条、快速预设级别(低/中/高/超高)、实时 PPM 预览。
Demo Scenes / 演示场景 (18 Total)
three_spherescornell_boxmaterial_showcaserandom_spheresgeometriccornell_box_planestexture_demotriangle_demofinal_demofull_geometrystudio_lightingdepth_of_fieldfoggy_scenemirror_corridorcrystal_gardensunrise_valleyprism_labcity_at_nightProject Structure / 项目结构
CI/CD / 持续集成
On every push, GitHub Actions automatically runs / 每次推送自动执行:
moon checkmoon testmoon buildTesting / 测试
Coverage includes: Vec3 operations, ray-point computation, AABB hit/miss, RNG determinism, all 8 geometry types, material emission/scattering, texture evaluation, tone mapping, camera rays, BMP output, scene construction, animation interpolation, and volume fog.
中文
测试覆盖:Vec3 运算、光线求交、AABB 碰撞、随机数确定性、全部 8 种几何体、 材质发射/散射、纹理采样、色调映射、相机光线、BMP 输出、场景构建、 动画插值和体积雾效。
Packages / 包管理
Published on mooncakes.io — importable as / 可在 mooncakes.io 获取:
References / 参考资料
中文
本项目参考了 Peter Shirley 的《Ray Tracing in One Weekend》系列教程 以及《Physically Based Rendering》经典教材,在此基础上进行了 MoonBit 语言 的原生重写和功能扩展。
License / 许可证
Apache License 2.0 — See LICENSE for details.
Built with MoonBit for the 2026 Open Source Ecosystem Competition
★ Star on GitHub · Gitlink · mooncakes.io