# Dashed Line2 Material

**URL:** https://discourse.threejs.org/t/dashed-line2-material/10825
**Category:** Questions
**Tags:** lines
**Created:** [November 14, 2019, 4:04am UTC](https://discourse.threejs.org/t/dashed-line2-material/10825 "2019-11-14T04:04:08Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ryki](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/ryki/32/4710_2.png) [@ryki](https://discourse.threejs.org/u/ryki)
#### Post date: [November 14, 2019, 4:04am UTC](https://discourse.threejs.org/t/dashed-line2-material/10825/1 "2019-11-14T04:04:08Z")

</div>

Does dashed lines work the the line2 material. It seems to have parameters for dashed lines but it isn’t working for me. Any ideas?

```auto
import { LineMaterial } from "three/examples/jsm/lines/LineMaterial.js";
const lineMat = new LineMaterial({
    color: 0x0000ff,
    linewidth: 3,
    dashed: true,
    dashSize: 5,
    gapSize: 5,
    dashScale: 1,
});
lineMat.resolution.set(window.innerWidth, window.innerHeight);

```

Or have a look at the lines.js file in this codesandbox

> **[Three - lines - CodeSandbox](https://codesandbox.io/s/three-lines-u1jfq)**
>
> The online code editor tailored for web applications

---

<div class="post-metadata">

### Author: ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)
#### Post date: [November 14, 2019, 11:34am UTC](https://discourse.threejs.org/t/dashed-line2-material/10825/2 "2019-11-14T11:34:52Z")

</div>

Dashed lines only work if you call `Line2.computeLineDistances()` and if you enhance the line material by an additional define `lineMat.defines.USE_DASH = "";`. I know manually adding such code is hacky, but please read this [comment](https://github.com/mrdoob/three.js/blob/22ed6755399fa180ede84bf18ff6cea0ad66f6c0/examples/webgl_lines_fat.html#L236-L239) for more information.

> **[Three - lines - CodeSandbox](https://codesandbox.io/s/three-lines-2c7xb)**
>
> The online code editor tailored for web applications

---

<div class="post-metadata">

### Author: ![ryki](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/ryki/32/4710_2.png) [@ryki](https://discourse.threejs.org/u/ryki)
#### Post date: [November 14, 2019, 3:22pm UTC](https://discourse.threejs.org/t/dashed-line2-material/10825/3 "2019-11-14T15:22:39Z")

</div>

Ok, fair enough. Thanks for your help!
