Skip to content

Add .webp image output via GPU splat rasterizer#235

Merged
slimbuck merged 10 commits into
playcanvas:mainfrom
slimbuck:shot-dev
May 17, 2026
Merged

Add .webp image output via GPU splat rasterizer#235
slimbuck merged 10 commits into
playcanvas:mainfrom
slimbuck:shot-dev

Conversation

@slimbuck

Copy link
Copy Markdown
Member

Summary

  • Adds a new .webp output format that renders the splat scene from a configurable camera using a WebGPU compute rasterizer (project → accumulate → finalize).
  • Introduces src/lib/render/ (camera basis, frustum-plane BVH query, tile-streaming orchestrator with 3-slot CPU/GPU pipelining) and src/lib/gpu/gpu-splat-rasterizer.ts (per-tile compute pipeline, SH evaluation up to band 3).
  • Wires up writeImage plus CLI flags: --camera, --look-at, --up, --fov, --resolution, --near, --background. Output is encoded as lossless WebP.
  • Extends GaussianBVH with queryFrustumRawInto for 6-plane frustum culling per tile group.

Test plan

  • npm run build and npm run lint pass
  • Render a small scene (e.g. --resolution 512x512 --camera 2,1,-2 --look-at 0,0,0) and visually inspect the output .webp
  • Spot-check higher-band SH scenes (bands 1/2/3) for correct view-dependent color
  • Confirm non-multiple-of-128 resolutions render correctly (group edge handling)
  • Confirm transparent background (--background 0,0,0,0) composites as expected

@slimbuck slimbuck requested a review from Copilot May 15, 2026 14:04
@slimbuck slimbuck self-assigned this May 15, 2026
@slimbuck slimbuck added the enhancement New feature or request label May 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .webp output support via writeImage and route .webp through the high-level writeFile dispatcher.
  • Introduce a new src/lib/render/ pipeline (camera basis, frustum plane generation + BVH query, tiled streaming orchestrator).
  • Add a new GpuSplatRasterizer WebGPU compute implementation and extend GaussianBVH with 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.

Comment thread src/lib/render/preprocess.ts Outdated
Comment thread src/lib/writers/write-image.ts
Comment thread src/lib/writers/write-image.ts Outdated
Comment thread src/lib/gpu/gpu-splat-rasterizer.ts Outdated
Comment thread src/lib/render/tile-stream.ts
Comment thread src/lib/spatial/gaussian-bvh.ts
Comment thread src/lib/spatial/gaussian-bvh.ts Outdated
Comment thread src/lib/gpu/gpu-splat-rasterizer.ts
Comment thread src/lib/render/camera.ts
Comment thread src/lib/render/camera.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Comment thread src/lib/render/camera.ts
Comment thread src/lib/render/preprocess.ts Outdated
Comment thread src/lib/render/tile-stream.ts Outdated
Comment thread src/cli/index.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Comment thread src/lib/render/camera.ts
Comment thread src/lib/writers/write-image.ts
Comment thread src/lib/render/preprocess.ts Outdated
@slimbuck slimbuck marked this pull request as ready for review May 15, 2026 16:10
@slimbuck slimbuck requested a review from a team May 15, 2026 16:10
Sergey777999150

This comment was marked as spam.

@slimbuck slimbuck merged commit 68ec61e into playcanvas:main May 17, 2026
3 checks passed
@slimbuck slimbuck deleted the shot-dev branch May 17, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants