Skip to content
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

Visual bug/artifact when using varying UV offset in a (distortion) shader in Godot 4.2+ mobile renderer #90818

Open
11811341 opened this issue Apr 17, 2024 · 2 comments · May be fixed by #91480

Comments

@11811341
Copy link

Tested versions

Reproducible in Godot 4.2 and above using the mobile renderer. NOT present in 4.1

System information

Windows 10, mobile renderer, Godot 4.2.1

Issue description

When a distortion shader is applied to a plane that uses a varying UV offset to create the distorted effect, a triangular patch of "roughness" appears in the portion opposite the camera. This problem was not present in Godot 4.1x.

Video of the issue can be seen here:
https://www.reddit.com/r/godot/comments/1c5sd1z/day_2_of_seeking_help_with_shader_bugged_by_42/

Image from the MRP, undesirable area circled red:
image

Steps to reproduce

  1. Use Godot 4.2 or above
  2. Use mobile renderer
  3. Basic scene setup for better visibility (Light & Environment, these don't affect the bug, but make it more easily visible)
  4. Set up a plane and create and apply a new Shader material
  5. Use the following minimal shader code:

shader_type spatial;

uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, repeat_disable;

uniform float refraction_strength = 0.05;
uniform sampler2D refraction_noise;

void vertex() {
}

void fragment() {
vec2 offset = texture(refraction_noise, UV).rg;
offset = 2. * offset - 1.;
offset *= refraction_strength;
vec2 ouv = SCREEN_UV + offset;
ALBEDO = texture(SCREEN_TEXTURE, ouv).rgb;
}

Minimal reproduction project (MRP)

Bugfinding.zip

@clayjohn
Copy link
Member

clayjohn commented May 2, 2024

This might be a duplicate of #88786. It seems the issue doesn't occur on all devices, what CPU and GPU are you testing on?

@11811341
Copy link
Author

11811341 commented May 2, 2024

Yeah it definitely looks that way... It looks even more similar to the other one you linked (#88585).
It shows up on my intel i7-6700k GTX1070, as well as on my honor 50, as well as an honor 90 phone.
Would be really sus if it was a device issue.

@clayjohn clayjohn added this to the 4.3 milestone May 2, 2024
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