react-postprocessing icon indicating copy to clipboard operation
react-postprocessing copied to clipboard

Depth of field performance

Open samuelcelko opened this issue 4 years ago • 2 comments

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!

samuelcelko avatar Jul 10 '21 12:07 samuelcelko

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

v1rtl avatar Jul 10 '21 13:07 v1rtl

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

dongho-shin avatar Jul 12 '23 05:07 dongho-shin