Line Mat Width affects the line length?


I am controlling the line width with the slider by using “chopto SOP”. But if I make the line thicker, the line length is also getting longer in the final out TOP. I am wondering if this is normal. If not, how can I fix the line length? Thank you so much.

myLineswidthQ.toe (6.0 KB)

On the Line Page you can set the Caps = None, the caps increase in size with the width so they are what you see changing the length of the line.

Thank you so much @ben

BTW, I wonder if there is an absolute value for the line width? For example, in Processing, if I set up the line width as 2pt or 2px, this is an absolute value. But in TD, I can see the Width Near and the Width Far in the line MAT and I can even control the width by sending “width” channel to the “chopto SOP”.

My slider in the file moves from 0 to 20, and the line width seems to have relative relationship depending on the Width Near and Far values. If I want to change the line width only with this slider, how should I set up the Width Near and Width Far? FYI, I am drawing 2D-like shapes so I won’t need two different width setting like “near and far”. Thank you so much and please let me know if my question doesn’t make sense.

Near and Far are only for differences in width from distance to camera, so in your 2D context they will not matter. You can pick a middle value or normalize to 1.0 and just use “width” channel in your case.

As for setting up a absolute value, I think you might need to go with a Orthographic view and camera to get that. I haven’t played with that myself but that it what I’d attempt first, Orthographic camera can set Orthowidth giving you something consistent to work with. Note the camera in TD does not have pixel settings, that is controlled in the Render TOP, so you’ll need to normalize your system each step of the way to get specific pixel sizes.

If anyone here has experimented with this, let us know your results.

From the wiki for Line MAT:

Line Width is a resolution-independent quantity. A line width of 1 will draw a line that is 1/1000 the width of the image. This is true when used with orthographic cameras and perspective cameras.

To make the width of a line and its points vary per-point of a SOP, the width can be set by adding a point attribute width on the SOP being rendered. A value of 2 scales the width at that point by 2 times its normal width. New point attributes can be created with the Point SOP Custom page. To affect per-point width and not affect the line width, use the point attribute pscale.

When you are animating Ortho Width or Field of View, you may want line widths to adjust more realistically. When the parameter “Width Affected by FOV/Ortho Width” is on, the behavior is different: For Ortho cameras, the drawn line width increases when Ortho Width drops below 1, (as if you are zooming into it), and decreases when Ortho Width increases above 1. For Perspective cameras, the drawn line width increases when Field of View drops below 90 degrees, and decreases when Field of View increases above 90 degrees. Note that when the parameter “Width Affected by FOV/Ortho Width” is on, lines are still resolution-independent.

You also asked about why the line gets longer when you make the width larger. While it’s true that setting End Caps to None gets rid of this problem, using the parameters Start Caps Pullback and End Caps Pullback is better. From the wiki: "By default (0), the start cap goes beyond the start point of the line so that the center of a circular startcap is right at the start point. Setting this to 1 makes the tip of the end cap positioned exactly at the start point. "

Just adjust their values to see what they do.

Thank you so much @ben for your help. Before I dive into “orthographic view” mode, I first normalized “width near” and “width far” by following you. Do “Distance Near” and “Distance Far” matter to my situation? Do you think I need to normalize them as 1 too?

If I switch to “orthographic view” in camera, the magenta dot following the line is not fully visible when it is positioned at the edge of the line. In this case, do I have to stick with “perspective” mode or is there another way to avoid this? If I slightly increase the Ortho Width value, I am able to zoom out, but I can’t find out it is a smart choice. Thank you very much.

This (Start/End Caps Pullback) beautifully works too. Thank you so much.