Migrate simple effects to createEffectComponent - #366
Open
kvvasuu wants to merge 1 commit into
Open
Conversation
Covers every effect whose postprocessing class constructs with zero arguments (Bloom, Noise, Vignette, FXAA, and ~20 others) - live props update the existing instance instead of reconstructing on every change, construction-only options move to explicit args. Also fixes a few bugs these effects had on top of the migration: opacity typing on nine of them, ChromaticAberration's radialModulation/modulationOffset incorrectly required, ColorDepth's bits not resetting on removal.
kvvasuu
force-pushed
the
pr3/simple-effects
branch
from
August 5, 2026 20:30
e830758 to
8219d39
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
Third PR in the stack (base:
pr2/effect-composer).Migrates every effect whose underlying
postprocessingclass can be constructed with zero arguments tocreateEffectComponentfrom PR1 -ASCII,Bloom,BrightnessContrast,ChromaticAberration,ColorAverage,ColorDepth,Depth,DotScreen,FXAA,Glitch,Grid,HueSaturation,LensFlare,Noise,Pixelation,Ramp,SMAA,Scanline,Sepia,TiltShift,TiltShift2,ToneMapping,Vignette,Water,Texture.postprocessing) now update the existing effect instance directly instead of reconstructing it on every change. Construction-only options (no live setter - e.g.Bloom'smipmapBlur,Glitch'sdtSize) are routed explicitly throughargs, the same way any other r3f element takes construction args.refon any of these now points to one stable instance across prop updates, instead of a new instance every reconstructing render.opacitywas untyped (and, forPixelation, unforwarded at runtime) on nine of these despite working - or being documented to work - at runtime:Bloom,Noise,SMAA,TiltShift,ToneMapping,Grid,ColorDepth,Glitch,Pixelation.blendFunction/opacityorColorDepth'sbitsdidn't reset to the effect's real default - both were always forwarded as an explicit prop even whenundefined, which defeats r3f's reset-on-removal (present-but-undefined isn't the same as absent). ForblendFunctionspecifically this was worse than cosmetic: r3f's native reset couldn't have recovered the right value regardless, sinceBlendMode's own constructor requires an argument - it would have fallen back toBlendFunction.SKIP(0), which doesn't pick the wrong blend mode, it hides the effect entirely. Fixed by applying these two throughuseLiveDefaultsinstead, same as the hand-rolled effects.ChromaticAberration'sradialModulation/modulationOffsetprops were typed as required -postprocessing's own.d.tsincorrectly marks them so, even though its JSDoc confirms both are optional with defaults.