构建格雷斯大教堂的体验
Building the Grace Cathedral Experience

原始链接: https://blog.playcanvas.com/building-the-grace-cathedral-experience/

本文详细介绍了如何创建一个基于浏览器的交互式 3D 体验。该项目以旧金山恩典座堂(Grace Cathedral)为主题,并利用高质量的高斯溅射(Gaussian splats)技术进行渲染。该应用由 PlayCanvas 团队与 Vincent Woo 合作开发,利用 PlayCanvas 引擎的 WebGPU 混合渲染器实现了实时性能。通过将排序和剔除任务从 CPU 转移到 GPU 计算着色器,开发人员显著减少了性能瓶颈并提高了渲染速度。 为确保广泛的兼容性,该项目采用了“流式 SOG”技术,这是一种开放的压缩格式,能够根据设备的内存预算逐步加载高保真资产。按需渲染、分辨率缩放和深度预通道遮挡等优化技术,确保了该体验在桌面端和移动设备上都能保持良好的性能。 此外,通过自定义着色器代码块,项目还实现了“透视”墙壁效果、隐藏元素动画以及动态交通等功能。精密的摄像机导航和沉浸式音效进一步增强了交互环境。该项目展示了 PlayCanvas 引擎和 SuperSplat 等开源工具的强大功能,为开发人员构建高性能的网页端 3D 体验提供了范例。

抱歉。
相关文章

原文

Grace Cathedral is a San Francisco landmark on Nob Hill.

After seeing Vincent Woo's high-quality capture of the cathedral and its surrounding streets as 3D Gaussian splats, we jumped at the chance to collaborate with him. Together, we turned his splats into a browser-based, interactive experience. You can see the finished app below:

This article explores how I built this app. Let's dive in.

Under the Hood

The PlayCanvas Engine was the perfect runtime on which to build, thanks to its WebGPU hybrid renderer and streamed SOG format.

WebGPU Hybrid Renderer

The exterior view renders around 3.5 million Gaussian splats at a time. Because they must be sorted back to front, moving the camera means repeatedly sorting millions of splats in real time.

Our first-generation Gaussian splat renderer used WebGL 2, which only provides vertex and fragment shaders. They are well suited to drawing the splats but not to sorting them, so a worker sorted the Gaussians on the CPU and uploaded the results to the GPU. Sorting and uploading could fall behind rendering, making artifacts visible as the camera moved.

WebGPU lets us divide that work more effectively. Compute shaders cull, project and sort the active splat set on the GPU every frame, then vertex and fragment shaders render the result. Keeping the data on the GPU avoids the transfer bottleneck and makes the pipeline dramatically faster than the worker-based WebGL 2 renderer.

The experience uses this WebGPU pipeline whenever the browser supports it and falls back to the WebGL 2 renderer automatically. To support both rendering paths, the cutout, flag animation and transition shaders each have WGSL and GLSL implementations so the experience looks the same on both backends.

Streamed SOG

The splat data is delivered as streamed SOG — our open compressed splat format, extended with chunked levels of detail that the engine fetches on demand.

The experience contains separate splat sets for the exterior and interior. The exterior combines a streamed LOD set covering everything within 400 meters with a static, low-detail set for the landscape beyond it. Each mode loads only its own set and evicts the other, so device memory holds one view at a time.

Startup is tuned for time-to-first-pixel. On load, each streamed splat set starts at a single coarse LOD, so only a small fraction of the data needs to arrive before the loading screen lifts. From there, the engine streams in detail progressively within a per-device budget: 3.5 million rendered splats on desktop and 1.4 million on mobile. Mode switches are covered by a short freeze-fade: the last frame is held and faded down while the next splat set loads its coarse LOD, then the new view fades in and refines.

Optimized to Run Everywhere

Beyond streaming and per-device splat budgets, a few things keep the experience smooth on modest hardware — and cool and quiet on phones:

  • On-demand rendering. The app only renders when something changes: camera movement, LOD chunks arriving, a cutout animating, cars driving by. When you stop moving, it stops drawing.
  • Resolution caps. Device pixel ratio is capped on high-DPI displays, with a further render-scale reduction on mobile, where the extra pixels cost more than they show.
  • Depth pre-pass occlusion. The interior collision mesh doubles as an occluder: rendered depth-only before the splats, it lets early-Z reject splat fragments hidden behind walls.

Bringing the Scene to Life

The Peek Effect

While orbiting outside, the Peek toggle carves away the section of wall nearest the camera so you can look inside. A thin, glowing rim outlines the cut edge.

联系我们 contact @ memedata.com