You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tested on Godot 2.1 beta and 2.1 stable, Windows 10 64 bits
When generating a surface with SurfaceTool and the add_smooth_group(true) method, it's impossible to get smooth normals if UVs are added to vertices.
I found that it specifically happens when UVs are not increasing from one vertice to another. So if every quad of a surface has UVs going from 0 to 1, the quad will be rendered with hard face normals.
Because of this I am forced to generate normals myself.
Not sure if it's a bug because I believe it was implemented so it does that. But as I said, it's possible to have smooth normals even in that case, so this can be enhanced.
Repro: SurfaceToolSmoothShading.zip
Launch the main scene, see the generated surface on the left with UVs has hard faces, the one on the right doesn't and has smooth faces, while both have a smooth group.
The text was updated successfully, but these errors were encountered:
HI @Zylann I was googling in search of the correct way to smooth a code generated mesh and I stumbled upon this.
I am using godot 3.0.4 and, using add_smooth_group as you are I am getting it correctly rendered, with UV.
[edit] I have to correct myself, the issue is still there, but I have to specify, as Zylann did in the code, that it works only if UV are spread over the mesh, but not when repeated for every quad:
# If UVs are spread, normals are smooth.
var t00 = Vector2(p00.x, p00.z) / Vector2(sx,sy)
var t10 = Vector2(p10.x, p10.z) / Vector2(sx,sy)
var t11 = Vector2(p11.x, p11.z) / Vector2(sx,sy)
var t01 = Vector2(p01.x, p01.z) / Vector2(sx,sy)
I believe it happens because SurfaceTool assumes smoothing can only happen if vertices are shared, and to be shared vertices must have equal attributes. While it's true this case makes them have different UVs, smoothing should still be possible with two vertices with different UV, but giving two normals having the same value.
Tested on Godot 2.1 beta and 2.1 stable, Windows 10 64 bits
When generating a surface with
SurfaceTool
and theadd_smooth_group(true)
method, it's impossible to get smooth normals if UVs are added to vertices.I found that it specifically happens when UVs are not increasing from one vertice to another. So if every quad of a surface has UVs going from 0 to 1, the quad will be rendered with hard face normals.
Because of this I am forced to generate normals myself.
Not sure if it's a bug because I believe it was implemented so it does that. But as I said, it's possible to have smooth normals even in that case, so this can be enhanced.
Repro:
SurfaceToolSmoothShading.zip
Launch the main scene, see the generated surface on the left with UVs has hard faces, the one on the right doesn't and has smooth faces, while both have a smooth group.
The text was updated successfully, but these errors were encountered: