Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add glLineWidth to ImmediateGeometry #2490

Closed
lmcdd opened this issue Mar 21, 2021 · 4 comments
Closed

Add glLineWidth to ImmediateGeometry #2490

lmcdd opened this issue Mar 21, 2021 · 4 comments

Comments

@lmcdd
Copy link

lmcdd commented Mar 21, 2021

Describe the project you are working on

Similar BlockOut

1111

Describe the problem or limitation you are having in your project

There is no possibility to set line thickness

Describe the feature / enhancement and how it helps to overcome the problem or limitation

It will be possible to set the line thickness

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

ImmediateGeometry.set_line_width(thickness)

If this enhancement will not be used often, can it be worked around with a few lines of script?

I do not know how

Is there a reason why this should be core and not an add-on in the asset library?

it is logical if the possibility from GL will be in Godot

PS: excuse me for my level of english

@lmcdd lmcdd changed the title add glLineWidth to ImmediateGeometry Add glLineWidth to ImmediateGeometry Mar 21, 2021
@Calinou
Copy link
Member

Calinou commented Mar 21, 2021

OpenGL line width isn't reliably supported across platforms – for instance, AMD GPUs will ignore it and treat it as if it was always 1. Even on other GPUs, it can be limited to a low value like 5, which limits its usefulness on hiDPI displays or at high resolutions in general (such as 4K).

The "proper" fix is to render lines as triangle strips. It was done in 2D by godotengine/godot#43828, but it needs to be implemented in 3D as well.

@Calinou
Copy link
Member

Calinou commented Apr 11, 2022

Closing, as there are no plans to implement this per the above hardware limitations. It's important for Godot to look as identical as possible on various GPUs, so OpenGL line width won't be exposed.

If you want to draw thick straight lines in 3D space, you can use stretched MeshInstances with CubeMeshes or CylinderMeshes. In 2D space, you can use a Line2D node (or AntialiasedLine2D add-on if you need antialiasing).

@Zireael07
Copy link

@Calinou: What about the workaround you mentioned above, "lines as triangle strips"?

@Calinou
Copy link
Member

Calinou commented Apr 11, 2022

@Calinou: What about the workaround you mentioned above, "lines as triangle strips"?

I think this depends on #112 first, as there is no quick way to draw hardware-based lines in 3D right now. You can use procedural mesh generation and Mesh.PRIMITIVE_LINES, but it's not something most people think about.

Also, in a game, using particle trails is likely a better idea as it's far more flexible. Hardware line drawing is best reserved to debug tools, where antialiasing is not critical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants