3d bars makie, colors and meshes

Oh sorry, I read over that part. I don’t think you can get that with meshscatter right now.

With mesh you could use mesh!(ax, recmesh; color=last.(coordinates(recmesh)), colormap = :Spectral_11, colorrange = (0, 1), shading=false) but that just intepolates between two colors:

Alternatively you could work with a texture similar to Issues · MakieOrg/Makie.jl · GitHub

function test3dBars()
    x = y= 1:10
    z = rand(10,10)
    δx = (x[2] - x[1]) / 2
    δy = (y[2] - y[1]) / 2
    cbarPal = :Spectral_11
    texture = reshape(get(colorschemes[cbarPal], 0:0.01:1), 1, 101)
    fig = Figure(resolution=(1200, 800), fontsize=26)
    ax = Axis3(fig[1, 1]; aspect=(1, 1, 1), elevation=π / 6, perspectiveness=0.5)
    for (idx, i) in enumerate(x), (idy, j) in enumerate(y)
        rectMesh = FRect3D(Vec3f0(i - δx, j - δy, 0), Vec3f0(2δx, 2δy, z[idx, idy]))
        recmesh = GeometryBasics.normal_mesh(rectMesh)
        uvs = [Point2f(p[3], 0) for p in coordinates(recmesh)] # normalize this so zmax = 1
        recmesh = GeometryBasics.Mesh(
            meta(coordinates(recmesh); normals=normals(recmesh), uv = uvs), 
            faces(recmesh)
        )
        mesh!(ax, recmesh; color=texture, shading=false)
    end
    fig
end
test3dBars()

A way to merge all Rect3 meshes?

GeometryBasics implements merge(meshes)

2 Likes