Just a Line TOP

A fast and simple TOP to draw a line would be super useful!

Param could be :

  • start x, start y, end x , end y (in pixel, fraction, fraction aspect)
  • thickness, color …

It would be so convenient in many situations and avoid to trick, complicated and/or slow network (with line SOP, GLSL, rectangle…) for this very basic object.

Thank you


Well using the line SOP is pretty easy if you have not tried that. Of course you need a Geo on output to render etc… but it is pretty fast.

Agreed, a line TOP would be very nice to have!

Some bonus features it could have:

  • per point thickness
  • end caps (eg. arrows)
  • ability to add more than 2 points
  • ability to close the shape if more than 2 points
  • ability to make it be a curve if more than 2 points
1 Like

Yea, right, it’s one technic I could use in replacement as well, but coming to the optimization, I find this costly ( CHOP > SOP > GEO > TOP render) compared maybe to a pure TOP treatment in one native operator. There are few other technics like rectangle TOP (but imply coordinate calculation), or GLSL.

I would imagine a TOP native operator would be much more simple (for sure), and maybe really faster.

would be interested in the derivative team opinion about this ‘speed’ question

1 Like

Yeah you are right - a line TOP would be very useful, in thinking more about it. Anything that eases friction and speeds up prototyping is always good. If I had it I would use it for sure.

I think it depends a bit on how many lines you want to draw… if it’s alot, I think the instancing approach (instancing 1 lineSOP with 2 points and transform/rotate/scale it in the way you want, though this might need some chop network to calculate the rotation angles). Then rendering it with an orthographic camera… this all sound like alot, but is super fast and you’re able to instance thousands of lines…

However if you just want to draw 1 or 2 lines, might be indeed a bit of an overkill. Perhaps a rectangleTOP would already be sufficient. Setting the height to the thickness of the line and rotating it.

I made a little glsl shader that loops through a chop to draw the lines, though this is not super fast when you have many lines. But anyways maybe it’s useful in your case.

LineTOPExample.tox (1.6 KB)


I like Tim’s example better but this is a sopRender from the palette hacked to render lines with the Line MAT, fed with any SOP. You can mod the Line MAT inside, or put a Line MAT on the outside and assign to the Material, and mod any of its pars.

lineRender.tox (16.8 KB)


thanks I will try it out!

Just did - great interactivity! Nice work!

1 Like

Thanks Greg - I will try this out too.

Cool example Tim :slight_smile: Fun to draw shapes with it as well.

LineTOPExample_shape.tox (2.8 KB)

I could probably be more intelligent about which points should connect to which, but this works simple things.

1 Like

niiice gabe! Got me inspired as well :smiley:

I’ve made a slight update to the lineTOP component so it can read 2 thicknesses and 2 colors (begin and end part of the line segment). So more continuous shapes can be drawn :slight_smile:

LineTOPExample_shape.2.tox (3.1 KB)


Great .TOXs everyone, although arguably a bit off topic as the original RFE is looking for a one-OP solution that’s congruent to the existing Rectangle/Circle TOPs.

This RFE, in my opinion, is especially pertinent to TD newcomers to whom a narrow-function OP is a lot more easy to get into than a COMP/palette with a bunch of stuff inside it.


One OP - Sure, but what’s the actual scope of the request? the first articulation from Louk was a slightly modded Rectangle TOP . But is it:

one line, a few lines, hundreds or a million lines? -The solution for one isn’t the solution for many.

How do you want to edit them - with parameters for each line, with Spec DATs/CHOPs, or interactive editors?

Straight lines or bezier curves or … ?

Textured lines / ramps, with UVs, and UV assignment? Depth layer? Outlining of fonts?

hahaha :smiley:

amazing :heart:

1 Like

Using basic Adobe Illustrator tools as an analogue, here are things I can rasterize easily in TD as a beginner:

  • Square/rectangle, incl. rounded corners
  • Circle
  • Polygon

Things I cannot easily rasterize in TD as a beginner (arguably, as I know anything is possible, but I’m talking about just opening the program, plopping down an OP, and having ready-to-go raster/pixels):

  • Line segment by setting a start and end point
  • Simple curve (bezier, nurbs, whatever)
  • Connected multi-segments, smoothed or not

As mentioned, anything is doable, the toxs above are amazing, and a few weeks ago I personally programmed a drawing program that smooths mouse input into continuous curves with line mat and render top etc. But that’s not the use case of the RFE I think. I’m thinking more along the lines of generating a line as easily as I might the first four examples.

For a single line segment, something equivalent in user-friendliness to the Rectangle TOP may be an ability to set point A’s X and Y as a fraction, and point B’s X and Y as a fraction, and a stroke weight. For a single curve, maybe add a curvature (positive/negative) par.

For a multi-segment op, maybe take a cue from the Add SOP where you can keep adding points, and then they just connect in order, with an option to close the loop, and an option to smooth it using some logic like bezier.

My use case, and this is just anecdotal, is sometimes I want to add a line or an arrow or something in my GUI. At other times, I want to generate a simple shape to use with an Extract SOP to make a wall Geo. Pretty much I would only ever need two or up to a handful of points.

Hopefully that illustrates better where I’m coming from. Not trying to campaign, just don’t want Infratonal’s RFE to get perceived as ‘solved’ by the amazing TOXs, when I think they’re addressing different use cases.

I personally think this gets very complex very fast. If I may add my 2 cents - don’t feel like single TOP would be a good solution for this. Possible use cases for lines / shapes are huge - just like @greg outlined in previous post. Making line between point A and B sounds simple, but it solves just one scenario out of many.

If one would like to draw shapes and stuff, why not open something like Houdini, create geometry there (using their nice Curve SOP), save and open it in TD? I feel like this is much more flexible.

Sure, it takes some time to jump into Houdini and back, but it opens up a lot of possibilities right? I feel like it’s important to have nodes that do one thing really well (which is what Curve SOP does in Houdini), rather than trying to cover all line-related (and line-rendering-related) problems in single TOP.

1 Like

But then why not just jump into Houdini (not a free program, at least not for commercial projects) to make rectangles and circles as well? I jest, but I would say that the existence of a nice Curve SOP in Houdini speaks to the usefulness of having just such an OP in TOP space in TD.

I think the intention of the RFE (correct me if I’m wrong @Infratonal) is to make standalone TD more able to generate common things along the line of the already-available basic shape TOPs. I would argue that an A to B Line TOP with a couple pars for stroke weight (incl variable weight) and a par for curvature would solve much more than one scenario, just as the Rectangle and Circle TOPs do.

It is entirely possible that I am missing the plot as to where in TouchDesigner’s lifecycle we are. At some point in its history, the basic generator TOPs were done being added, and there haven’t been any new ones in a while, so most RFE/beginner posts are met with multi-OP solutions/TOXs. Perhaps someone from Derivative can let us know whether the team feels that TD already has all the basic generator TOPs it’ll ever have, or if there’s room for more? And if so, on what basis is usefulness evaluated so as to eliminate personal bias (of which I am full!)

I should add that I really appreciate everyone’s comments/discussion. I love hearing where other people are at in regards to this kind of thing :raised_hands:


I understand and fully agree. But there are hundreds of these cases where community created assets can solve a problem but are not easily accessible and provide a different workflow than the native OPs

So maybe it would be a better idea to invest dev time into a workflow that allows user generated COMPs to mimic a selectable (top, chop, sop, dat) op family.

They could look and behave like a native node, I.e. can be displayed the the appropriate viewers based on their flags, show up in the TAB menu, …?

1 Like

Yes, good discussion. To answer your question about “Are we done with adding new TOPs?” (chuckle), definitely not. I was just on a call discussing TouchDesigner architecture where they reminded me that I likened the OP families to the chemical Periodic Table of the Elements. Each element is unique and not replaceable by any other element. And you build useful compounds by combining these unique elements together in to molecules (components in TD-land).

That may suggest that there’s an end to it. But we shift out in two ways - entirely new elements (like the Open Color IO TOP), or, breaking the paradigm judiciously to make life massively easier, like the JSON DAT (which can be done with a lot of other DATs combined).

So we will add native TOPs that fill in gaps, expand capabilities and are time-savers. We just need to be very careful it doesn’t get out of control. The issues of this Line/Curve TOP discussion has been on my mind for years, complicated by the wish to alternately gesture/draw them and consideration of how out of control it can get as the number of lines increases, and how far you can go with parameters, and the pros and cons of using Specification DATs with drawing lots of text in the Text COMP and Geo Text COMP.

Achim’s comment about making user-created and Derivative-created COMPs to feel like (and be accessible like) native OPs is on point. I agree. We’re working toward that.