Skip to content

feat: Downsampling during camera movement #622

Open
aranega wants to merge 9 commits into
mainfrom
seankmartin-aranega/downsampling
Open

feat: Downsampling during camera movement #622
aranega wants to merge 9 commits into
mainfrom
seankmartin-aranega/downsampling

Conversation

@aranega
Copy link
Copy Markdown
Collaborator

@aranega aranega commented Mar 27, 2026

Summary

This PR adds XY downsampling for transparent layers (e.g. volumes) during camera movement (when the camera is actively rotating/panning). Transparent layers render into a smaller framebuffer (e.g. 4x fewer pixels), which is then composited back to the main canvas. When the camera stops, rendering returns to full resolution.

downsampling-2026-03-26_20.07.22.mp4

Implementation

DownsampledFramebuffer manages a frame buffer with a single RGBA color attachment (lazy resize with texture recreation), while DownsamplingCompositePass renders a fullscreen triangle that samples the downsampled texture. In the renderer beginDownsampling and endDownsampling wrap the renderTransparentLayers call. The framebuffer is owned by the renderer, created lazily on first use, and resized as needed. downsamplingFactor is a per-viewport config option (defaults to 1 = no downsampling). The cameraControls.isMoving signal controls when downsampling activates.

Tests & Checks

Manually tested with the volume_rendering and multi_viewport examples (both configured with downsamplingFactor: 4)

@aranega aranega requested a review from seankmartin March 27, 2026 02:18
Copy link
Copy Markdown
Collaborator

@seankmartin seankmartin left a comment

Choose a reason for hiding this comment

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

Overall looks good thanks! Wanted to note one difference in behaviour for the Idetik team to weigh in on. The others are very small comments

Comment thread packages/core/src/renderers/webgl_renderer.ts
Comment thread packages/core/src/renderers/webgl_renderer.ts
Comment thread packages/core/src/renderers/webgl_renderer.ts Outdated
Comment thread packages/core/src/renderers/webgl_renderer.ts Outdated
@aranega aranega requested a review from shlomnissan March 30, 2026 09:33
@aranega aranega marked this pull request as ready for review March 30, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants