feat: Improve selective bloom to use mipmap blur - #832
Otokami-Orokabu wants to merge 5 commits into
Conversation
UnrealBloom's bilinear mip sum shows square halos when spread wide; a mipmap down/upsample chain blurs smoothly. Adds smoothing and levels, and re-adds the unblurred source in the composite so emitters read as self-lit. BREAKING CHANGE: radius is now the upsample blend ratio (0-1, default 0.85, was 0.2). The blur no longer amplifies energy (~3x), so raise strength 2-3x to keep the previous brightness. UnrealBloomPassRGBA is removed.
The useNormal default flip (maplibre#474) left the OSM tiles unlit, so the demo's exposure of 3 overexposed the map. The 1,500 km polyline was clamped to sub-pixel by the default maxWidth.
transparent with opacity 1 sent opaque meshes down the blended path, and castShadow without shadow: true, hideUnderground: false and the unused width param had no effect. Layer order aligned to terrain, hillshade, raster.
There was a problem hiding this comment.
🟡 Changes recommended
Critical and moderate review findings remain unresolved, including mip-chain resizing and delta-time handling.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR replaces the custom Unreal bloom blur with MipmapBlurPass, adding configurable smoothing and mip levels while updating examples and documentation.
Changes:
- Reworked bloom extraction, mipmap blurring, and compositing.
- Added
smoothingandlevelsconfiguration and debug controls. - Updated examples and documentation; removed
UnrealBloomPassRGBA.
File summaries
| File | Review summary |
|---|---|
web/navara_three/example/pages/selective-bloom-effect/mvt-point/main.ts |
Adjusted bloom strength and layers. |
web/navara_three/example/pages/selective-bloom-effect/mesh/main.ts |
Removed transparent material flags. |
web/navara_three/example/pages/selective-bloom-effect/instanced-mesh/main.ts |
Enabled normals and adjusted shadow flags. Two moderate findings remain (2 votes each) concerning functional building and terrain shadow options. |
web/navara_three/example/pages/selective-bloom-effect/geojson-polyline/main.ts |
Adjusted layers and polyline width. |
web/navara_three/example/pages/selective-bloom-effect/geojson-point/main.ts |
Adjusted bloom strength. |
web/navara_three/example/pages/selective-bloom-effect/geojson-large-draped-polygon/main.ts |
Adjusted layers and globe settings. One moderate finding remains (2 votes) concerning hideUnderground behavior. |
web/navara_three/example/pages/selective-bloom-effect/feature/main.ts |
Adjusted bloom strength. |
web/navara_three/example/pages/debug/selective-effect/run.ts |
Added smoothing and mip-level controls. |
web/navara_three_default_descs/src/effects/UnrealBloomPassRGBA.ts |
Removed obsolete bloom pass. |
web/navara_three_default_descs/src/effects/SelectiveBloomEffectDesc.ts |
Implements the new pipeline. Findings remain for smoothing edge handling (moderate, 3 votes), mip-chain rebuilding (critical, 2 votes), level validation (moderate, 1 vote), and delta-time handling (critical, 1 vote). |
docs/src/content/docs/three_default_descs/Effect Desc/selective-bloom-effect-desc.md |
Updated English documentation. One nit remains (2 votes) regarding emissive intensity behavior and its tuning formula. |
docs/src/content/docs/ja/three_default_descs/Effect Desc/selective-bloom-effect-desc.md |
Updated Japanese documentation. One nit remains (2 votes) regarding emissive intensity behavior and its tuning formula. |
Review details
Suppressed comments (1)
web/navara_three_default_descs/src/effects/SelectiveBloomEffectDesc.ts:32
- The public
levelsoption is passed straight toMipmapBlurPass.levels, but unlike the debug control it accepts zero, negative, or fractional values. Those values do not describe a valid mip chain and can result in missing targets or invalid loop bounds; validate or normalize it to a positive integer before assigning it.
levels?: number;
- Files reviewed: 12/24 changed files
- Comments generated: 8
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
smoothstep is undefined for equal edges, so smoothing 0 now falls back to step(). levels is rounded and clamped to at least 1 before it reaches MipmapBlurPass, which has no targets to sample at 0.
… feat/selective-bloom-mipmap-blur
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Copilot reviewed 12 out of 24 changed files in this pull request and generated 4 comments.
Overview
The bloom blur was a fork of three.js
UnrealBloomPass, which upsamples its mips bilinearly. Spread wide, the lowest mip shows through as square halos, and the hard threshold makes emitters near it flicker. This swaps the blur for postprocessing'sMipmapBlurPass(already a dependency).Closes #
What I've done
SelectiveBloomEffectDescblurs withMipmapBlurPass; threshold moved to the extract pass,strengthto the composite.UnrealBloomPassRGBAremoved.smoothingandlevels.radiusis now the upsample blend ratio (0-1, default 0.85, was 0.2).base + strength × (source + blur)) so emitters still read as self-lit.smoothing/levelsadded to/debug-selective-effect.fix(example):instanced-meshsetsuseNormal: true(tiles went unlit after feat: Support hillshade(DEM-based Normal) #474) and the polyline demo gets amaxWidth.refactor(example): inert flags removed.BREAKING CHANGE:
radiuschanged meaning and default,UnrealBloomPassRGBAis gone, and the blur no longer amplifies energy (~3x), so raisestrength2-3x for the previous brightness.What I haven't done
resolutionScale, so thin shapes can get jagged edges.How I tested
cargo make build-example/format/lint/testpass./selective-bloom-effect-*and/effect/selective-bloomcompared against the previous implementation.Screenshots
Checklist