Open Calinou opened 4 years ago
This could be extended to animated textures or AnimatedSprites in general. That said, since interpolated flipbook animation is mainly used in particles nowadays, it might not be worth the added complexity.
See also godot-extended-libraries/godot-ideas#13.
Perhaps at the core level, Image.interpolate_with()
could be implemented for those cases at least, but not sure if applicable.
Describe the project you are working on:
The Godot editor :slightly_smiling_face:
Describe the problem or limitation you are having in your project:
When using particle flipbooks for animation purposes, you typically use an animation sheet whose intended speed is between 10 FPS and 30 FPS. This is often used to make fire or smoke effects look more realistic. Here's an example from Team Fortress 2's Flamethrower:
The issue is, when you play the animation as-is, it won't look smooth since the animation only has so many frames per ssecond to display. This issue is noticeable on 60 Hz monitors already, but it gets worse at higher refresh rates.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
Add a Blend Animation property to CanvasItemMaterial (for 2D) and StandardMaterial3D (for 3D). When particle flipbook features are used, the engine will blend frames together to make animations appear smoother.
This could be extended to animated textures or AnimatedSprites in general. That said, since interpolated flipbook animation is mainly used in particles nowadays, it might not be worth the added complexity.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
For the purpose of this example, let's say you have a 5 FPS animation with 10 frames. If the animation has been playing for 0.4 seconds, you'll see the 3rd frame of the animation as expected. If the animation has been playing for 0.5 seconds, you'll see the 3rd frame and the 4th frame with 50% blending (since we're halfway between the 3rd and 4th frame).
If this enhancement will not be used often, can it be worked around with a few lines of script?:
This feature might be doable with a custom shader, but it will require you to override the default shader to benefit from it. This will make interpolation more difficult to reuse in a project, especially if you have other custom shaders to apply on top.
You could also interpolate the flipbook manually in an image editor, but this will increase memory and storage requirements (on top of requiring manual work if you're not versed with ImageMagick or similar). Also, even if you interpolate to 60 FPS, it will never look completely smooth on high refresh rate monitors.
Is there a reason why this should be core and not an add-on in the asset library?:
See above.