Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with LineMaterial (and LineDashedMaterial)? #394

Open
nvaytet opened this issue Jan 17, 2023 · 2 comments
Open

Issue with LineMaterial (and LineDashedMaterial)? #394

nvaytet opened this issue Jan 17, 2023 · 2 comments

Comments

@nvaytet
Copy link

nvaytet commented Jan 17, 2023

I am trying to created a dashed line, as in this example.

Using LineBasicMaterial produces a solid line as expected:

x = [0, 10, 20, 30]
y = [0, 10, 0, 10]
a = array=np.array(
            [x, y, np.zeros_like(x)],
            dtype='float32').T

geometry = p3.BufferGeometry(
    attributes={
        'position':
        p3.BufferAttribute(array=a),
    })

material = p3.LineBasicMaterial(color='red', linewidth=10)
line = p3.Line(geometry=geometry, material=material)
line

Screenshot at 2023-01-17 14-08-53

However, when using either LineMaterial or LineDashedMaterial, no line is visible:

x = [0, 10, 20, 30]
y = [0, 10, 0, 10]
a = array=np.array(
            [x, y, np.zeros_like(x)],
            dtype='float32').T

geometry = p3.BufferGeometry(
    attributes={
        'position':
        p3.BufferAttribute(array=a),
    })

material = p3.LineMaterial(color=color, linewidth=10)
# material = p3.LineDashedMaterial(color='red', linewidth=10)
line = p3.Line(geometry=geometry, material=material)
line

Am I doing something wrong, or is it a bug? Thanks!

@nvaytet
Copy link
Author

nvaytet commented Jan 17, 2023

I also tried with LineGeometry, which shows nothing with LineBasicMaterial, and shows something strange with LineMaterial:

x = [0, 10, 20, 30]
y = [0, 10, 0, 10]
a = array=np.array(
            [x, y, np.zeros_like(x)],
            dtype='float32').T

geometry = p3.LineGeometry(positions=a)
material = p3.LineMaterial(color=color, linewidth=10)
line = p3.Line(geometry=geometry, material=material)
line

Screenshot at 2023-01-17 15-14-45

@vidartf
Copy link
Member

vidartf commented Feb 17, 2023

LineMaterial is an "extra" material, but it seems it only supports LineSegments2 (also extra). I see that a Line2 object was also started, but only supports Geometry for the geometry attribute. Please consult the ThickLines example as much as possible: it also outlines the shader that is used, and some of the options available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants