# NodeMatterial to display same width / dimension on axis despite zoom or ortho settings

Hi

i’m looking for help finding or creating a NodeMaterial that, if applied to a Mesh, Line, or Ribbon fixes the visible dimension on one axis to a specific value (initial or provided).

I believe that it should be fairly simple - i just don’t got any clue where to start.

For now i got a fairly simple and inperformant solution, recreating the mesh with different dimension set on the fixed axis.

The goal is to display a Mesh / Ribbon or GreaseLine always with the same thickness, regardless of the zoom (camera distance or ortho settings if set).

I’d be happy if someone can point me to a similar NodeMaterial or even helps creating one :).

Kind Regards,
Max

@MaxOSchulte, can I ask a few questions about your problem for context? This will help me understand the correct solve for you.

1. How are you using these lines in your scene? Are these for illustration purposes like pointing to a specific area of interest?

2. Why do you need to render them at a consistent thickness in the scene? Originally the problem seems to want to be solved with a GUI approach which always renders your lines at a specific thickness, but what does your scene require that means your lines need to be in the scene in world space?

3. Are these lines primarily straight or do you also have curved lines? Do any of the lines curve enough to change the vector back toward the start like a sine wave or circle?

4. Are you using these lines in some sort of assembly like stacking them to create a pseudo wireframe for an object like a cube?

You have already run into the biggest issue with keeping the lines of a consistent thickness regardless of camera distance which is that the mesh needs to change based on the distance to camera. This means creating a system to displace vertices perpendicular to the line’s direction in both directions based on camera. If the line curves or changes direction sharply, you could end up with rendering artifacts with vertices overlapping others in the same line. We also need a way to differentiate the direction that the vertices are offset based on which side of the line they sit. This may need something like vertex color assigned to the vertices to give the shader the correct information for displacement.

It’s not as simple as you originally imagined mostly because the more things the line needs to do like change direction will quickly complicate the process to prevent artifacts. The simplest solution is to draw your lines in a GUI layer but I am unsure as to your limitations for your project.

1 Like

The lines are connecting different kind of objects and there different kind of lines. All lines together form a map. Object can be placed on specific lines, via drag’n drop. When placed on such line, the object is centered and positioned in a specific way depending on the line orientation, length and other objects.

The maps can become very large, but the lines should be clearly visible at all zoom stages. They should neither be very bold or thin at any stage.

There is a hierarchical structure to the lines and objects. Some of them are linked directly - so if i move a part it effects the other parts. Some of them are linked loosely with another indicator.

The lines are not curved but can change direction, like one or more corners.

There are different modes to view the map, one to place objects and interact with objects. The other mode is to edit the map.

The formed map is viewed top down in an orthographic view / camera. The ortho is changed to zoom in or out.

There is also text connected to objects, lines etc.

The image shows a small part. Some placeholders for infrastructure etc. If i would hover a black line, it whould show a highlight and is interactable (drag’n drop, app commuinications etc.) On Grey

In edit more i can change the black lines (split, move, move parts etc.) the grey lines connect and move automatically.

I hope the explanation helps.

@MaxOSchulte I can see why you want to be able to keep this in mesh in the scene. With that in mind, I did a super simple example to get you started, but it’s very rudimentary and you will need to expand on it to make it better.

I am also using node geometry to create the line mesh so that I can set vertex color when the mesh is created. This way I know which vertex needs to be displaced in which direction. You will need to do that as well with your solution as the shader will have a hard time knowing which vertex to offset in either direction. Hope this helps get you started.

2 Likes

Thank you very much, I got time this week to do some work on this issue. Maybe i can come up with a complete solution.

1 Like