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: Vertex colors glitch on 3D model due to automatic mesh LOD #57608

Open
Tracked by #57416
kevinloustau opened this issue Feb 3, 2022 · 11 comments
Open
Tracked by #57416

Comments

@kevinloustau
Copy link

kevinloustau commented Feb 3, 2022

Godot version

v4.0.alpha.custom_build [2aee84c]

System information

Windows 11

Issue description

vertex.painting.issue.mp4

Using vertex painting on a model. If I zoom/de-zoom on my model, there is a glitch as you can see above.
It is working well in 3.4.2.

(Is it a LOD issue?)

Steps to reproduce

  • create a 3d mesh model, then add paint vertex. (or use the one attatched)
  • import the model in godot (master). The previewer is working well.
  • import the model in a scene, then zoom and dezoom on the model.

Files:
cube vertex paint .blend + gltf.zip

Minimal reproduction project

vertex painting 3.4.2.zip
vertex painting 4.0.zip

@Calinou
Copy link
Member

Calinou commented Feb 3, 2022

I can confirm this on master fc09d78.

(Is it a LOD issue?)

Yes, it's very likely. The automatic mesh LOD does support vertex colors, but it's possible that your particular mesh isn't well handled.

As a workaround, set rendering/mesh_lod/lod_change/threshold_pixels to 0.0 in the Project Settings to disable the rendering of automatic mesh LOD. To disable LOD temporarily in the editor, click the Perspective menu in the top-left corner of the 3D viewport and select Display Advanced… > Disable LOD. You can also use the Display Wireframe debug draw mode to check how different LOD levels look.

You can also disable LOD generation on specifc imported 3D scenes in the Import dock:

image

simplescreenrecorder-2022-02-04_00.52.22.mp4

@Calinou Calinou added this to the 4.0 milestone Feb 3, 2022
@Calinou Calinou changed the title [4.0] Vertex colors glitch on 3d model, depending on distance (camera and viewport) Vulkan: Vertex colors glitch on 3D model due to automatic mesh LOD Feb 3, 2022
@fire
Copy link
Member

fire commented Feb 5, 2022

If there are not enough vertices for the vertex color to look correct, do we interpolate?, do we disable lod?, do we do some magical mesh processing?

If we want to disable LOD, how do we scan it?

If there are any non-white data in the vertex color channel do we disable lod? This doesn't feel like the right design.

One way to improve the current situation is to post a documentation note explaining due to the nature of removing vertex indices the index colors will be incorrect.

@kevinloustau
Copy link
Author

From a user point of view, do this use case (low poly + vertex color) is a niche?
If yes, to disable LOD in settings seems ok. As @fire said, to post a documentation note seems enough.

@Calinou
Copy link
Member

Calinou commented Feb 5, 2022

From a user point of view, do this use case (low poly + vertex color) is a niche?

When working with low-poly meshes, automatic mesh LOD won't benefit you much. For your use case, it makes sense to disable LOD for all your imported low-poly meshes in the Import Defaults tab of the Project Settings.

If there are any non-white data in the vertex color channel do we disable lod? This doesn't feel like the right design.

LOD on vertex-colored meshes should definitely be kept in. I wonder if meshoptimizer could be modified to take vertex colors into account (essentially treating significant vertex color differences as sharp edges for the purposes of simplification). See also #53818.

@fire
Copy link
Member

fire commented Feb 8, 2022

I think you can assign the 4 rgba channels to the attribute simplifier. Unknown worth.

@fire
Copy link
Member

fire commented Sep 23, 2022

I think we can resolve this with a documentation entry.

@lyuma
Copy link
Contributor

lyuma commented Feb 22, 2023

Can we investigate if it's possible to quickly mitigate this problem by passing vertex colors to meshopt?

@clayjohn clayjohn modified the milestones: 4.0, 4.x Feb 23, 2023
@radiantgurl
Copy link
Contributor

Any updates? This issue has not been looked at in over 2 years.

@fire
Copy link
Member

fire commented Sep 29, 2024

We've upgraded the LOD tooling in meshoptimizer but haven't tested the original cases.

@aristides86
Copy link

In v4.3.stable.official [77dcf97] it just removes vertex colors alltogether. The temp workaround is to disable LOD generation on import.

@catprisbrey
Copy link

catprisbrey commented Feb 24, 2025

Godot 4.4RC1, Blender 4.3, UbuntuStudio 24.04.

I want to add to this since I've been experiencing it a lot lately. I'll share a GIF since mine is about as minimal of an example of it as i can imagine. I have a 64x64m plane in blender, vertex colors painted in a square-ish RGB pattern. With LOD generation disabled it works fine, enabled it heavily distorts the color data.

Image

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

8 participants