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

Vulkan: Strange white artifacts on alpha scissor material due to incorrect mipmap generation for transparent textures #60388

Closed
VP-GAMES opened this issue Apr 20, 2022 · 4 comments

Comments

@VP-GAMES
Copy link

Godot version

4.0 dev

System information

Linux Ubuntu 20.04.3 LTS

Issue description

Some meshes with alpha scissor material, has strange white edges.

Steps to reproduce

Open attached project to see the presentation.

Minimal reproduction project

Artifacts.zip

@Calinou
Copy link
Member

Calinou commented Apr 20, 2022

I can confirm this on master 1d21779:

simplescreenrecorder-2022-04-20_12.35.03.mp4

This is due to mipmap generation not being done correctly for transparent textures.

Unlike #57981, changing the texture compression mode from VRAM Compressed to Lossless does not resolve this issue:

image

Disabling mipmap generation on the texture in the Import dock will resolve this issue. It can make the texture appear grainy at a distance, but given your texture doesn't have much high-frequency detail, it still looks good enough at a distance from my testing:

image

Can you reproduce this in 3.4.4 (in GLES3)?

@Calinou Calinou added this to the 4.0 milestone Apr 20, 2022
@Calinou Calinou changed the title Strange white artifacts on alpha scissor material Vulkan: Strange white artifacts on alpha scissor material due to incorrect mipmap generation for transparent textures Apr 20, 2022
@VP-GAMES
Copy link
Author

In 3.4.4 (in GLES3) i have to set Flags: Transparent to "TRUE" and change Parameters: Depth Draw Mode to "Opaque Pre-Pass" it's enough, it works good
NoArtifactsGLSE3.zip
.

@lyuma
Copy link
Contributor

lyuma commented Feb 22, 2023

Is anyone able to reproduce this with a 4.0 release candidate? I suspect this issue was fixed sometime in the past year

@Calinou
Copy link
Member

Calinou commented Feb 22, 2023

I can still reproduce this on 4.0.rc3 with the MRP (.godot/ was removed to force a reimport of everything).

However, this is a material configuration issue, not a bug:

Linear Mipmap with Alpha Scissor cutoff 0.05

Notice the visible card edge.

image

Linear with Alpha Scissor cutoff 0.05

image

Increasing Alpha Scissor threshold from 0.05 to 0.5 gets rid of the issue with mipmaps enabled:

Linear Mipmap with Alpha Scissor cutoff 0.5

image

Lastly, this is how the opaque texture looks:

image

For optimal mipmap generation, I recommend setting the transparent areas' color to be as close as possible to the surrounding opaque areas. This means making the entire background have the leaf's color while keeping transparent pixels, and configuring your image editor to not discard the color values of fully transparent pixels when saving.

@Calinou Calinou closed this as not planned Won't fix, can't repro, duplicate, stale Feb 22, 2023
@Calinou Calinou removed this from the 4.0 milestone Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants