I figured out I just need to put
add_smooth_group(true) before generating a bunch of vertices, and those vertices will be smoothed until I call
add_smooth_group(false). So for example if I need the full mesh to be smooth, I call it just after
surface_tool.begin(primitive_type) and voilà
Hi, after 4 years. It still not working. Your solution does not work in Godot 3.2.3. I have no idea how to achieve smooth normals. I use SurfaceTool wo generate a terrain.
siluck | 2020-10-03 16:58
This was in Godot 2. A lot of time has passed and maybe things changed.
Also, you use
create_from. As far as I can tell, this disregards previous calls to
SurfaceTool and replaces its content with the array.
Maybe you could try
It also sounds strange to use SurfaceTool when you seem to have a mesh already, that sounds wasteful. I suspect it’s just because you want to use
generate_normals, which is quite unfortunate^^"
Zylann | 2020-10-03 17:36
I use reference mesh for calculations. For example a sphere for planet generation. This is a simple way to manipulate more complex meshes. Ok, a sphere is not really complex. But the alternative is to write pages for shpere creation. … I’m not very experienced in mesh creating in Godot. But anyway, your solution replacing
append_from(mesh, 0, transform) works. It’s now smooth. Thanks
siluck | 2020-10-06 19:34
It works for me (Godot 3.2.1)
var st = SurfaceTool.new()
# adding triangles (color, uv, vertex)
badunius | 2021-10-14 18:42