Skip to content

Conversation

@TobiasNoell
Copy link
Contributor

@TobiasNoell TobiasNoell commented Jan 29, 2026

Fixed #32882

Description

When using PostProcessing with the WebGL backend (forceWebGL: true), viewport and scissor settings were incorrectly applied during nested render calls, causing rendered content to appear smaller than expected.

Root cause: In WebGL, scissor state is global. When PassNode renders the scene to a render target (triggering a nested renderer.render() call), the beginRender method didn't reset the scissor when renderContext.scissor was false. This left the outer scissor active, causing the render target to only receive content within the outer scissor area.

Fix in WebGLBackend.js:

In beginRender: Added else clause to reset scissor to the full render area when renderContext.scissor is false
In finishRender: Added scissor state restoration (matching the existing viewport restoration pattern)
This ensures proper scissor state isolation between nested render calls, matching WebGPU's per-render-pass state model.

@github-actions
Copy link

github-actions bot commented Jan 29, 2026

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 359.21
85.29
359.21
85.29
+0 B
+0 B
WebGPU 622.99
173.1
623.23
173.14
+242 B
+34 B
WebGPU Nodes 621.57
172.85
621.81
172.89
+242 B
+34 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 490.47
119.49
490.47
119.49
+0 B
+0 B
WebGPU 689.65
186.27
689.89
186.3
+242 B
+34 B
WebGPU Nodes 639.03
173.69
639.27
173.72
+242 B
+35 B

Copy link
Collaborator

@Mugen87 Mugen87 left a comment

Choose a reason for hiding this comment

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

I think scissor should be managed like viewport so this change looks good to me.

@Mugen87 Mugen87 added this to the r183 milestone Jan 29, 2026
@Mugen87 Mugen87 requested a review from sunag January 29, 2026 16:47
@sunag sunag merged commit 9d40465 into mrdoob:dev Jan 29, 2026
10 checks passed
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.

WebGL viewport / scissors not working correctly with PostProcessing in WebGPURenderer

3 participants