godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.17k stars 98 forks source link

Implement reading and writing motion vectors in shaders #5888

Open Arnklit opened 2 years ago

Arnklit commented 2 years ago

Describe the project you are working on

Waterways - an addon for generating rivers

Describe the problem or limitation you are having in your project

Motion vectors don't get generated from effects such as scrolling textures. This means TAA doesn't know how to reuse the data from previous frames with many shader effects that move textures around.

https://user-images.githubusercontent.com/4955051/205250926-5483e161-5f4e-43f6-9f86-90d3d628d42e.mp4

the "Display Advanced -> Motion Vectors" view just shows black on the river no matter how fast I move the textures around, so no vectors are output from it.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Access to read and write motion vectors in shader

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

MOTION_VECTOR = my_custom_vector;

If this enhancement will not be used often, can it be worked around with a few lines of script?

This cannot be worked around.

Is there a reason why this should be core and not an add-on in the asset library?

This has to be done in core.

Arnklit commented 2 years ago

I just realised now that this will probably never work with transparent objects. But I see that it doesn't work with opaque ones either.

But yeah it would be great if it you had the option, even if it only works with opaque. I might be able to work around that.