This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I have two cubes in my scene. One is just a BoxMesh, the other I generated with SurfaceTool. I added the vertices and indices, and generated normals. Both meshes have the same StandardMaterial3D, but for some reason, the mesh I generated with surface tool (the top one) does not shade the way I want:

enter image description here

Does anyone have any suggestions as to why it shades like that, and not like the cube below it?
The top cube is generated according to the cube tutorial I found here, updated for Godot 4: https://randommomentania.com/2018/11/godot-surface-tool-tutorial/
(see "Making A Cube" section.)

Godot version 4.0.1
in Engine by (31 points)
edited by

1 Answer

+1 vote
Best answer

For anyone who sees this in the future:

surface_tool.set_smooth_group(-1)

Solved my problem. From the docs:

Note: generatenormals takes smooth groups into account. To generate smooth normals, set the smooth group to a value greater than or equal to 0 using setsmoothgroup or leave the smooth group at the default of 0. To generate flat normals, set the smooth group to -1 using setsmooth_group prior to adding vertices.

by (31 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.