-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turning effects on and off during runtime? #68
Comments
You can disable effects by using import { SSAO } from 'react-postprocessing'
import { BlendFunction } from 'postprocessing'
return (
<SSAO
blendFunction={BlendFunction.SKIP}
/>
) |
Thanks for the answer! And I could change these on the fly and resources would not be recreated? |
I found this demo of SSAO using react-postprocessing: It seems like the framework is not responding to runtime changes. I want to note that i tried different modes of this (including not using useMemo at all, and only putting the SSAO component inside useMemo) but they all exhibited the same behavior |
@noamgat yep seems like a bug... if you know the fix pull requests are welcome :P |
I don't know the library well enough to fix, but I created a branch and modified the "Selection" example to reproduce the bug in the react-postprocessing dev env: |
I have also noticed that changes to postprocessing parameters do not take effect immediately. I have to toggle the entire postprocess pipeline off and back on (which it sounds like it may leak resources?) to get them to take. |
Hi, After a re-render of the component, Bloom effect is broken (i.e. you cannot change its properties anymore). Please see repro
|
i am doing it here: https://codesandbox.io/s/fun-with-rectarea-lights-pz0q6?file=/src/App.js and it seems to work. blendMode.setBlendFunction(...). although this is in a loop. i think this library experiences some problems with reactive updates atm, would be great if someone could look into it. |
We also noticed severe memory issues using I will try to extract our implementation into a codesandbox for better testing/reproduction. We used |
Here's our reproduction: https://codesandbox.io/s/mystifying-kare-k4lh3b?file=/src/App.js useFrame(() => {
if (bloomRef.current && intensityRef.current) {
bloomRef.current.intensity = intensityRef.current;
}
}); Screencast: (Activity Monitor > View > Update Frequency > Very Often (1sec) I can open a separate issue for this if needed. |
Hi,
We are using this library and its working well for us. Great job!
We need to dynamically turn some effects (specifically on and off) during the viewing of the page - sometimes we want high FPS, sometimes we want beautiful visuals.
We currently do this like this, using an isPostOn prop:
{isPostOn && <Post aoPreset={Post.aoPresetsTypes.low} />}
with Post being a component with our chain:
This works, however it is leaking GPU memory, when switching between on/off modes, as the Post component (and thus the SSAO object) being recreated every time. It seems like the resources do not get cleaned up correctly.
Is there a better way to do this?
The text was updated successfully, but these errors were encountered: