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

CanvasItem.draw_multiline width and antialiasing not functional #16448

Closed
Freakmiko opened this issue Feb 6, 2018 · 15 comments
Closed

CanvasItem.draw_multiline width and antialiasing not functional #16448

Freakmiko opened this issue Feb 6, 2018 · 15 comments

Comments

@Freakmiko
Copy link

Godot version:
v3.0-stable_win64

OS/device including version:
Windows 10 Pro x64

Issue description:
When drawing multiple lines with the CanvasItems draw_mutliline(), the width is not taken into account. All lines have a width of 1 even though a width > 1 was given as a parameter. The same holds true for antialiasing.

Steps to reproduce:

  1. Create a Node2D
  2. Attach script to node that attempts to draw lines with draw_multiline() and a width > 1.0 and antialiasing set to true.

Minimal reproduction project:
Multiline.zip

@ghost ghost added bug topic:core labels Feb 6, 2018
@ghost ghost added this to the 3.1 milestone Feb 6, 2018
@ghost
Copy link

ghost commented Feb 7, 2018

Here's the method where the arguments passed are ignored.

void VisualServerCanvas::canvas_item_add_multiline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width, bool p_antialiased) {

@akien-mga akien-mga modified the milestones: 3.1, 3.2 Jan 19, 2019
Calinou added a commit to Calinou/godot that referenced this issue May 14, 2019
This makes it clear that line width and antialiasing in
`draw_multiline()` aren't implemented yet (see godotengine#16448).
kiku-jw added a commit to kiku-jw/godot that referenced this issue May 16, 2019
* [TileMapEditor] Improve tool picking usability

When KEY_CONTROL is released, go back to the last tool.

Also add a tooltip for paint button with shortcuts for line draw and
rectangle paint.

* Make buttons that trigger popups have the same scale

* Make 'Line/TextEdit's context menus hide their editing options when in readonly mode

Fixes godotengine#28243.

* Renames captions of Scalar/VectorInterp in Visual Shaders

* Warn when opening imported anim in AnimationPlayer

* C#: Support resource type hint in exported arrays

- Elements of types like PackedScene will display with the special editor for such type.

* Fixed GLES2 transparency order

* Added an is_valid function to FuncRef so script can check if it is safe to call it.

* issue-28446 - disable higlighting all occurences of string in editor if only whitespaces are selected

* Set range for line spacing

* Fixed a few issues with the bezier animation track editor, fixed the Travis CI errors, added TTR to bezier value labels and rounded them to 3 decimal points

* Add and expose to Font a function to get the rect size needed to draw a word-wraped text

* Fix build error after godotengine#27294

* SCons: Always use env.Prepend for CPPPATH

Include paths are processed from left to right, so we use Prepend to
ensure that paths to bundled thirdparty files will have precedence over
system paths (e.g. `/usr/include` should have lowest priority).

* Properly expose PhysicsServer methods

* Forgot a parameter in the ARVR gdnative bindings for notifications

* Fix sign-compare error from godotengine#26051

* doc: Sync classref with current source

* GridMap editor fixes and improvements

This change fixes a few outstanding issues and greatly improves the usability
of the GridMap editor through the following changes:

- Copied mesh now gets displayed during pasting (also renamed the related
  identifiers accordingly)
- Duplication/paste indicator now gets rotated around the correct pivot point
  (duplication worked properly before, but the indicator was shown misplaced
  when rotated)
- Selected mesh library item cursor is no longer shown during selection and
  duplication/pasting
- Back rotate X/Y/Z is now working during duplication/pasting
- Added true cut operation thanks to now having a proper clipboard (clear
  operation got remapped to the DEL key)
- Got rid of some weird workarounds in the duplication code
- Fill and clear operations now correctly make the selection marker inactive
  as this was broken partly due to the workarounds mentioned above
  (duplication continues to keep the selection marker active to allow
  subsequent duplications)
- Clear current selection on RMB, but treat selection as an action so previous
  selection can be restored on undo
- Separated selection and paste indicator data as it's prone to error and
  confusion and it's anyway needed now that selection is treated as an action
- Added support for cancelling paste, selection, and even unselect the
  currently selected mesh library item with the ESC key (previously there
  wasn't a way to unselect)
- Changed the key binding of fill/clear/duplicate operations to use Ctrl as a
  modifier
- Changed erase to use RMB instead of Shift+RMB (free look is available
  through Shift+F anyway, so no need to occupy RMB for it during gridmap
  editing)
- Removed unused area, external connector, and configure menu items (there's
  also the non-functional clip mode menu items, but I'm not sure whether there
  are any plans with that, I suppose it's meant to be an editor aid)
- Renamed INPUT_COPY to INPUT_PICK to better reflect its purpose
- Added support for using Shift+Q and Shift+E to select multiple floors/planes
  without actually changing the current floor/plane as it happens when using
  e.g. the mouse wheel

Fixes godotengine#25373 and godotengine#15883

* Fix script dialog path validation to handle spaces correctly

* fixes bug when setting projection matrix

* Make "decimal" functions more consistent

In GDScript, rename "decimals" to "step_decimals". In C#, add "StepDecimals", but keep the old functionality in a method called "DecimalCount".

* Fix missing argument for vsnprintf_s

* fixes 27543, adds a copy button for the editor log

* Fix regression on 'PopupMenu's minimal size

* Fixed game crash, regression of godotengine#26977

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>

* Small documentation improvements

* Fix pvrtc encoder
Always resize image to square of power2
Enable mipmaps only if original texture has it enabled
Fix godotengine#28534, godotengine#28541

* Support Mac OS default move cursor hotkeys

Add missing FALLTHROUGH define

* Fix Remove Missing Project projects on Windows

* Revert "Update libwebsockets to 3.1 (plus UWP patch)"

This reverts commit 90210c4.

* Added missed inputs for other modes in visual shaders

* Change order of Visual Script Search.

Previously:

* vs nodes
* properties
* methods

Now:

* properties
* methods
* vs nodes

* VS: Better ux

* In VS functions' put the current node type first.
* Cleanup and merge property and method sections.

* VS: Give the generic search the current base type.

* Freetype clone env for no-SMID single file

Fix freetype build issue for javascript platform.
When disabling optimizations (SMID) in specific freetype, source files,
we need to make sure to copy all other CPPFLAGS, not just override them.

* Fix First Ctrl+R and Ctrl+F not showing long name variables correctly

* Add a property hint for DynamicFont size

This caps its size to reasonable values in the Inspector.

This closes godotengine#22581.

* Fix input entries when switching to new visual shader

* Locales: Add some missing locale names

* Ignore a warning in _get_socket_error (-Wlogical-op).

drivers/unix/net_socket_posix.cpp: In member function 'NetSocketPosix::NetError NetSocketPosix::_get_socket_error()':
drivers/unix/net_socket_posix.cpp:197:22: warning: logical 'or' of equal expressions [-Wlogical-op]
  197 |  if (errno == EAGAIN || errno == EWOULDBLOCK)
      |                      ^

and:

modules/mono/utils/string_utils.cpp: In function 'int {anonymous}::sfind(const String&, int)':
modules/mono/utils/string_utils.cpp:68:48: error: logical 'or' of collectively exhaustive tests is always true [-Werror=logical-op]
      found = src[read_pos] == 's' || (c >= '0' || c <= '4');
                                       ~~~~~~~~~^~~~~~~~~~~

* Fix typed arrays and dictionaries getting their values shared

* Document CollisionObject2D pickable requires collision_layer

Documents CollisionObject2D mouse_entered, mouse_exited and input_event requiring at least one collision_layer to be set.

* Fix slight issues with autocompletion and member lists in GDScript

Fixes godotengine#27152
Fixes godotengine#28591

* Fix regression in 'PopupMenu' when icons have different values for width and height

* Fix script dialog asking for correct inheritance when not needed

* Make small changes to the script dialog

* Add "disabled" icon for 'CheckButton'

* Hide "Built-in Script" option in the script creation dialog when not possible

* Fix Mac OS move cursor behaviour

* added MSAA to GLES backend

* Make "Find in Files" always available in the script editor

* Fix build visual_shader_editor_plugin

* Remove unused `panelf` and `panelnc` styles

Fixes godotengine/godot-docs#2426

* Fix collapse visual shader tree

* Fix navmesh not finding optimal paths

Addresses part of godotengine#17885

* Update of RigidBody2D class description

Added a hint in the RigidBody2D class description regarding the transformation issue mentioned in godotengine#5734

* Make 'TabContainer' update when icon/title is changed

Fixes godotengine#28655.

* Fixes VideostreamGDNative crash on audio_channel=0.

Added an if case to check if the mix_callback exists before running any
of the audio code.

Fixes: godotengine#28644

* Support Mac OS default delete char hotkeys

* Document dictionary erase return value

* Fix ParallaxBackground breaking when moving it out the scene tree

* fix CollisonShape changing shape cause crash when not in a tree

* Fix generation of Mono Glue for Visual Studio 2017+

vsnprintf definition should only be changed when MSC version is older than 2013. The version check and fix is taken from StringUtils.h of assimp.

* Fix 'TabContainer' not updating its tab titles when locale is changed

* Make editor close empty scene when creating an inherited one

Fixes godotengine#28654.

* Update AUTHORS and DONORS list

New contributors added to AUTHORS:
@Kanabenki, @KoBeWi

Thanks to all contributors and donors for making Godot possible!

* Remove reduz from some autorequested code reviews

He's still one of the main architects of some of these code branches,
but quite often PRs that modify one or two files in such folders don't
necessarily need his input, and he has enough backlog to handle.

PR triagers will ask for his review manually whenever relevant. He's
left as code owner for physics/visual servers and rendering backends.

* Center shape according to logic Bullet applies

* Add transform support to deal with Bullets centering of shapes

* Fix SHADOWS_DISABLED flag in GLES2

Signed-off-by: Guilherme Souza <gdsdsilva@inf.ufpel.edu.br>

* Improved the AnimatedSprite docs; added description to speed_scale.

* Revert "Merge pull request godotengine#28715 from YeldhamDev/inherent_scene_close_empty"

This reverts commit 0f8356d, reversing
changes made to 7b7a664.

* Change empty scene closing on new inherented scene to a better approach

* Fix texture resource reload bug

If a non-imported texture resource file (e.g. DDS) gets updated the editor
doesn't reload it. The cause of the problem is two-fold:

First, the code of ImageTexture assumes that textures are always imported
from an image, but that's not the case for e.g. DDS. This change thus adds
code to issue a resource reload in case an image reload is not possible
(which is the case for non-imported texture resources).

Second, the code is filled with bogus calls to Image::get_image_data_size()
to determine the mipmap offset when that should be done using
Image::get_image_mipmap_offset(). Previous code literally passed the integer
mip level value to Image::get_image_data_size() where that actually expects
a boolean. Thus this part of the change might actually solve some other
issues as well.

To be pedantic, the texture_get_data() funciton of the rasterizer drivers is
still quite a mess, as it only ever returns the whole mipchain when
GLES_OVER_GL is set (practically only on desktop builds) but this change does
not attempt to resolve that.

* Docs: Add tutorials for KinematicBody2D

* Revert "Merge pull request godotengine#26053 from qarmin/back_scroll_to_start"

This reverts commit b5deb1d, reversing
changes made to 2cc8848.

This change causes unwanted regression.
It's too risky to have scroll back to top in ItemList.clear()

* Scroll back to top when changing directory in FileSystem dock

Fix godotengine#26041

* [EditorSpatialGizmo] Fix error in intersect_ray

* Avoid _can_call_mode resetting error message in MultiplayerAPI

* Change "ID" to lowercase "id"

Reasoning: ID is not an acronym, it is simply short for identification, so it logically should not be capitalized. But even if it was an acronym, other acronyms in Godot are not capitalized, like p_rid, p_ip, and p_json.

* Fix AudioEffectRecord messing up the effect stack by not writing to dst_frames

* X11: Check if "_NET_FRAME_EXTENTS" atom is supported.

* Fixes to ClippedCamera

This work has been kindly sponsored by IMVU.

* Allow or_greater for most properties of NavMesh

Closes godotengine#28624

* Open selected folder when pressing the "Open" option in the menu

An attempt to fix godotengine#28798

* Add RegEx substitution testcase and fix relevant docs

(cherry picked from commit a31bbb4)

* Make possible to create inherited scenes via the RMB menu in the FileSystem dock

* Fix orientation of generated navmeshes

Fixes godotengine#23817

* Apply sprite frames editor FPS value correctly upon _animation_select

* updated description of Array.shuffle to properly describe that it uses the same common seed at every runtime, thus being reproducible in general

* AnimatedSprite: Add from spritesheets now work as expected. Fix godotengine#28030

* Better handle some self-RSET/RPC in MultiplayerAPI

Allow calling yourself via RPC/RSET if the mode allows it.
Better error messages when you are not allowed to call yourself.

* Fix GDNative library resource loading.

Store general properties in ConfigFile too when modifying them.
Additionally set config_file property as internal as it's not editable
from inspector. It also does not appear to get saved in a meaningful way
(saved as Object(ConfigFile, ...))

* added radiance when using clear color and fixed brdf

* Properly update script button when undoing a script addition

Fixes godotengine#28870.

* Improve the CanvasItem documentation

This makes it clear that line width and antialiasing in
`draw_multiline()` aren't implemented yet (see godotengine#16448).

* Make Xcode recursive search frameworks in project dir

* fix lighting bug introduced in clear color changes

* Fix NaN with get_action_strength

* doc: Sync classref with current source

* doc: Fix issues found by the parser

* Update GDNativeLibrarySingletonEditor.

Moved GDNative singletons discoverer from register_types to
GDNativeSingletonEditor.
Fix enable/disable switch in GDNativeLibrarySingletonEditor.
Separate `gdnative/singletons` and `gdnative/singletons_disabled`
project settings, keeping "on by default" behavior.

* Fix OS_Javascript execute method

Signature was changed in OS via:

cd4449e

* Fix indexing failure in NativeScriptLanguage::unregister_binding_functions.

binding_functions.size() and an instance's binding_data.size() can get out of sync. They sync up when an instance's bindings are requested. When binding functions are registered after creating an instance's bindings, the instance's bindings are out of sync until requested again. If they're never requested, they're never synced.

unregister_binding_functions indexes into binding_data, but only checks that its safe to index into binding_functions. When they're out of sync, indexing fails.

This revision checks that it's safe to index into binding_data.

* Fix OS_UWP::execute's signature after cd4449e

Same as godotengine#28919.

* Revert "Revert "Implemented terrain raycast acceleration""
akien-mga pushed a commit that referenced this issue Jul 29, 2019
This makes it clear that line width and antialiasing in
`draw_multiline()` aren't implemented yet (see #16448).

(cherry picked from commit 1cfa74b)
myhalibobo pushed a commit to myhalibobo/godot that referenced this issue Sep 3, 2019
This makes it clear that line width and antialiasing in
`draw_multiline()` aren't implemented yet (see godotengine#16448).
@akien-mga
Copy link
Member

This seems to be unimplemented indeed, it was likely never finished. The code reference in #16448 (comment) is still a good starting point, as well as rasterizer_canvas_gles3.cpp (search for multiline), where it's apparent that there is missing code.

@KoBeWi
Copy link
Member

KoBeWi commented Nov 22, 2020

Still valid in 6bd4074

@rionhunter
Copy link

Still a problem in v3.2.3 in GLES3 it seems

@Zylann
Copy link
Contributor

Zylann commented Jun 10, 2021

Similar to #8289?

@Calinou
Copy link
Member

Calinou commented Jun 10, 2021

Similar to #8289?

The issue here happens because the width and antialiasing properties are not implemented for draw_multiline, not because of a hardware limitation.

@Zylann
Copy link
Contributor

Zylann commented Jun 10, 2021

Ok so once we fix these causes, we may be able to close this issue even if we still see it rendering at 1px due to the first issue

@Skaruts
Copy link

Skaruts commented Oct 28, 2021

I really wish multilines could be fixed, because using 2D lines seems to be the best (and easiest) workaround I found for not having line thickness in 3D in GLES2. The problem is, drawing many separate 2D lines gets heavy real fast. I took it down to GDNative and sadly I found no real improvements. It's... just slightly faster. (The problem is probably too many draw calls.)

Maybe my use case could be somewhat optimized to use a whole bunch of polylines, but I tested it as-is using multilines and it performs great while drawing some 200 lines. It's only this issue that is setting me back. I can still use this for the time being (visually it looks the same as when using an ImmediateGeometry), but 1px lines are really too thin...

I'm using Godot 3.3.4 stable, btw.


EDIT: actually, in my use case I can't even use polylines at all. It's a 3D level editor where the camera can fly around, so I have to avoid drawing lines when points are behind the camera. I don't think I can feasibly (and performantly) split polylines, so if one point is behind the camera, all I can do is cancel drawing the entire polyline, and that means you'll see the lines popping in and out while flying around.

So I do have to use separate line segments in this case.

@Calinou
Copy link
Member

Calinou commented Oct 28, 2021

because using 2D lines seems to be the best (and easiest) workaround I found for not having line thickness in 3D in GLES2

Using scaled unshaded CubeMeshes or CylinderMeshes (possibly with MultiMeshInstance too) may be an alternative.

@Skaruts
Copy link

Skaruts commented Oct 28, 2021

I saw that suggestion on the QA site (my name there is woopdeedoo). The problem I have with that solution is that the thickness of the "line" will vary with distance. If you get too far it gets weird and intermittent, too close and it may look too thick. I'm doing a 3D level editor, so I'm a bit concerned about not seeing the lines properly from far away, or getting visibility blocked by closer lines in the way.

I also don't know how to rotate the mesh to fit non-orthogonal alignments, and to be honest I have no idea how to properly work with a MultiMeshInstance (which I think would be a must in this).


EDIT: I tested this, at first it wasn't great, but with a MultiMeshInstance the performance is actually good. There are quite a few problems with transforms though, which are making this quite a chore...

Also I realized 2D lines are always drawn in front of everything, which is actually not desirable in all of my cases.

@rontarrant
Copy link

Still not working in 3.4.4

@Calinou
Copy link
Member

Calinou commented Jun 10, 2022

I made an add-on for antialiased 2D line drawing, although you'll need to use multiple nodes to replicate the behavior of draw_multiline(): https://github.com/godot-extended-libraries/godot-antialiased-line2d

@YuriSizov YuriSizov removed this from the 4.0 milestone Feb 22, 2023
@YuriSizov YuriSizov added this to the 4.x milestone Feb 22, 2023
@YuriSizov
Copy link
Contributor

So as far as I understand, width works now, but antialiasing still doesn't?

@dalexeev
Copy link
Member

dalexeev commented Feb 22, 2023

So as far as I understand, width works now, but antialiasing still doesn't?

Yes, see this comments: one, two.

I'm not sure if antialiasing is needed for thin lines (width < 0) and if it's possible to properly implement it for all drawing methods.

For draw_multiline(), this parameter was removed at some point, but we can easily bring it back later and it should work correctly for thick lines. The problem is only with thin lines.

@YuriSizov
Copy link
Contributor

Ah, it was removed. I missed that. Then I guess a proposal is needed if we want to actually bring it back in a working state, one that explains how it should work.

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

10 participants