godot icon indicating copy to clipboard operation
godot copied to clipboard

Add an option to jitter BaseMaterial3D dithering pattern across frames

Open Calinou opened this issue 2 years ago • 2 comments

  • Follow-up to https://github.com/godotengine/godot/pull/61834 (can be merged independently).

This improves the dithering pattern's appearance when TAA is enabled, or at high frame rates when TAA is disabled (thanks to monitor response times not being instant).

See https://github.com/godotengine/godot-proposals/issues/4179 (the rationale is very similar).

Preview

Click to view at full size (this is required for accurate preview). TAA is enabled on all screenshots.

Before After
Screenshot_20230716_004902 webp Screenshot_20230716_004940 webp

Bonus screenshot (6 MB)

TODO

  • [ ] See if we can make the project setting change effective without requiring a restart. https://github.com/godotengine/godot/pull/62038 will likely help here.
  • [ ] Apply this change to the Alpha Hash transparency mode (could be done in a future PR).

Calinou avatar Jul 15 '23 23:07 Calinou

IMO this should be automatic. i.e. enabled when using TAA, disabled if not using TAA.

If users request the setting later, we can add it.

I've pushed a second commit that removes the setting. Let me know if I should do the same for https://github.com/godotengine/godot/pull/61834.

Calinou avatar Jul 17 '23 10:07 Calinou

Rebased and tested again, it works as expected. This is now effective on FSR2 as well.

I wonder if we should have a dedicated built-in shader variable to expose a TAA/FSR2 jitter fraction, since this would allow for converting to ShaderMaterial without having the converted code depend on whether you had TAA/FSR2 enabled or not at the time of conversion.

Note that there's an issue which also occurs without this PR, but tends to be made more noticeable with this PR. A large checkerboard pattern is visible when moving towards or away a material with dither distance fade enabled (either Pixel Dither or Object Dither).

image

I'm not sure what's causing this. I've reported it separately: https://github.com/godotengine/godot/issues/94841

Calinou avatar Jul 27 '24 18:07 Calinou