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

"Ghost Lines" when using Anti-aliasing, polygons with shared boundaries, and no outline/QT::NoPen #12023

Open
qgib opened this issue Oct 1, 2009 · 19 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Map and Legend Related to map or legend rendering Upstream Needs changes in an upstream library (like Qt, Proj, GDAL, ...)

Comments

@qgib
Copy link
Contributor

qgib commented Oct 1, 2009

Author Name: springmeyer - (springmeyer -)
Original Redmine Issue: 1963
Affected QGIS version: master
Redmine category:map_canvas


QT's anti-aliasing output exhibits an inherent limitation of AA, where polygon edges are drawn/feathered twice and the background color "bleeds" through what are supposed to be tightly shared edges of polygons.

I wonder if some of the new render hints in QT4.4 > might help work around this issue:

http://doc.trolltech.com/4.5/qpainter.html#RenderHint-enum

See also: http://trac.mapnik.org/ticket/428, where I am working on a workaround using AGG that may apply to the QT renderer, given an exposed API.


@qgib
Copy link
Contributor Author

qgib commented Dec 27, 2009

Author Name: Paolo Cavallini (@pcav)


Is this a QGIS, or a Qt bug?

@qgib
Copy link
Contributor Author

qgib commented Dec 30, 2009

Author Name: springmeyer - (springmeyer -)


QT limitation which may benefit from workarounds in QGIS. I think this is an important ticket to have open for other users to see, or potentially as an FAQ only if we don't find an easy solution.

@qgib
Copy link
Contributor Author

qgib commented Sep 19, 2010

Author Name: Paolo Cavallini (@pcav)


Is this still true for current Qt and QGIS versions? Please confirm.

@qgib
Copy link
Contributor Author

qgib commented Sep 21, 2010

Author Name: John Tull (John Tull)


This problem still exists in trunk with the most recent Qt release.

@qgib
Copy link
Contributor Author

qgib commented Mar 6, 2011

Author Name: Tim Sutton (Tim Sutton)


Hi

I did a little test using both:

QPainter::SmoothPixmapTransform
QPainter::HighQualityAntialiasing

In src/gui/qgsmapcanvasmap.cpp for [[AntiAlias]] flags. Both choices did not resolve the issue for me. Using:

QGIS e93c1841 (SVN r15735) Trunk
Qt 4.7

@qgib
Copy link
Contributor Author

qgib commented Mar 7, 2011

Author Name: springmeyer - (springmeyer -)


We solved this sufficiently in Mapnik within the AGG renderer by allowing the user to control the AA gamma. A gamma of 0 is aliased while 1 is fully anti-aliased and setting gamma to around .6-.7 is able to remove the faint lines while keeping an AA-ish look with much more definition to edges (like coastlines) than can be achieved by the only other known workaround: overpainting with a thin line of the same color as the polygon fill. In short, we solved this by reducing the aggressiveness of the AA algorithm so that polygons are slightly dilated rather are fully AA or aliased.

So, I assume that QT will expose somewhere an equivalent gamma setting (or partial AA ability) - as QT's renderer is originally based on AGG (http://labs.qt.nokia.com/2009/12/18/qt-graphics-and-performance-the-raster-engine/)

@qgib
Copy link
Contributor Author

qgib commented Apr 17, 2011

Author Name: Tim Sutton (Tim Sutton)


Reading the the referenced article it seems they only were inspired by AGG and didnt directly use any source code from AGG in their implementation. It seems like Qt4 rendering engine does not expose any agg-like gamma options and there isnt really any reasonable work around we can come up with for this. I am going to close this ticket since the only way to resolve this issue currently is to disable AA rendering it would seem and there isnt anything else we can do to fix it.


  • status_id was changed from Open to Closed
  • resolution was configured as wontfix

@qgib
Copy link
Contributor Author

qgib commented Apr 17, 2011

Author Name: springmeyer - (springmeyer -)


Okay.

@qgib
Copy link
Contributor Author

qgib commented Feb 26, 2013

Author Name: Henrik Uggla (@huggla)


Turning off "Make lines appear less jagged..." removes the thin lines on the screen but they still show when printing (see attached pdf). I can find no option for disabling anti-aliasing in the composer. Applies to both Windows7 and ubuntugis.

Note regarding attached pdf: The thin lines are displayed differently in different pdf-viewers.


  • assigned_to_id removed nobody
  • crashes_corrupts_data was configured as 0
  • version was configured as master
  • fixed_version_id was changed from Version 1.7.0 to Version 2.0.0
  • status_id was changed from Closed to Reopened
  • 5357 was configured as testlinux.pdf

@qgib
Copy link
Contributor Author

qgib commented Jun 28, 2014

Author Name: Jürgen Fischer (@jef-n)


  • fixed_version_id was changed from Version 2.0.0 to Future Release - Lower Priority

@qgib
Copy link
Contributor Author

qgib commented Mar 27, 2017

Author Name: Johannes Kroeger (Johannes Kroeger)


I realised that #16269 and #18620 were duplicates of this and closed them accordingly.

Has anything happened in the past years or maybe, hopefully, in QT5 that allows this to be fixed? It would highly improve cartographic quality in some use cases.

If not, a "use fill color for stroke" checkbox would be nice, if that indeed is a workaround for this (as suggested in the duplicates). It could be a useful addition for other use cases as well maybe?

@qgib
Copy link
Contributor Author

qgib commented Apr 30, 2017

Author Name: Giovanni Manghi (@gioman)


  • pull_request_patch_supplied was configured as 0
  • regression was configured as 0
  • easy_fix was configured as 0

@qgib
Copy link
Contributor Author

qgib commented Sep 1, 2018

Author Name: Johannes Kroeger (Johannes Kroeger)


A workaround to this is:

Set the Stroke width to Hairline
Set the Stroke color to @@symbol_color@ using Data defined override

I forgot who shared this, either Nathan or Nyall. :)

@qgib
Copy link
Contributor Author

qgib commented Sep 2, 2018

Author Name: Giovanni Manghi (@gioman)


Johannes Kroeger wrote:

A workaround to this is:

Set the Stroke width to Hairline
Set the Stroke color to @@symbol_color@ using Data defined override

I forgot who shared this, either Nathan or Nyall. :)

is this in the docs? Can't find it.


  • status_id was changed from Reopened to Closed
  • description was changed from QT's anti-aliasing output exhibits an inherent limitation of AA, where polygon edges are drawn/feathered twice and the background color "bleeds" through what are supposed to be tightly shared edges of polygons.

I wonder if some of the new render hints in QT4.4 > might help work around this issue:

http://doc.trolltech.com/4.5/qpainter.html#RenderHint-enum

See also: http://trac.mapnik.org/ticket/428, where I am working on a workaround using AGG that may apply to the QT renderer, given an exposed API.
to QT's anti-aliasing output exhibits an inherent limitation of AA, where polygon edges are drawn/feathered twice and the background color "bleeds" through what are supposed to be tightly shared edges of polygons.

I wonder if some of the new render hints in QT4.4 > might help work around this issue:

http://doc.trolltech.com/4.5/qpainter.html#RenderHint-enum

See also: http://trac.mapnik.org/ticket/428, where I am working on a workaround using AGG that may apply to the QT renderer, given an exposed API.

@qgib qgib closed this as completed Sep 2, 2018
@qgib
Copy link
Contributor Author

qgib commented Sep 30, 2018

Author Name: Johannes Kroeger (Johannes Kroeger)


I don't think so, it was either on IRC or Twitter.

This issue remains, please keep it opened. The workaround is just that, a workaround!

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Map and Legend Related to map or legend rendering labels May 24, 2019
@qgib qgib added this to the Future Release - Lower Priority milestone May 24, 2019
@kannes
Copy link
Contributor

kannes commented Nov 25, 2021

I just realised this issue had been closed back then but it still exists and is still a major rendering issue. Please re-open, I think it was only closed by accident.

@gioman gioman added the Upstream Needs changes in an upstream library (like Qt, Proj, GDAL, ...) label Nov 25, 2021
@gioman gioman reopened this Nov 25, 2021
@gioman
Copy link
Contributor

gioman commented Nov 25, 2021

it still exists and is still a major rendering issue

@kannes but it should still be an upstream issue in QT, as far as I understand.

@kannes
Copy link
Contributor

kannes commented Nov 25, 2021

Once/if upstream fixes this, it might require some changes in QGIS I think or maybe a workaround can be found to fix the issue in another way. Having it open with that tag seems like a good setup to me, thank you!

Maybe even that silly workaround could be integrated (cue Clippy asking "It seems like you want to disable outlines for polygons, this will lead to visible boundaries between neighboring polygons due to a bug in Qt, would like to enable a workaround?") as a little fix.

@antoniolocandro
Copy link
Contributor

Glad I found this ticket, thank you for keeping it open for knowledge. Still present in latest
QGIS version
3.35.0-Master
QGIS code revision
b508e4f

image
image

troopa81 added a commit to troopa81/QGIS that referenced this issue Dec 4, 2023
When NoPen option is selected and Anti-Aliasing is enabled, polygons
that share a boundary are bleeding out on each other, leading to an
unwanted artifact. In that situation we prefer to draw a very thin line with the
same color than the brush.
troopa81 added a commit to troopa81/QGIS that referenced this issue Dec 6, 2023
When NoPen option is selected and Anti-Aliasing is enabled, polygons
that share a boundary are bleeding out on each other, leading to an
unwanted artifact. In that situation we prefer to draw a very thin line with the
same color than the brush.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Map and Legend Related to map or legend rendering Upstream Needs changes in an upstream library (like Qt, Proj, GDAL, ...)
Projects
None yet
Development

No branches or pull requests

4 participants