Best way to draw dashed lines/curves in 3D

harpyeagleharpyeagle Posts: 5Member

Hi, I have a project where a lot of the GUI will consist of lines drawn in 3D. These in include straight lines as well as elliptical and parabolic curves (think celestial orbits).

There will be lots of different lines so I don't want to have to differentiate them with color alone, but also be able to vary line thickness and use dashed/dotted lines.

I've looked into using Immediate Geometry to draw lines, but it seems very limited. For one, while I am able to change the emission color using a material, I cannot figure out a way to vary the length of the lines.

Furthermore, the only way to draw dashed lines with Immediate Geometry seems that you need to create an node for every single dash. I am worried that this will not scale, both in terms of performance, and literally, the dash pattern does not scale if the camera zooms out, instead becoming hard to see.

I need to use 3D curves as I want to render elliptical lines while allowing the user to orbit the camera around to see them from different angles. What is the right approach here? Is Godot the right tool for this job, or should I consider something else?

If the answer involves writing shaders I would appreciate if someone outlined the general approach, as I have very little experience with shaders.

Thanks.

Answers

  • ZireaelZireael Posts: 81Member

    ImmediateGeometry looks bad when far away, plus will not let you do the dashes. Maybe a Polygon2D with a texture?

Sign In or Register to comment.