Skip to content

ChromaticAberration: tuple offset bypasses Vector2 coercion, offset.set() throws #348

Description

@yourlcfr

The offset prop types accept anything ReactThreeFiber.Vector2-shaped, so this compiles:

const ref = useRef<ChromaticAberrationEffect>(null)
<ChromaticAberration ref={ref} offset={[0.001, 0.0005]} />

but the common animation pattern then throws:

ref.current.offset.set(0.002, 0.001)
// TypeError: ref.current.offset.set is not a function

Why: in v3, ChromaticAberration is a bare wrapEffect(ChromaticAberrationEffect). The raw props object goes straight to the effect constructor, and ChromaticAberrationEffect stores whatever it receives into new Uniform(offset) with no coercion — so effect.offset ends up a plain array. R3F's math-prop conversion never runs because the value travels through args, not applyProps.

Regression note: v2 coerced this (#224). The coercion didn't survive the v3 wrapEffect rewrite. Glitch still does it correctly via the useVector2 helper in util.tsxChromaticAberration just doesn't use it.

Versions: @react-three/postprocessing 3.0.4, postprocessing 6.39.1, @react-three/fiber 9.6.1, React 19.2.

Workaround meanwhile: own a Vector2 and reassign effect.offset post-mount.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions