[vtk.js] LineWidth with vtkLineSource

I am currently unable to adjust the line width of an actor with vtkLineSource. Is there something I am missing? Are there perhaps no line cells?

(psuedo-ish code)

lineSource = vtkLineSource.newInstance();
lineActor = vtkActor.newInstance();
mapper = vtkMapper.newInstance();
lineActor.setMapper(mapper);
mapper.setInputConnection(lineSource.getOutputPort());

lineSource.setPoint1(...)
lineSource.setPoint2(...)

then try to set the line width on the actor

p = lineActor.getProperty()
p.setLineWidth(10)

and there is no observable change after re-rendering

1 Like

WebGL does not support line width. Firefox may do, but the spec does not enforce that support.

1 Like

Technically webgl does support line width but it is legal for a driver to set the maximum and minimum width to be 1.0 which some drivers do. So you can have wide lines as long as their width is 1.0 :slight_smile: On desktop we catch this case and convert lines to triangles which we reposition using a geometry shader etc. It is a lot of work.

1 Like

@banesullivan Iā€™m wondering what did you end up doing for having a thicker line?

I can think of using a cylinder source instead, but it cannot be dashed !

I used a tube filter and varied the radius with how thick I wanted the line to be

2 Likes

Thick/Wide lines have been implemented in v24.1.0

1 Like

@finetjul, would you provide an example or link to one in the docs?

The Actor2D example uses a linewidth of 3

Hi, thanks a lot for implementing this feature. I found it very useful. This increased the width of my visualization CPlantBox Web Assembly.
Just wondering, is is now possible to make each line with different linewidth?

No, currently, the line width is an actor property.

Thanks a lot for the reply. Looking forward to the future developments. :smiley: