AfterImage example, Damp fps

Hello, I wonder if this example works for different fps:
https://threejs.org/examples/?q=after#webgl_postprocessing_afterimage

Or should I set the Damp factor based in the delta timestep each frame/tick? (how?)
Thanks!

Just ran it on 60hz and 144hz displays… and it renders “the same” but on the 144hz display, the cube is rotating ~twice as fast.

If the rotation speed of the cube was multiplied by the time elapsed since last frame (deltaT), it would rotate at the same speed, but on the 144hz display the “length” of the trail would be half that of the 60hz display.

The only way (i can think of) to make them match regardless of display rate… is to pick a “base” framerate like 60fps, and on the 144hz display, only render to the accumulation buffer at the 60fps interval…

If we pick 144hz as the base rate… then the 60fps display would have to render to the accumulation buffer multiple times per frame. (Resulting in a higher rendering load than just rendering one frame per requestAnimationFrame)

There may be a clever way to modify the “strength” of the blend to compensate for the differences between the 2 rates… but the math of that sounds like… tricky?
For instance, on the 144hz display… if the blend was half as strong, the overall luminance and spread of the effect might be similar to the 60hz display, which is I think what you are alluding to.

You can imagine the same effects with things like temporal antialising, where the previous frame and the current frame are accumulated. On a high rate display, the accumulation of TAA might be lessvisible, resulting in an overall higher quality appearance to the effect, but on lower rate displays, the difference between frames is larger, and thus the accumulation would be more “strobe-ey” and the effect might not be as pleasing.

Proper TAA uses a velocity buffer storing the actual world space velocity of each pixel of the display, which is uses to adjust where the sampling occurs from… and this helps overcome this accumulation issue, but adds a lot of complexity.

yeah, I will just make a table for deltas times to the damp factors.
Is someone else here can figure out the proper math, you are more than welcome!
Thanks!

1 Like