Repository navigation
feat(render3d): add composable 3D post-processing (Bloom, SSAO, Depth of Field) - #727
Merged
Merged
Conversation
…nd validate input sizes
…rix and add PostStack3D.SetCamera
…ats, toggles and orthographic DoF
houko
force-pushed
the
feat/render3d-post-processing-282
branch
from
November 24, 2026 18:21
1b4c64e to
27c75bf
Compare
Contributor
Author
|
Rebased onto main and addressed the review:
Not added: a test for Apply after a non-retained device loss (the existing retained recovery test still covers the loss path). |
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.
Summary
Implements composable offscreen 3D post-processing in
packages/game/render3d/post3d.goover NSGogpu.RenderTargetattachments (FormatRGBA16Float/FormatRGBA8Unormcolor +FormatDepth32Floatdepth):BloomPass,BloomConfig): HDR/LDR bright extraction with quadraticThreshold+SoftKnee, configurable separable 9-tap Gaussian blur (BlurPasses,Radius,HalfRes) across offscreen ping-pong render targets, and additive composition withIntensity.SSAOPass,SSAOConfig): view-space position and edge-preserving 4-neighbor depth-difference normal reconstruction, deterministic 4–16-sample hemisphere kernel with stratified 4×4 tangent rotation, optional depth-aware bilateral blur (BlurRadius,DepthThreshold), inspectableAOTexture(), and multiplicative scene compositing.DepthOfFieldPass,DepthOfFieldConfig): perspective and orthographic[0, 1]depth linearization, signed Circle of Confusion prepass aroundFocusDistance±FocusRange, and 18-tap two-ring disc bokeh gather that prevents background blur from bleeding across sharp in-focus silhouettes.PostStack3D): executes enabled stages in order (SSAO → Depth of Field → Bloom) via ping-pong offscreen targets, supports standalone passes viaPostPassRecorder(*gpu.Frameand*gpu.Encoder),Resize(dev, w, h), andRetaineddevice-loss restoration (including automatic pipeline/bind-group rebuild on restored devices).textureSampleLevel,FilterNearestdepth sampling, and precomputed/algebraic weights (no compute shaders,dpdx/dpdy, orexp/log2), verified on both full andnsgotest.NoGPUCompute(WebGL 2/GLES 3.0) profiles.Closes #282
Verification
gofmt -lon tracked Go files: cleango run ./cmd/gameschema -check: passedgo tool nsgo check -target macos,windows,linux,android,web: passed across all 8 architecturesgo tool nsgo test ./render3d: 87 passed, 0 failed (including golden reference renderspost3d_bloom.png,post3d_ssao.png,post3d_dof.png,post3d_combined.png,NoGPUComputeprofile, andRetaineddevice-loss recovery)go tool nsgo test . -- -run 'TestFormatPackagesRunConformance|TestFormatsPage|TestStabilityTable': 3 passed, 0 failedgo run ./tools/changelog check: passedbun run verify-notes: passed (20 notes verified)