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

Emit normal_roughness compatibility code in custom functions #94812

Merged
merged 1 commit into from
Jul 28, 2024

Conversation

clayjohn
Copy link
Member

Fixes: #94777

When reading from the normal_roughness buffer we need to emit compatibility code to ensure that the user gets proper normals even though the texture is stored in a custom format.

In master the compatibility code is only added when the normal_roughness uniform is used directly. When the normal_roughness uniform is passed as an argument to a custom function the compatibility code is not used.

This PR does two things:

  1. It checks if the source of the argument is a a screen_texture and emits the compatibility code if it is
  2. It bans passing a screen texture to custom function if the custom function is already used with a non-screen texture (we already had this logic in place for when two uniforms were used with different filter or roughness settings)

As a bonus, we can now undo the restriction added in #72300 which forbid passing screen textures to custom functions when using XR shaders.

@clayjohn clayjohn added this to the 4.3 milestone Jul 26, 2024
@clayjohn clayjohn requested a review from a team as a code owner July 26, 2024 17:51
Copy link
Contributor

@BastiaanOlij BastiaanOlij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement! Looks good to me :)

@akien-mga akien-mga changed the title Emit normal_roughness compatibility code in custom functions Emit normal_roughness compatibility code in custom functions Jul 27, 2024
@akien-mga akien-mga merged commit 8e47aaf into godotengine:master Jul 28, 2024
18 checks passed
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

Artifacts in post-processing depth shader on 4.3-RC1
3 participants