Makie 3D mesh plot is not as good as before

In the Makie v0.10.0, plotting 3D mesh is not as good as before. Here is minimal working example using Makie v0.10.0,

shell> wget https://github.com/libigl/libigl-tutorial-data/raw/master/bumpy-cube.obj

using Makie, FileIO

shape = load("bumpy-cube.obj")
im1 = mesh(shape,color=:red,shading=true)

However when I use Makie v0.9.6, the result is:

What parameter in Makie v0.10.0 I need to tweak to make nice 3d mesh plot?

That happens, because MeshIO doesn’t calculate normals by default anymore, if they’re missing in the obj, and in Makie, I haven’t calculated the normals explicitely when shading is on.
I pushed a fix to master… Note, that master is not super stable at the moment, but hopefully, we’ll get tests back in shape and can tag a stable version soon!
You’ll need:

]add GLMakie#master AbstractPlotting#master

Btw, if you don’t want to checkout master, you can also do this, with the newest tagged version of GeometryBasics:

mesh(normal_mesh(shape) ,color=:red,shading=true)
2 Likes

You can also tweak the lighting qualities in the latest AbstractPlotting and GLMakie. See the docs for more details.

using Makie, FileIO
meshfile = Base.download("https://github.com/libigl/libigl-tutorial-data/raw/master/bumpy-cube.obj")
shape = FileIO.load(FileIO.File{FileIO.format"OBJ"}(meshfile))

# we will manipulate shininess here
shiny_node = Observable(1f0)
im1 = mesh(shape; color = :red, shininess = shiny_node)

# we give the mesh scene a title to see what the shininess is
scene = title(im1, @lift "Shininess\n" * string(round($shiny_node; sigdigits = 4)))

# now record
record(scene, "shininess.mp4", exp.(LinRange(0, 11.5, 300)); framerate = 30) do i
    shiny_node[] = i
end

Thank you, the GeometryBasics way is better in my case

@sdanisch - has this change been released in the latest tagged version of Makie?

Actually, using WGLMakie, I’m still seeing this issue, even on master, whether or not I use the normal_mesh function.

[276b4fcb] WGLMakie v0.2.9 `https://github.com/JuliaPlots/WGLMakie.jl.git#master`
[537997a7] AbstractPlotting v0.12.18

Although it seems that WGLMakie pins AbstractPlotting to v0.13.6, so I can’t use AbstractPlotting#master - not sure if this is related.

pkg> add AbstractPlotting#master
   Updating git-repo `https://github.com/JuliaPlots/AbstractPlotting.jl.git`
  Resolving package versions...
ERROR: Unsatisfiable requirements detected for package AbstractPlotting [537997a7]:
 AbstractPlotting [537997a7] log:
 ├─possible versions are: 0.13.6 or uninstalled
 ├─restricted to versions 0.12.5-0.12 by WGLMakie [276b4fcb] — no versions left
 │ └─WGLMakie [276b4fcb] log:
 │   ├─possible versions are: 0.2.9 or uninstalled
 │   └─WGLMakie [276b4fcb] is fixed to version 0.2.9
 └─AbstractPlotting [537997a7] is fixed to version 0.13.6