2.8x, unreliable GL_LINE_SMOOTH / GL_POLYGON_SMOOTH behavior #57570

Closed
opened 2018-11-01 23:02:21 +01:00 by Campbell Barton · 61 comments

For some graphics cards in 2.8x (more information needed), smoothing is ignored. This task is to gather more information and see if it can be resolved.

See: #54723#548752 and replies.


Edit, it seems some graphics cards simply ignore the smooth setting.

For some graphics cards in 2.8x *(more information needed)*, smoothing is ignored. This task is to gather more information and see if it can be resolved. See: #54723#548752 and replies. ---- Edit, it seems some graphics cards simply ignore the smooth setting.
Author
Owner

Added subscriber: @ideasman42

Added subscriber: @ideasman42

blender/blender-addons#78268 was marked as duplicate of this issue

blender/blender-addons#78268 was marked as duplicate of this issue

#74366 was marked as duplicate of this issue

#74366 was marked as duplicate of this issue

#63088 was marked as duplicate of this issue

#63088 was marked as duplicate of this issue

#73560 was marked as duplicate of this issue

#73560 was marked as duplicate of this issue

#65018 was marked as duplicate of this issue

#65018 was marked as duplicate of this issue

#57993 was marked as duplicate of this issue

#57993 was marked as duplicate of this issue
Member

Added subscriber: @pablovazquez

Added subscriber: @pablovazquez
Member

Can confirm anti-alias works fine (and has been since the beginning) in the following setup:

OS: Ubuntu 17.10
**Graphics Card:**Nvidia GTX 1050
**Resolution:**2560x1440
**Blender UI Line Width:**Auto (picks "Thin")

image.png

Can confirm anti-alias works fine (and has been since the beginning) in the following setup: **OS:** Ubuntu 17.10 **Graphics Card:**Nvidia GTX 1050 **Resolution:**2560x1440 **Blender UI Line Width:**Auto (picks "Thin") ![image.png](https://archive.blender.org/developer/F5330754/image.png)

Added subscriber: @Lapineige

Added subscriber: @Lapineige

It works fine on my setup too.
OS: Ubuntu 18.10
Graphics Card: Nvidia GTX 880m (Nvidia Drivers used)
Resolution: 1920*1080 (17" screen, not HDPi)
Blender UI Line Width: Auto (picks "Thin")

It works fine on my setup too. **OS**: Ubuntu 18.10 **Graphics Card**: Nvidia GTX 880m (Nvidia Drivers used) **Resolution**: 1920*1080 (17" screen, not HDPi) **Blender UI Line Width**: Auto (picks "Thin")

Added subscribers: @fclem, @Sergey

Added subscribers: @fclem, @Sergey

@ideasman42 , this is a misuse of core profile from Blender side. Not sure where exactly this gizmo is being drawn, but from quick grep in the source shows two common mistakes:

  • glLineWidth() with values greater that 1.0. As per specification this INVALID_VALUE.
  • Smooth lines shouldn't be used nowadays either. I cant' find exact spec entry for them, but Khronos lists this as deprecated/removed in the "Common Mistakes" section. But even if it's still part of the spec, the rest of the intenet agrees that quality of smooth lines is rather poor.

I am a strong believer in theory that in 2.8 we should not use deprecated/known-to-behave-bad OpenGL features. With Core profile we've got flexibility of programmable render pipeline, where we can implement smooth line which will be guaranteed to work the way we want on all the hardware.

P.S. Maybe @fclem can drop his knowledge here as well.

@ideasman42 , this is a misuse of core profile from Blender side. Not sure where exactly this gizmo is being drawn, but from quick grep in the source shows two common mistakes: - `glLineWidth()` with values greater that `1.0`. As per specification this `INVALID_VALUE`. - Smooth lines shouldn't be used nowadays either. I cant' find exact spec entry for them, but Khronos lists this as deprecated/removed in the "Common Mistakes" section. But even if it's still part of the spec, the rest of the intenet agrees that quality of smooth lines is rather poor. I am a strong believer in theory that in 2.8 we should not use deprecated/known-to-behave-bad OpenGL features. With Core profile we've got flexibility of programmable render pipeline, where we can implement smooth line which will be guaranteed to work the way we want on all the hardware. P.S. Maybe @fclem can drop his knowledge here as well.

glLineWidth() with values greater that 1.0. As per specification this INVALID_VALUE.

Well this is partially true. The values supported are implementation dependent.

Smooth lines shouldn't be used nowadays either. I cant' find exact spec entry for them, but Khronos lists this as deprecated/removed in the "Common Mistakes" section. But even if it's still part of the spec, the rest of the intenet agrees that quality of smooth lines is rather poor.

I was the one who added line smoothing to gizmos because the aliasing caused by wide lines was terrible. So it's better than nothing.

Correctly implementing smooth wide lines needs to have a dedicated shader for it that just mimics the behavior of old GL_LINE_SMOOTH. This shouldn't be too hard but I don't know how feasible it is for 2.80.

As for GL_POLYGON_SMOOTH this is even more tricky. Since it's mostly for UI stuff, I would suggest to just draw alpha blended shapes with manual added geometry on the contours of the shape and just make the outer ring alpha = 0.0 so that vertex color interpolation make some kind of smoothing.

If it is large points that you want to draw (larger than max gl point size), we can make a shader variation that draws a AA point and you just have to submit a quad.

> glLineWidth() with values greater that 1.0. As per specification this INVALID_VALUE. Well this is partially true. The values supported are implementation dependent. > Smooth lines shouldn't be used nowadays either. I cant' find exact spec entry for them, but Khronos lists this as deprecated/removed in the "Common Mistakes" section. But even if it's still part of the spec, the rest of the intenet agrees that quality of smooth lines is rather poor. I was the one who added line smoothing to gizmos because the aliasing caused by wide lines was terrible. So it's better than nothing. Correctly implementing smooth wide lines needs to have a dedicated shader for it that just mimics the behavior of old GL_LINE_SMOOTH. This shouldn't be too hard but I don't know how feasible it is for 2.80. As for GL_POLYGON_SMOOTH this is even more tricky. Since it's mostly for UI stuff, I would suggest to just draw alpha blended shapes with manual added geometry on the contours of the shape and just make the outer ring alpha = 0.0 so that vertex color interpolation make some kind of smoothing. If it is large points that you want to draw (larger than max gl point size), we can make a shader variation that draws a AA point and you just have to submit a quad.
Author
Owner

Could we have a general solution for this?

We want add-on authors to be able to make their own gizmos, so if they need to be aware of special shader internals - it could make the API hard to use (maybe this can be hidden from the developer?).

Possible alternatives...

  • Render all gizmos to over-sampled off-screen buffer (advantage of not having artifacts - especially regarding GL_POLYGON_SMOOTH when alpha < 1.0), disadvantage of having to use multi-sample buffer which needs special handling (perhaps this isn't practical if we want to occlude gizmos by other elements in the scene).
  • Don't use GL_LINE_SMOOTH / GL_POLYGON_SMOOTH at all.
Occasions where we want smoothing have to be handled by each gizmo's drawing code (which can include specialized shader for eg).
We'll try make them look OK without smoothing (transform looks OK IMHO)... if it's important to do some AA tricks, each gizmo's drawing code can handle that it's self (with policy of not using `GL_*_SMOOTH`).
Could we have a general solution for this? We want add-on authors to be able to make their own gizmos, so if they need to be aware of special shader internals - it could make the API hard to use (maybe this can be hidden from the developer?). Possible alternatives... - Render all gizmos to over-sampled off-screen buffer (advantage of not having artifacts - especially regarding `GL_POLYGON_SMOOTH` when `alpha < 1.0`), disadvantage of having to use multi-sample buffer which needs special handling (perhaps this isn't practical if we want to occlude gizmos by other elements in the scene). - Don't use `GL_LINE_SMOOTH / GL_POLYGON_SMOOTH` at all. ``` Occasions where we want smoothing have to be handled by each gizmo's drawing code (which can include specialized shader for eg). ``` ``` We'll try make them look OK without smoothing (transform looks OK IMHO)... if it's important to do some AA tricks, each gizmo's drawing code can handle that it's self (with policy of not using `GL_*_SMOOTH`).
Member

Added subscriber: @chaos-4

Added subscriber: @chaos-4
Member

Didn't find any other appropriate place to ask this, but what is the proper way to add antialiasing to custom gizmos?
I'm currently writing my own gizmos for addons, but couldn't find any dedicated property to enable or disable the antialiasing. I'm also interested in the way points are drawn in the 3D view, as these can be square or round.

Didn't find any other appropriate place to ask this, but what is the proper way to add antialiasing to custom gizmos? I'm currently writing my own gizmos for addons, but couldn't find any dedicated property to enable or disable the antialiasing. I'm also interested in the way points are drawn in the 3D view, as these can be square or round.
Author
Owner

In #57570#682834, @chaos-4 wrote:
Didn't find any other appropriate place to ask this, but what is the proper way to add antialiasing to custom gizmos?

There isn't a a convenient way to do this at the moment, that's why this task is still open.

I'm currently writing my own gizmos for addons, but couldn't find any dedicated property to enable or disable the antialiasing. I'm also interested in the way points are drawn in the 3D view, as these can be square or round.

Round points are currently drawn as either small circles or using shaders.

> In #57570#682834, @chaos-4 wrote: > Didn't find any other appropriate place to ask this, but what is the proper way to add antialiasing to custom gizmos? There isn't a a convenient way to do this at the moment, that's why this task is still open. > I'm currently writing my own gizmos for addons, but couldn't find any dedicated property to enable or disable the antialiasing. I'm also interested in the way points are drawn in the 3D view, as these can be square or round. Round points are currently drawn as either small circles or using shaders.
Member

Thanks Campbell.
Looking forward for possible solutions on this.

Thanks Campbell. Looking forward for possible solutions on this.
Clément Foucault self-assigned this 2019-07-09 20:56:37 +02:00

This is really problematic for OSX users on retina display.

Possible workaround is to use a geometry shader variant for every common shader and switch the shader just before drawing if we are drawing a line.
The issue is that if we do that we loose the uniforms configuration because they were changed for another shader. And there is no way to know what type of primitive the shader will be drawn with until the moment the drawcall is issued.

So the real fix would be to change every places that draw thick lines to use a special shader(s) explicitly and pass the line width as uniform.

I wouldn't consider this high priority for 2.80 release as this fix requires some thinking and maybe deeper change.

This is really problematic for OSX users on retina display. Possible workaround is to use a geometry shader variant for every common shader and switch the shader just before drawing if we are drawing a line. The issue is that if we do that we loose the uniforms configuration because they were changed for another shader. And there is no way to know what type of primitive the shader will be drawn with until the moment the drawcall is issued. So the real fix would be to change every places that draw thick lines to use a special shader(s) explicitly and pass the line width as uniform. I wouldn't consider this high priority for 2.80 release as this fix requires some thinking and maybe deeper change.
Added subscribers: @Kent-Davis, @Morganil, @ChristopherAnderssarian, @WilliamReynish, @lichtwerk, @antoniov

Added subscriber: @Uendel

Added subscriber: @Uendel

Added subscriber: @AndreasAsanger

Added subscriber: @AndreasAsanger

Is there a chance for a fix anytime soon?

When working in the viewport, I'd agree calling those thin lines a discomfort.
But when you need to create screenshots for printing purposes, this is a real problem...

Is there a chance for a fix anytime soon? When working in the viewport, I'd agree calling those thin lines a discomfort. But when you need to create screenshots for printing purposes, this is a real problem...

Do not go together Ubuntu and Macintosh. Please do separate. Only for Macintosh. Do not use Windows, Do not use Ubuntu.

Do not go together Ubuntu and Macintosh. Please do separate. Only for Macintosh. Do not use Windows, Do not use Ubuntu.
Member

Added subscriber: @MariusGiurgi

Added subscriber: @MariusGiurgi
Member

How come this is marked as a LOW priority? The annotations are useless without proper thickness. I’m running Blender 2.81 on Mojave 10.14.6 on a MacBook pro 15” 2018 and the annotations are 1px thick regardless of the line thickness settings.

Screen Shot 2019-11-27 at 10.42.53 PM.png

How come this is marked as a LOW priority? The annotations are useless without proper thickness. I’m running Blender 2.81 on Mojave 10.14.6 on a MacBook pro 15” 2018 and the annotations are 1px thick regardless of the line thickness settings. ![Screen Shot 2019-11-27 at 10.42.53 PM.png](https://archive.blender.org/developer/F8173848/Screen_Shot_2019-11-27_at_10.42.53_PM.png)

I am use Macintosh.
Yes I told Blender report ticket many times make me frustrate. Blender 2.79b is perfect but 2.80 and up mess up. They need to fix I ask Blender company again.

I am use Macintosh. Yes I told Blender report ticket many times make me frustrate. Blender 2.79b is perfect but 2.80 and up mess up. They need to fix I ask Blender company again.

Just to give an update, the 2.82 beta will have a fix for wide line in the viewport tomorrow. (See 014eb69cf8)

This won't fix the issue for transform gizmos, or the UI. So I'll keep the report open. Do note I have plans for fixing it for UI and gizmos but it's not decided when I'll have time to tackle it.

Just to give an update, the 2.82 beta will have a fix for wide line in the viewport tomorrow. (See 014eb69cf8) This won't fix the issue for transform gizmos, or the UI. So I'll keep the report open. Do note I have plans for fixing it for UI and gizmos but it's not decided when I'll have time to tackle it.

Thanks

Thanks
Member

FYI, this still doesn’t work in 2.82 alpha experimental builds (on macOS). Perhaps because the experimental builds are not yet beta?
Screen Shot 2019-12-15 at 11.53.43 AM.png

FYI, this still doesn’t work in 2.82 **alpha** experimental builds (on macOS). Perhaps because the experimental builds are not yet **beta**? ![Screen Shot 2019-12-15 at 11.53.43 AM.png](https://archive.blender.org/developer/F8223499/Screen_Shot_2019-12-15_at_11.53.43_AM.png)

Added subscriber: @rjg

Added subscriber: @rjg

@MariusGiurgi Seems to only affect macOS in this case as well. It works properly on Windows and Linux.

@MariusGiurgi Seems to only affect macOS in this case as well. It works properly on Windows and Linux.

Oh well please do it work on MacOS some one who work on Blender 2.8x support DO IT

Oh well please do it work on MacOS some one who work on Blender 2.8x support DO IT

@MariusGiurgi I can't see aliasing in your screenshot. Can you double check that your viewport settings (in user preferences) have Overlay Smooth Wires enabled?

@MariusGiurgi I can't see aliasing in your screenshot. Can you double check that your viewport settings (in user preferences) have `Overlay Smooth Wires` enabled?

Where is "User Preferences" I not see. Everyone use Blender 2.82 Alpha.

Where is "User Preferences" I not see. Everyone use Blender 2.82 Alpha.

Added subscribers: @iss, @jenkm, @cubimation, @QuentinG

Added subscribers: @iss, @jenkm, @cubimation, @QuentinG

Added subscribers: @Memento, @Jeroen-Bakker, @Ton, @ZedDB

Added subscribers: @Memento, @Jeroen-Bakker, @Ton, @ZedDB
Member

Added subscriber: @KBrumfield

Added subscriber: @KBrumfield
Member

Added subscriber: @Imaginer

Added subscriber: @Imaginer

Added subscriber: @LeoSch

Added subscriber: @LeoSch

Added subscriber: @raincole

Added subscriber: @raincole

image.png

The problem is still here with Blender v2.82a and macOS 10.14. It's sad to see such a major UI issue is marked as "low priority".

![image.png](https://archive.blender.org/developer/F8434837/image.png) The problem is still here with Blender v2.82a and macOS 10.14. It's sad to see such a major UI issue is marked as "low priority".
Member

Any update on this? FYI, drawing errors with GL_LINE_SMOOTH and GL_POLYGON_SMOOTH also affect custom drawing in operators.

Any update on this? FYI, drawing errors with `GL_LINE_SMOOTH` and `GL_POLYGON_SMOOTH` also affect custom drawing in operators.

Added subscriber: @fsiddi

Added subscriber: @fsiddi

After reporting the issue again in a new task, I've been pointed to this task. So i'll briefly reiterate. On macOS:

  • Gizmos are hard to see in the viewport
  • Gizmos lack consistency with every other UI element in the viewport
2.79 on macOS 2.83 on macOS 2.83 on Windows
Screenshot 2020-04-11 at 14.18.31.png Screenshot 2020-04-11 at 14.18.36.png Blender_gizmo_rotate_windows.png

I think this a regression since Blender 2.79. Can @fclem or @ideasman42 confirm if this will be addressed for Blender 2.83?

After reporting the issue again in a new task, I've been pointed to this task. So i'll briefly reiterate. On macOS: * Gizmos are hard to see in the viewport * Gizmos lack consistency with every other UI element in the viewport | 2.79 on macOS | 2.83 on macOS | 2.83 on Windows | | -- | -- | -- | | ![Screenshot 2020-04-11 at 14.18.31.png](https://archive.blender.org/developer/F8464600/Screenshot_2020-04-11_at_14.18.31.png) | ![Screenshot 2020-04-11 at 14.18.36.png](https://archive.blender.org/developer/F8464602/Screenshot_2020-04-11_at_14.18.36.png) | ![Blender_gizmo_rotate_windows.png](https://archive.blender.org/developer/F8464604/Blender_gizmo_rotate_windows.png) | I think this a regression since Blender 2.79. Can @fclem or @ideasman42 confirm if this will be addressed for Blender 2.83?

Yes I agree with you. Blender 2.8x need to fix everything I am still wait for Blender developer to fix everything.
I do use MacOS Catalina 10.15.4 beta.
I have low vision I unable to read too thinner line (wire) as well. Please copy from Blender 2.79b to paste to 2.80 so can read thickness wire.

Yes I agree with you. Blender 2.8x need to fix everything I am still wait for Blender developer to fix everything. I do use MacOS Catalina 10.15.4 beta. I have low vision I unable to read too thinner line (wire) as well. Please copy from Blender 2.79b to paste to 2.80 so can read thickness wire.

Added subscriber: @ankyankyanky

Added subscriber: @ankyankyanky

Added subscriber: @Filemoner

Added subscriber: @Filemoner

Low priority, this, really?
2.9 alpha and still unusable in OSX :(

Low priority, this, really? 2.9 alpha and still unusable in OSX :(

This issue was referenced by d712f1f83a

This issue was referenced by d712f1f83af881be536ec0d183b7d3025c172684

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'

See picture Screen Shot 2020-04-24 at 4.06.59 AM.png

See picture ![Screen Shot 2020-04-24 at 4.06.59 AM.png](https://archive.blender.org/developer/F8493368/Screen_Shot_2020-04-24_at_4.06.59_AM.png)

@Kent-Davis I've fixed the issue you were pointing at in 42d77fbea1

@Kent-Davis I've fixed the issue you were pointing at in 42d77fbea1

@fclem
I am sorry I disagree with you they did not fix yet timeline. I am going show you proof.
Blender 2 79 and 2 90.png

@fclem I am sorry I disagree with you they did not fix yet timeline. I am going show you proof. ![Blender 2 79 and 2 90.png](https://archive.blender.org/developer/F8543890/Blender_2_79_and_2_90.png)
Member

Added subscriber: @FSam

Added subscriber: @FSam

I think this task was marked as "Resolved" automatically and should be re-opened.
The problem has only been fixed in some places out of many.

I think this task was marked as "Resolved" automatically and should be re-opened. The problem has only been fixed in some places out of many.

Added subscriber: @neo_phi

Added subscriber: @neo_phi

Still getting unusable hairline annotation lines in Blender 2.83LTS on OSX 10.15.5. Other issues regarding this direct to here and this is closed...

Still getting unusable hairline annotation lines in Blender 2.83LTS on OSX 10.15.5. Other issues regarding this direct to here and this is closed...

@neo_phi look at Blender 2.90 Alpha let you check.
https://builder.blender.org/download/
You will see. Blender 2.80 is no long to fix only Blender 2.90 Alpha.

@neo_phi look at Blender 2.90 Alpha let you check. https://builder.blender.org/download/ You will see. Blender 2.80 is no long to fix only Blender 2.90 Alpha.

@neo_phi
Blender 2.90 Alpha
Touch enlarge picture you can see.
Look at picture Screen Shot 2020-06-28 at 5.20.26 AM.png

@neo_phi Blender 2.90 Alpha Touch enlarge picture you can see. Look at picture ![Screen Shot 2020-06-28 at 5.20.26 AM.png](https://archive.blender.org/developer/F8651224/Screen_Shot_2020-06-28_at_5.20.26_AM.png)
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
22 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#57570
No description provided.