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

MeshDataTool does not calculate all Normals correctly #9234

Open
anose001 opened this issue Apr 15, 2024 · 1 comment
Open

MeshDataTool does not calculate all Normals correctly #9234

anose001 opened this issue Apr 15, 2024 · 1 comment
Labels
area:manual Issues and PRs related to the Manual/Tutorials section of the documentation bug

Comments

@anose001
Copy link

anose001 commented Apr 15, 2024

Your Godot version:
4.2 Mono
Issue description:
I followed the tutorials on generating an ArrayMesh and using MeshDataTool to update the normals of a displaced mesh. My understanding is that MeshDataTool should help in calculating normals of a modified mesh. However, it seems that even in this tutorial demo there is a visible seam that extends from the positive y-axis to the negative y-axis, see picture attached. Display Wireframe and Display Unshaded do not show any issues so I figured the normals along that seem are off.
Any ideas on how to fix this issue?

Is this even a documentation issue or more of a godot engine issue?

image

URL to the documentation page:
ArrayMesh
MeshDataTool

@anose001 anose001 added the bug label Apr 15, 2024
@anose001 anose001 changed the title MeshDataTool Does Not Calculate All Normals Correctly MeshDataTool does not calculate all Normals correctly Apr 15, 2024
@clayjohn
Copy link
Member

Any ideas on how to fix this issue?

It depends on what you are doing to generate the normals.

Is this even a documentation issue or more of a godot engine issue?

Neither ArrayMesh nor MeshDataTool will generate normals for you, so its not an engine issue. The MeshDataTool doc does include a cheap example to generate normals in some cases, but it explicitly says that the normals will be incorrect, so I wouldn't count on it in your actual project.

In particular the problem with the code example in the doc is that it doesn't clear the vertex normals to 0 before calculating the new normals. So instead of averaging all the neighbouring face normals (the correct thing), you average the neighbouring face normals with the old vertex normal.

@skyace65 skyace65 added the area:manual Issues and PRs related to the Manual/Tutorials section of the documentation label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:manual Issues and PRs related to the Manual/Tutorials section of the documentation bug
Projects
None yet
Development

No branches or pull requests

3 participants