# Overlapping 3d lines in glmakie not drawing as expected

**URL:** https://discourse.julialang.org/t/overlapping-3d-lines-in-glmakie-not-drawing-as-expected/81031
**Category:** Visualization
**Created:** [May 13, 2022, 4:17pm UTC](https://discourse.julialang.org/t/overlapping-3d-lines-in-glmakie-not-drawing-as-expected/81031 "2022-05-13T16:17:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![brianguenter](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brianguenter/32/29519_2.png) [@brianguenter](https://discourse.julialang.org/u/brianguenter)
#### Post date: [May 13, 2022, 4:17pm UTC](https://discourse.julialang.org/t/overlapping-3d-lines-in-glmakie-not-drawing-as-expected/81031/1 "2022-05-13T16:17:17Z")

</div>

```julia
using GLMakie

GLMakie.activate!()

function mwe_segments(step_size)
    fig = Figure()
    ax = Axis3(fig[1,1],viewmode = :fit, aspect = (1.0,1.0,1.0))
   
    for y in -10:step_size:10
        lines!(ax,[SVector(0.0,y,0.0),SVector(10.0,y,0.0)], color = "black")
    end
    display(fig)
end

```

set `step_size` to one and you get a set of nicely spaced black lines.

 ![Screenshot 2022-05-13 093352](https://global.discourse-cdn.com/julialang/original/3X/f/9/f9b723255ed74058456c74ca29d999999700e7bd.png)

Set `step_size` to .1 and you get this:

 ![Screenshot 2022-05-13 093859](https://global.discourse-cdn.com/julialang/original/3X/0/a/0a72aeb6ce7ba9a0d763273b17f90d5e9562ac15.png)

Set `step_size` to .01 and you get this:

 ![Screenshot 2022-05-13 093242](https://global.discourse-cdn.com/julialang/original/3X/e/e/eede2db087d1104b1d4c84bd79988847e9573aa8.png)

As the lines overlap more and more I would expect to see an area of solid black. But instead this area is now almost white. It’s opaque as well; objects behind the lines won’t show through. This looks like an anitaliasing problem, or perhaps a zbuffer precision problem.

I tried setting fxaa both true and false but it doesn’t make a difference. Is there a way to fix this?

---

<div class="post-metadata">

### Author: ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)
#### Post date: [May 14, 2022, 4:04pm UTC](https://discourse.julialang.org/t/overlapping-3d-lines-in-glmakie-not-drawing-as-expected/81031/2 "2022-05-14T16:04:58Z")

</div>

Try `transparency=true` … It may give you other artifacts, but that makes the aa “border” truly transparent, while with `transparency=false` it will be opaque to lines behind it.  
Also, really use `linesegments!`… `lines!` is incredibly slow for many separate 2 point lines.

```julia
function mwe_segments(step_size)
    fig = Figure()
    ax = Axis3(fig[1,1],viewmode = :fit, aspect = (1.0,1.0,1.0))
    segments = Point3f[]
    for y in -10:step_size:10
        append!(segments, [Point3f(0.0,y,0.0),Point3f(10.0,y,0.0)])
    end
    linesegments!(ax, segments, color = "black", transparency=true)
    display(fig)
end

```

---

<div class="post-metadata">

### Author: ![brianguenter](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brianguenter/32/29519_2.png) [@brianguenter](https://discourse.julialang.org/u/brianguenter)
#### Post date: [May 14, 2022, 11:45pm UTC](https://discourse.julialang.org/t/overlapping-3d-lines-in-glmakie-not-drawing-as-expected/81031/3 "2022-05-14T23:45:40Z")

</div>

Thanks, that looks much better.
