JuliaGeometry / GeometryTypes.jl

Geometry types for Julia
Other
67 stars 41 forks source link

Normals wrong for spheres #197

Closed ffreyer closed 4 years ago

ffreyer commented 4 years ago

I noticed that the lighting of Spheres (or meshes thereof) in Makie is not smooth. It seems like this is because normals are not generated correctly. For example

using Makie, GeometryTypes
m = GLNormalMesh(Sphere(Point3f0(0), 1f0))
scene1 = mesh(m, color=:red)

# copy with normals = vertices
m = GLNormalMesh(vertices(m), GeometryTypes.faces(m), vertices(m), m.texturecoordinates, m.color, m.attributes, m.attribute_id)
scene2 = mesh(m, color=:red)

scene = vbox(scene1, scene2)

results in

sphere_test