Repository navigation
Fix halfRes crash on three r187: don't override texture on the MRT compat target - #56
Open
martincollignon wants to merge 1 commit into
Open
martincollignon wants to merge 1 commit into
martincollignon wants to merge 1 commit into
Conversation
…compat target three r187 made `Texture.mipmaps` always an array and dropped the `mipmaps &&` guards in WebGLTextures (mrdoob/three.js#35081), so setupRenderTarget now reads `renderTarget.texture.mipmaps.length` directly. On three >= 162 the compat class returned the `textures` array from `get texture()`, which has no `mipmaps`, so every render with `halfRes: true` threw. The override is not needed there: N8AO only reads `.textures[i]`, and `WebGLRenderTarget` with `{ count }` already exposes `texture` as `textures[0]`. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Ameobea
added a commit
to Ameobea/n8ao
that referenced
this pull request
Nov 6, 2026
Drops the `texture` getter override on the three >= 162 MRT compat target (upstream 9f0fcbd by Martin Collignon); dist/ and example bundles rebuilt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Problem
three r187 made
Texture.mipmapsalways an array and removed themipmaps &&/mipmaps !== undefinedguards inWebGLTextures(mrdoob/three.js#35081).setupRenderTargetnow readsrenderTarget.texture.mipmaps.lengthdirectly.On three >= 162,
WebGLMultipleRenderTargetsCompatoverridesget texture()to returnthis.textures, which is an array. An array has nomipmaps, so withhalfRes: trueevery render throws as soon as thedepthDownsampleTargetis bound:Both
N8AOPassandN8AOPostPassare affected.halfRes: falseis not, because the compat target is only created for half resolution.Fix
Remove the
texturegetter from the >= 162 branch ofsrc/compat.js. It isn't needed there: N8AO only reads the downsample target through.textures[i], andWebGLRenderTargetcreated with{ count }already exposestextureastextures[0]. The < 162 branch is unchanged.dist/and the example bundles are rebuilt withnpm run build; the only change in each is the same three removed lines.Reproduction
A plain page: three's
EffectComposerwithN8AOPass, or postprocessing'sEffectComposer→RenderPass→N8AOPostPass, withconfiguration.halfRes = true, rendering 5 frames.halfRes: falseWith this PR, the
N8AOPostPasshalf-res output on r187 is pixel-identical to n8ao 2.0.1 on r186 (max channel difference 0).🤖 Generated with Claude Code