Add .webp image output via GPU splat rasterizer#235
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new GPU-rendered image output path so splat scenes can be rasterized from a configurable camera and written as lossless WebP. This extends the library’s output formats and introduces a reusable headless renderer (camera basis → BVH frustum culling → tiled GPU compute rasterization) that’s also wired into the CLI.
Changes:
- Add
.webpoutput support viawriteImageand route.webpthrough the high-levelwriteFiledispatcher. - Introduce a new
src/lib/render/pipeline (camera basis, frustum plane generation + BVH query, tiled streaming orchestrator). - Add a new
GpuSplatRasterizerWebGPU compute implementation and extendGaussianBVHwith a frustum-plane query API.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/writers/write-image.ts | New writer that renders splats and encodes the result as lossless WebP. |
| src/lib/writers/index.ts | Re-export writeImage and WriteImageOptions. |
| src/lib/write.ts | Add .webp detection and new 'image' output format dispatch. |
| src/lib/types.ts | Add render-related options to the shared Options type. |
| src/lib/spatial/gaussian-bvh.ts | Add queryFrustumRawInto for 6-plane frustum culling into a typed buffer. |
| src/lib/render/tile-stream.ts | New tiled render orchestrator with BVH culling, depth sorting, chunk packing, and 3-slot pipelining. |
| src/lib/render/preprocess.ts | New helpers for SH-band detection, candidate depth sorting, and GPU input packing. |
| src/lib/render/index.ts | Export renderer entry points/types. |
| src/lib/render/camera.ts | New camera + derived basis utility. |
| src/lib/render/bvh-query.ts | New frustum plane generation and BVH query wrapper with buffer growth. |
| src/lib/index.ts | Export the new writer and renderer APIs from the library entry point. |
| src/lib/gpu/index.ts | Export GpuSplatRasterizer and TILE_SIZE. |
| src/lib/gpu/gpu-splat-rasterizer.ts | New WebGPU compute rasterizer (project → accumulate → finalize) with SH evaluation up to band 3. |
| src/cli/index.ts | Add CLI flags for camera/render configuration and update help text to include .webp. |
| README.md | Document .webp output support, new CLI flags, and usage examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.webpoutput format that renders the splat scene from a configurable camera using a WebGPU compute rasterizer (project → accumulate → finalize).src/lib/render/(camera basis, frustum-plane BVH query, tile-streaming orchestrator with 3-slot CPU/GPU pipelining) andsrc/lib/gpu/gpu-splat-rasterizer.ts(per-tile compute pipeline, SH evaluation up to band 3).writeImageplus CLI flags:--camera,--look-at,--up,--fov,--resolution,--near,--background. Output is encoded as lossless WebP.GaussianBVHwithqueryFrustumRawIntofor 6-plane frustum culling per tile group.Test plan
npm run buildandnpm run lintpass--resolution 512x512 --camera 2,1,-2 --look-at 0,0,0) and visually inspect the output.webp--background 0,0,0,0) composites as expected