Open Kevin-Mattheus-Moerman opened 7 months ago
Could this be the cause of #3561 too maybe?
SimonDanisch may be able to confirm, but my guess is that the shading algorithm uses "vertex" rather than face normals, and that the vertex normal for this shared node is zero.
Yes, because OpenGL doesn't have face normals. It also doesn't have a glFaceIndex. If you want to have per-face normals you have to duplicate vertices to avoid sharing vertices.
GeometryBasics normal algorithm doesn't assume you want that. It just computes a normal for each face, adds it to each vertex and then normalizes it. We could consider adding a different normal generation in/after https://github.com/JuliaGeometry/GeometryBasics.jl/pull/173 that does grow the mesh
Probably because for the shared node the mean of the two faces produces the average between (0,0,1) and (0,0,-1). However, should the whole triangles be black like that? Perhaps the normals should not be allowed to be zero?
It's nan actually, which is maybe also something to clean up in https://github.com/JuliaGeometry/GeometryBasics.jl/pull/173. With 0 you would get a brighter color because of ambient light.
Could this be the cause of #3561 too maybe?
No, that issue has problems generating a face. This one is more or less just how vectors add up
]activate --temp; add Makie
) - > yesHere is a simple code to visualize two triangles which share a single corner node:
Despite the color being set to
:white
(or any other color I tried) this renders them both black:In the next visualization I've added the face normal vectors in red. In addition I subdivided the triangles. Now it is clear this happens when the face normals flip from the one set of triangles to the next.
@SimonDanisch may be able to confirm, but my guess is that the shading algorithm uses "vertex" rather than face normals, and that the vertex normal for this shared node is zero. Probably because for the shared node the mean of the two faces produces the average between
(0,0,1)
and(0,0,-1)
. However, should the whole triangles be black like that? Perhaps the normals should not be allowed to be zero?