How do I make a dashed line SOP?

image

I’d like to make a simple point A to point B straight line SOP, but I’d like it to render like a dashed line with configurable thickness (a la Wireframe MAT Line Width parameter).

image

I’m thinking, if the Line SOP has 20 segments, and every second segment is deleted, it would give a dashed line. Or something like that… Is there a way to do this easily?

My priority is the appearance of a dashed line, not the geometry, so if it’s easy to do with a MAT, that would work for me also.

there are some different solutions to be found if you search the forum for “dashed”, here’s one:

Thx for the pointer!

I ended up using a modified solution from that thread, where you first split up the line into many segments, group half of them in sets, set the group’s alpha to 0, and use a wireframe material to set thickness. I don’t think wireframe would work as a MAT on SOPs that aren’t a straight line though, which is why the other thread probably used the Constant or Line MATs.

For anyone in the future who might care to see, here’s my tox:

dashed-line-basic.tox (7.8 KB)

For what it’s worth, I’d still be interested to see if anyone knows of a way to ‘dash’ at the SOP level, rather than the material level, as I noticed that the dashes are filtered/soft, and if it was the actual geometry that was dashed, the dashes would have perfect hard ends. Notice the fade/black on each dash here:

Made something quick that seems to be doing what you’re looking for with some extra control:

Here’s the network:

  • SOP using just 2 points A to B
  • render it out (lately i’m always using the “cameraViewport” (see the pallete) camera as it allows you to easily and interactively set the camera…)
  • Use const MAT that allows you to set a color map => just start from a patternCHOP and convert to the TOP domain + in the MAT’s common page set Wire frame and start playing with the line width

While wrinting this answer i notice a similar softening when zooming in on the dashed line. However, by increasing the pattern Length parameter this effect is reduced significantly.
=> added a second solution in the .toe that eliminates the softening by doing everything in the SOP domain using some convertSOPs and a joinSOP that joins by groups of N premitives… This allows you to use the line MAT and set the line width from there

dashedLineSOP.7.toe (25.1 KB)

Hope this helps :slight_smile:

Thanks for taking a stab @ab_out

Since you’re using a color map in the first solution, you can actually just change it to use Nearest Neighbor filtering, which takes care of the softness:

image

Your second solution, however, is exactly what I was hoping for! Thanks :pray:

1 Like