Teardown-Issue-Tracker-Maintainers / Teardown-Issue-Tracker

A public repo for the community to track issues/bugs/feature requests in Teardown.
12 stars 6 forks source link

[Feature] Interpolate transforms of objects attached to camera #44

Open metarmask opened 3 years ago

metarmask commented 3 years ago

After upgrading my graphics card I can finally achieve buttery smooth frame rates in this game. (after I figured out what was limiting them). This made me happy, as it greatly improves the feel of any first person game for me. When it comes to choppiness caused by frame rates over 60, it is practically invisible unless the camera is following an object. My suggestion would be to add linear interpolation based on velocity, but only to some objects which move with the camera:

Based on my limited understanding, this wouldn't be too hard to implement, but it would mean objects could flash in an incorrect position for high speed collisions. Also, objects still wouldn't move completely smoothly when being accelerated, like when falling, but this is not a problem for tools and held entities. Acceleration could also be tracked to mitigate this somewhat.

Alternatives

Adding interpolation or a dynamic timestep to the entire engine would be nice, but probably won't be worth it before high frame rate monitors become more prevalent.

I guess if you delayed the physics one frame and then used linear interpolation between those frames, that would prevent the object from flashing at a invalid position, but it would also make the game less responsive.

tuxedolabs commented 3 years ago

It is a god idea, but last time I tried it tend to snowball into interpolating everything. Example: interpolating the car you are driving. The car might have other objects jointed to it, planks for instance. If you move the car you also need to update the shadow volume otherwise it will self-shadow, and if you update the shadow volume, you need to interpolate light sources, otherwise they will flicker due to self shadowing.. So it's not as easy as it might sound at a first glance, but I am planning to overhaul this down the road.

Please-Pick-a-Name commented 5 months ago

AttachCameraTo sure we are 2.5 years late but hows this