Skip to content
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

AfterImage Example running at different FPS (delta Time) #29351

Closed
lucasdomanico opened this issue Sep 7, 2024 · 4 comments
Closed

AfterImage Example running at different FPS (delta Time) #29351

lucasdomanico opened this issue Sep 7, 2024 · 4 comments
Milestone

Comments

@lucasdomanico
Copy link

Description

Hello, I think the AfterImage example should work for different fps.
I started a discussion here: https://discourse.threejs.org/t/afterimage-example-damp-fps/70404
But at the end of the day I think it's something Three js should handle.

Solution

Use the delta time for the 'damp' value of the AfterImage shader pass.

Alternatives

Leaving it as it is, but the visual results would be different at differents fps : \

Additional context

No response

@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 7, 2024

This is not the only example that animates objects in the animation loop without the usage of THREE.Clock or THREE.Timer. If you replace:

mesh.rotation.x += 0.005;
mesh.rotation.y += 0.01;

with:

const delta = clock.getDelta();

mesh.rotation.x += 0.25 * delta;
mesh.rotation.y += 0.5 * delta;

you almost get the same result but FPS independent.

For simplicity reasons, I don't think it's required to update all example in that regard.

@lucasdomanico
Copy link
Author

lucasdomanico commented Sep 7, 2024

yeah, for the mesh transform I get it. Thanks.
My problem is with the damping factor of the AfterimagePass.
I've tried something like:

const delta = clock.getDelta();
afterimagePass.uniforms[ 'damp' ].value = delta * 0.96;

But it doesn't work properly

@Mugen87
Copy link
Collaborator

Mugen87 commented Oct 3, 2024

Um, I don't think there is an easy way to fix this since any FX technique with a temporal component can produces different results depending on the frame rate. You can easily see that at reconstruction techniques with temporal component like FSR2 or DLSS. These produce different (better) results at a higher frame rate. Since there is no option to guarantee a 100% consistency across all possible frame rates, I tend to see this issue as a Won't fix.

@lucasdomanico
Copy link
Author

I solved it by capping to a fps the effect.
The effect it produces now is the same (as long the fps is above the cap)

@Mugen87 Mugen87 added this to the r170 milestone Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants