How sp5555/websplat works
Project type and purpose
• This is a pure-front-end, browser-based 3D scene renderer built on WebGPU and WGSL.
• It loads geometry (PLY files), preprocesses data, sorts elements on the GPU, tiles/meshes them, and finally renders a scene in real time.
File structure
• Top-level:
• index.html – entry point, pulls in main.js, CSS, shaders.
• css/ – visual styling.
• shaders/ – WGSL shader modules organized by pipeline stage: render, sort, tile, transform.
• src/ – JS source code, further broken down into logical managers and utilities.
• package.json – metadata (dev dependencies, scripts).
• src/ substructure reveals architectural roles:
• app/app.js – the orchestrator that initializes App, ties subsystems together.
• gui/gui-manager.js & hud/hud-manager.js – UI layers.
• input/input.js – user interaction handling.
• loaders/ply-loader.js – model loading.
• preprocessing/gaussian-precompute.js – CPU-side image/data prep.
• renderer/ – core rendering pipeline:
– camera.js (view/projection)
– mesh-buffer-builder.js (vertex/index buffer construction)
– renderer.js (GPU device setup, command encoding, render pass orchestration)
– wgsl-shader.js (shader compilation and module management)
• utils/ – shared helpers (events, GUI utilities).
Insights from README
• No backend; served via a static HTTP server.
• Emphasis on sort (bitonic), NDC manipulation, WebGPU usage.
• Identifies optimization work still pending.
Detail
• Break the renderer pipeline into its four shader stages (transform, sort, tile, render).
• Event-emitter links between modules.
• HTML/CSS layer and how GUI/HUD integrate on top of the WebGPU canvas.