# Makie 3D mesh plot is not as good as before

**URL:** <https://discourse.julialang.org/t/makie-3d-mesh-plot-is-not-as-good-as-before/39808>\
**Category:** Visualization\
**Created:** [May 20, 2020, 7:43am UTC](https://discourse.julialang.org/t/makie-3d-mesh-plot-is-not-as-good-as-before/39808 "2020-05-20T07:43:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![yusri-dh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yusri-dh/32/7404_2.png) [@yusri-dh](https://discourse.julialang.org/u/yusri-dh)\
**Post date:** [May 20, 2020, 7:43am UTC](https://discourse.julialang.org/t/makie-3d-mesh-plot-is-not-as-good-as-before/39808/1 "2020-05-20T07:43:04Z")

</div>

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,

```julia
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)

```

 ![bumpy_cube](https://global.discourse-cdn.com/julialang/original/3X/1/0/106e6d1dbf1c95d852a70f277aacbddedccdbca7.png)

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

 ![old_bumpy_cube](https://global.discourse-cdn.com/julialang/original/3X/1/3/13e584dc8bfdca76c62db3d3e042a71610c2cf07.png)

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

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [May 20, 2020, 9:48am UTC](https://discourse.julialang.org/t/makie-3d-mesh-plot-is-not-as-good-as-before/39808/2 "2020-05-20T09:48:50Z")

</div>

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:

```nohighlight
]add GLMakie#master AbstractPlotting#master

```

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [May 20, 2020, 9:57am UTC](https://discourse.julialang.org/t/makie-3d-mesh-plot-is-not-as-good-as-before/39808/3 "2020-05-20T09:57:30Z")

</div>

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

```julia
mesh(normal_mesh(shape) ,color=:red,shading=true)

```

---

<div class="post-metadata">

**Author:** ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)\
**Post date:** [May 20, 2020, 10:07am UTC](https://discourse.julialang.org/t/makie-3d-mesh-plot-is-not-as-good-as-before/39808/4 "2020-05-20T10:07:38Z")

</div>

You can also tweak the lighting qualities in the latest AbstractPlotting and GLMakie. See [the docs](http://makie.juliaplots.org/dev/lighting.html) for more details.

 ![shininess](https://global.discourse-cdn.com/julialang/original/3X/e/a/ea30c4e0d11a686b36cab9183888b98ed5236b42.gif)

```julia
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

```

---

<div class="post-metadata">

**Author:** ![yusri-dh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yusri-dh/32/7404_2.png) [@yusri-dh](https://discourse.julialang.org/u/yusri-dh)\
**Post date:** [May 21, 2020, 2:48am UTC](https://discourse.julialang.org/t/makie-3d-mesh-plot-is-not-as-good-as-before/39808/5 "2020-05-21T02:48:54Z")

</div>

Thank you, the GeometryBasics way is better in my case

---

<div class="post-metadata">

**Author:** ![OliverEvans96](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oliverevans96/32/4177_2.png) [@OliverEvans96](https://discourse.julialang.org/u/OliverEvans96)\
**Post date:** [November 16, 2020, 10:47pm UTC](https://discourse.julialang.org/t/makie-3d-mesh-plot-is-not-as-good-as-before/39808/6 "2020-11-16T22:47:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![OliverEvans96](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oliverevans96/32/4177_2.png) [@OliverEvans96](https://discourse.julialang.org/u/OliverEvans96)\
**Post date:** [November 16, 2020, 11:16pm UTC](https://discourse.julialang.org/t/makie-3d-mesh-plot-is-not-as-good-as-before/39808/7 "2020-11-16T23:16:24Z")

</div>

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

```julia
[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.

```julia
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

```
