rdeits / MeshCat.jl

WebGL-based 3D visualizer in Julia
MIT License
233 stars 42 forks source link

Setting a custom line width is no longer working #246

Open ferrolho opened 1 year ago

ferrolho commented 1 year ago

While sanitising the list of open issues, I noticed that setting a custom line width is no longer working.

Here is a simple snippet for displaying a line through a set of random points:

using Colors
using MeshCat

vis = Visualizer()
open(vis)

points = [rand(3) for _ = 1:100]
pointcloud = PointCloud(points)

material = LineBasicMaterial(color=colorant"yellow", linewidth=8)
setobject!(vis, Object(pointcloud, material, "Line"))

which results in the following:

image

Notice how the width of the rendered line is 1 despite setting linewidth=8.

julia> versioninfo()
Julia Version 1.9.0
Commit 8e630552924 (2023-05-07 11:25 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 8 × Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
  Threads: 1 on 4 virtual cores
ferrolho commented 1 year ago

Hmm, apparently this is not going to be fixed for GL — see https://bugs.chromium.org/p/chromium/issues/detail?id=675308.

But there is an example with another way of achieving line thickness: https://threejs.org/examples/#webgl_lines_fat

ferrolho commented 1 year ago

I've included and exported Line2, LineMaterial, and LineGeometry in https://github.com/ferrolho/meshcat/commit/8fdb46b5ec4cd84d266ebe29b277a1fe7e8ad32c, but I am not sure if that is the proper way to do it. And to be honest, I have no idea what to do next on the MeshCat.jl end... For example, I suppose we need to define a Julia struct for LineGeometry in src/geometry.jl, right?