Migrate hand-rolled effects to useLiveDefaults - #367
Open
kvvasuu wants to merge 1 commit into
Open
Conversation
Outline, SelectiveBloom, ShockWave, GodRays, DepthOfField, SSAO, LUT, and N8AO all need real constructor args (scene/camera/etc.), so they stay hand-built with useMemo, but now apply live props through useLiveDefaults instead of reconstructing on every change. This is where nearly every real runtime bug from review surfaced: a first-apply bug where a still-correct value's setter fired anyway (Outline's multisampling disposing its render target before first use - the actual reason several of these didn't render at all), SSAO's color/fade/minRadiusScale/world* thresholds not resetting on removal, DepthOfField's depthTexture reconstructing instead of using the live setDepthTexture, and GodRays/N8AO not invalidating on live changes under frameloop="demand".
kvvasuu
force-pushed
the
pr4/hand-rolled-effects
branch
from
August 5, 2026 20:30
89dfefb to
8a776a9
Compare
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
Fourth PR in the stack (base:
pr3/simple-effects).Migrates the effects that can't use
createEffectComponentbecause theirpostprocessingclass requires real constructor arguments (scene/camera/etc., sonew EffectClass()doesn't work with zero arguments) -Outline,SelectiveBloom,ShockWave,GodRays,DepthOfField,SSAO,LUT,N8AO. These stay hand-built withuseMemo, but now apply live props throughuseLiveDefaultsinstead of reconstructing the whole effect on every change.This is where nearly every real runtime bug found during review lived - kept as its own PR deliberately, not diluted with PR3's more mechanical changes:
SSAO'scolor,fade,minRadiusScale, andworld*proximity/distance thresholds didn't reset toSSAOEffect's real constructor defaults on removal - they were being forwarded to the constructor and tracked live, so the live tracker's "default" snapshot captured whatever was passed on the first render instead of the library's true default.DepthOfField'sdepthTexturewas construction-only (any change reconstructed the whole effect, render targets and passes included) despiteDepthOfFieldEffect.setDepthTexture()existing specifically to update an existing instance. Now applied live.GodRays(swappingsun) andN8AO(config/qualitychanges) mutate their effect directly, outside r3f's reconciler, so nothing was ever callinginvalidate()- both now correctly repaint under<Canvas frameloop="demand">.