Parts of dashed line not rendering


i am trying to use dashed line with variable point density, e.g. different distances between points. Parts of line where the points are too dense is not rendering.
This PG demonstrates that:

I assume that this is currently not supported and dashed line looks good only when the points are placed regularly. Any hints how to ‘optimize’ the points so that they are not so dense on the curves?


You can change the dashNb, dashSize and gapSize parameters:

but I must say I don’t understand how they relate to each other (I’m not able to make the mesh look dashed when increasing dashNb, even when updating dashSize and gapSize…).

with less segments :

I guess that when the spline has very numerous tiny segments, some of them are tinier than the dashes themwelves so they can’t be drawn.

1 Like

Thanks, I was missing the nbPoints parameter of CreateCatmullRomSpline!

Yes, that is my understanding too, when the points are too close then the dash is not rendered because it doesn’t fit. I played with those 3 parameters (dashSize, gapSize and dashNb) and with number of points on the line itself and could not make it look good enough.
Dashed lines in three.js do not have such issue (three.js examples). Any idea how it works?

For now i am ‘optimizing’ the points array. I remove points whose Vector3.Distance is lower than some threshold and the result is good enough.

As I understand the 3JS dashed Lines rely on a dedicated material (so shader). It’s a standard line rendered with a shader that draws the dashes.

In BJS, the dashes are computed at the geometry level. That’s the main difference.

In 3JS the dashed lines may be better because it’s geometry independent, so no need for tweak segment numbers/ dash nb or size. But you don’t have the choice of the material.
In BJS, you can use any material then with your dashed lines … once you get the right tweaking for complex curves :wink: