Skip to content

Depth of field performance #88

Description

@samuelcelko

Hey there, been wondering if anyone else has had performance issues after applying depth of field to a scene. Code below.

<DepthOfField focusDistance={0} focalLength={0.015} bokehScale={1} height={900} />

FPS just tanks after putting this in. Tried to mess with the settings but nothing seems to be helping.
Does anyone have any suggestions on how to make the performance better?

Thanks!

Activity

  1. v1rtl commented on Jul 10, 2021

    @v1rtl
    Member

    Did you try to use DOF directly from postporcessing?

    also did FPS drop in react dev mode or in prod?

    in dev it might re-apply the same effect so you have multiple DOFs so that's why FPS might drop

  2. dongho-shin commented on Jul 12, 2023

    @dongho-shin
    Contributor

    I think this would be problem
    DepthOfField.tsx in line 23
    https://github.com/pmndrs/react-postprocessing/blob/master/src/effects/DepthOfField.tsx
    image
    every props or camera changes, DepthOfEffect instance has created in useMemo
    so it causes memory leak

  3. kvvasuu commented on Aug 15, 2026

    @kvvasuu
    Collaborator

    Fixed in #355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effect:dofAffects <DepthOfField /> effect

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions