Skip to content

MetalFX temporal + Dof + screenreading shader breaks #106665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
thmasn opened this issue May 21, 2025 · 12 comments · May be fixed by #106731
Open

MetalFX temporal + Dof + screenreading shader breaks #106665

thmasn opened this issue May 21, 2025 · 12 comments · May be fixed by #106731

Comments

@thmasn
Copy link
Contributor

thmasn commented May 21, 2025

Tested versions

Godot 4.5 dev5 - broken
Godot 4.4 stable - working

System information

MacBook Pro M1 - Sequoia 15.4.1

Issue description

in a specific combination of settings and assets, the temporal MetalFX upscaler breaks

Steps to reproduce

in a 3d scene, do the following:

  • use Mobile renderer
  • enable dof on the camera
  • put a mesh in front of the camera that is screen-reading
  • enable MetalFX (Temporal) upscaler in the project settings (scale factor 0.5 as example)

these 4 things in combination create the bug. as soon as one of them is missing, everything works
all other upscalers do not have this issue.

the bug looks like this:
Image

Minimal reproduction project (MRP)

https://github.com/thmasn/godot-bugreport-dof

@thmasn
Copy link
Contributor Author

thmasn commented May 21, 2025

i just double-checked 4.4 and it seems to work there, so it is only a 4.5dev5-issue.
should these still be reported, or are bug reports only created for release candidates?

@Calinou
Copy link
Member

Calinou commented May 21, 2025

cc @stuartcarnie

i just double-checked 4.4 and it seems to work there, so it is only a 4.5dev5-issue.
should these still be reported, or are bug reports only created for release candidates?

Yes, we encourage reporting issues for development snapshots too 🙂

@stuartcarnie
Copy link
Contributor

Some follow-up comments

  • I can't reproduce it in the editor when clicking the Preview checkbox
  • If I run the project from the editor, it reproduces the issue
  • If I run the project directly, it does not reproduce the issue

@stuartcarnie
Copy link
Contributor

How do you ensure that Preview in the editor renders the materials / shaders?

@thmasn
Copy link
Contributor Author

thmasn commented May 22, 2025

How do you ensure that Preview in the editor renders the materials / shaders?

in my setup (linked MRP) i have the shader in front of the camera as a plane. like you would do post effects the "old" way:
Image
this setup with MetalFX enabled and scale set to 0.5 already makes the shader purple in the viewport on my machine.
this is why it appears when the camera is selected and "preview" enabled.

i assume it is getting wrong uv coordinates from the SCREEN_UV parameter, causing it to read outside of the available texture.
but only when DOF is enabled at the same time.

@thmasn
Copy link
Contributor Author

thmasn commented May 22, 2025

Some follow-up comments

  • I can't reproduce it in the editor when clicking the Preview checkbox
  • If I run the project from the editor, it reproduces the issue
  • If I run the project directly, it does not reproduce the issue

on my machine it happens on all 3 instnaces, even when i run it directly from the project list:

Image

@thmasn
Copy link
Contributor Author

thmasn commented May 22, 2025

  • as far as i can tell, the screenreading shader runs before the DOF.
  • as in the editor screenshot above, the issue only happens inside the plane using the shader.
Image
  • this makes me assume that the pink is introduced by the screenreading shader.
  • but the built-in SCREEN_UV seems to provide correct uv coordinates, as i just tried out (uvs are over 0.5 halfway of the screen):
Image
  • also, the texture is not pink yet inside the screen texture read (because this would trigger the r>.9 condition):
Image
  • but it is pink when it is beeing blended with the opaque objects? since tranparency lets opaque objects be visible in all of the screen:
Image
  • my best guess is that the issue appears somewhere in the auto-generated shader code, or maybe in a step that combines opaque + transparent obejcts

@thmasn
Copy link
Contributor Author

thmasn commented May 22, 2025

just noticed that it is also only on mobile renderer, forward+ works

@stuartcarnie
Copy link
Contributor

just noticed that it is also only on mobile renderer,

Ahh, that is what I am observing too!

@stuartcarnie
Copy link
Contributor

When I start the editor with the mobile renderer, the panel is also now showing purple:

Image

@stuartcarnie
Copy link
Contributor

Ahh, temporal should not be available in mobile as the renderer doesn't provide motion vectors. I'll need to disable it (which I thought I did already). This is the same reason why FSR2 is unavailable.

@stuartcarnie
Copy link
Contributor

This is fixed via #106731, which disables MetalFX Temporal upscaling for the mobile renderer, just like FSR2. Once #100283 merges, we can revisit adding support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants