Midez
March 2, 2024, 3:46pm
1
Minimal example with a dummy mesh
using Makie, GLMakie, FileIO
msh = load("~/TestMesh.stl")
fig = Figure(resolution = (1920,1080))
axe = Axis3(fig[1, 1])
mesh!(msh, transparency = false, overdraw = false, shading = true)
wireframe!(msh, color = :red, transparency = true, overdraw = false)
hidedecorations!(axe)
display(fig)
What I get is the following
Here some weird artifacts are visible.
Actually what I want is similar to the generated file with this Matlab-Code
P = stlread('~/TestMesh.stl');
trimesh(P,'EdgeColor','r')
hold on
trisurf(P,'EdgeColor','none','FaceColor','c')
axis off
lightangle(-45,30)
lighting gouraud
Here the geometry is drawn nicely.
So can this style be adapted in Makie?
mkitti
March 2, 2024, 5:18pm
2
Is TestMesh.stl available somewhere?
Set color
for the mesh plot to something opaque. The default has some transparency
1 Like
jules
March 2, 2024, 8:11pm
4
That default was only meant for 2d shapes overlapping. We should think about changing it for meshes, in 3D transparency has a couple problems
2 Likes
Midez
March 2, 2024, 9:12pm
5
Just for your interest - here is the file I’m Testing with
Midez
March 2, 2024, 9:13pm
6
Aw, thats’s unfortunate. But big up for your work so far!
jules
March 3, 2024, 1:07pm
7
With an opaque cyan and black lines it’s much closer to your matlab example, although the default light doesn’t come from the front anymore:
mesh!(msh, transparency = false, overdraw = false, color = :cyan)
wireframe!(msh, color = :black, linewidth = 0.5)
hidedecorations!(axe)
fig
And if the directional light comes from the front it looks even closer:
fig = Figure()
axe = Axis3(fig[1, 1])
axe.scene.lights[2].direction[] = Vec3f(0, 0, -1)
mesh!(msh, transparency = false, overdraw = false, color = :cyan)
wireframe!(msh, color = :black, linewidth = 0.5)
hidedecorations!(axe)
fig
3 Likes
It seems that Matlab’s mesh lines are much sharper, though.
1 Like
jules
March 3, 2024, 1:20pm
9
with fxaa = true
on the wireframe it seems a bit better, but I still sometimes think our problem is that we draw the lines in a separate pass than the mesh. I assume matlab does it in one go
2 Likes
Midez
March 3, 2024, 7:10pm
10
awesome, this is still looking really nice and is exactly what I want! Thx