0 votes

I'm trying to find a way to draw 3D lines with variable thickness, without impacting performance too much. I don't want to resort to a bunch of Sprite3Ds or something, because I feel like that would be really laggy. Right now I'm using ImmediateGeometry, but it's limited to only 1px thickness. I'll take pretty much any solution. It doesn't have to be a perfect line, it doesn't have to be affected by lighting or anything. It just has to look like a line that's wider than 1px.

Godot version 3.2.3
in Engine by (106 points)

Can't you set the Spatial.scale property to make the ImmediateGeometry line wider?

That won't work – line width is not affected by the Spatial scale property.

1 Answer

0 votes
Best answer

There are a few solutions here. One of them is to use a MeshInstance that contains a CylinderMesh with a low number of subdivisions (4-12 depending on the maximum expected thickness). You can change its scale as desired to make lines thicker or longer.

You can assign any kind of material you want to the MeshInstance in question.

by (10,303 points)
selected by

Would that be very laggy? I'm gonna have a lot of lines, so performance is a pretty big concern of mine

Thank you for your comment! I tried it, and it turns out it's not nearly as much of a hit to performance as I thought it would be. It took me a while to get it to work right, but I'm really happy with how it looks now.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.