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

Auto Lod algorithm causes seams between meshes #59024

Closed
Tracked by #57416
Arnklit opened this issue Mar 11, 2022 · 4 comments
Closed
Tracked by #57416

Auto Lod algorithm causes seams between meshes #59024

Arnklit opened this issue Mar 11, 2022 · 4 comments

Comments

@Arnklit
Copy link
Contributor

Arnklit commented Mar 11, 2022

Godot version

4.0.alpha4

System information

Windows 10, GLES3, GTX 980Ti

Issue description

I've been looking at using the new auto lod system to set up terrain chunks, but the decimate algorithm used doesn't seem to favor keeping edges intact, so seams quickly become very visible. Would it be possible to add an option to favor conserving edges?

EDIT: Note I exaggerate the issue in this screenshot by lowering the lod bias, but the issue is there with lod bias 1 as well.

image

Let me know if this should be logged as a proposal instead, then I can close this and make a proposal instead.

Steps to reproduce

Try out the attached example project

Minimal reproduction project

terrain_test2.zip

@Calinou
Copy link
Member

Calinou commented Mar 11, 2022

cc @fire

As a workaround, add a large plane below the terrain that roughly matches your terrain's ground color.

@fire
Copy link
Member

fire commented Mar 11, 2022

I think upstream has a bug report too. zeux/meshoptimizer#311

@Zylann Want to help us patch the engine mesh optimizer?

@Zylann
Copy link
Contributor

Zylann commented Mar 11, 2022

The patch I applied for my case makes it so open edges are never simplified.
The way I done it is a "free" way (doesn't cost anything) but has the drawback of not having the option to switch to the original logic at runtime. I did it this way because I do this at runtime, and a lot.

I think if we want that approach to be an option, a bit more work needs to be done, in such a way zeux would consider it good enough for it to be part of the official library. I think it's not that hard to make it work and would be enough for Godot Editor, but maybe harder to decide what's best to preserve good performance. It's about changing a lookup table so maybe it could be passed around, or run a loop to override vertices inside a condition like zeux proposed?

A better option would be to change the simplifying algorithm such that it would be able to simplify edges in such a way they would still match, but that sounds a lot more difficult because each side might have the same edge vertices but completely different triangle configurations (or maybe it's simple but I dont have enough insight to be sure).

@fire
Copy link
Member

fire commented Feb 22, 2023

Fixed by #70446

@fire fire closed this as completed Feb 22, 2023
@akien-mga akien-mga added this to 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

5 participants