Grease pencil opacity bug when dealing with line thickness relative to screen #80862

Closed
opened 2020-09-17 00:01:28 +02:00 by Elias · 13 comments

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: Intel(R) HD Graphics 620 Intel 4.5.0 - Build 26.20.100.7925

Blender Version
Broken: version: 2.90.0, branch: master, commit date: 2020-08-31 11:26, hash: 0330d1af29
Worked: (newest version of Blender that worked as expected)

Short description of error
When a line is small enough relative to the viewport or camera, it seems to lower in opacity, and the interpolation between points can cause artifacts

Exact steps for others to reproduce the error
attached is a .blend file showing an extreme case, where two grease pencil points are at different sizes, and depending on how zoomed in you are, the point on the right becomes transparent, and it causes a very visible gradient between the points. Note, both points are at a strength of 1, any opacity change isn't expected.

This artifact shows up in renders, as pictured below.

opacity thickness.png

opacity thickness bug.blend

**System Information** Operating system: Windows-10-10.0.18362-SP0 64 Bits Graphics card: Intel(R) HD Graphics 620 Intel 4.5.0 - Build 26.20.100.7925 **Blender Version** Broken: version: 2.90.0, branch: master, commit date: 2020-08-31 11:26, hash: `0330d1af29` Worked: (newest version of Blender that worked as expected) **Short description of error** When a line is small enough relative to the viewport or camera, it seems to lower in opacity, and the interpolation between points can cause artifacts **Exact steps for others to reproduce the error** attached is a .blend file showing an extreme case, where two grease pencil points are at different sizes, and depending on how zoomed in you are, the point on the right becomes transparent, and it causes a very visible gradient between the points. Note, both points are at a strength of 1, any opacity change isn't expected. This artifact shows up in renders, as pictured below. ![opacity thickness.png](https://archive.blender.org/developer/F8890441/opacity_thickness.png) [opacity thickness bug.blend](https://archive.blender.org/developer/F8890426/opacity_thickness_bug.blend)
Author

Added subscriber: @razzzmatazzz30297

Added subscriber: @razzzmatazzz30297

#84909 was marked as duplicate of this issue

#84909 was marked as duplicate of this issue

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

Perhaps when the size of a point is smaller than that of a pixel, its opacity is overwritten to represent that it is less visible.
But in fact, this opacity should not generate this gradient.

Perhaps when the size of a point is smaller than that of a pixel, its opacity is overwritten to represent that it is less visible. But in fact, this opacity should not generate this gradient.

Added subscribers: @fclem, @JamellMoore

Added subscribers: @fclem, @JamellMoore

I have been reviewing the GPencil engine/shader code and can see this is not a bug but intended by design.

In gpencil_common_lib.glsl L:343 it states that line thickness is clamped and the opacity reduced when the thickness is small to avoid aliasing artifacts.

I have removed the opacity modulation and tested the in the viewport and cannot see any artifacts. @fclem do you think the opacity modulation is safe to remove? If not the bug status should be removed from this task.

Bug-#80862-GPencil-Opacity-Small-Stroke-Thickness-FIX-TEST.mp4

I have been reviewing the GPencil engine/shader code and can see this is not a bug but intended by design. In gpencil_common_lib.glsl L:343 it states that line thickness is clamped and the opacity reduced when the thickness is small to avoid aliasing artifacts. I have removed the opacity modulation and tested the in the viewport and cannot see any artifacts. @fclem do you think the opacity modulation is safe to remove? If not the bug status should be removed from this task. [Bug-#80862-GPencil-Opacity-Small-Stroke-Thickness-FIX-TEST.mp4](https://archive.blender.org/developer/F9500896/Bug-#80862-GPencil-Opacity-Small-Stroke-Thickness-FIX-TEST.mp4)

The opacity modulation is here to avoid strong aliasing of subpixel lines. A better way would be to make this opacity fade inside the pixel shader, so after interpolation.

The opacity modulation is here to avoid strong aliasing of subpixel lines. A better way would be to make this opacity fade inside the pixel shader, so after interpolation.

@fclem I thought that was the case. Isn't the sub-pixel antialiasing defined in ScenePencil->smaa_threshold sufficient in preventing these artifacts?

@fclem I thought that was the case. Isn't the sub-pixel antialiasing defined in ScenePencil->smaa_threshold sufficient in preventing these artifacts?

Nope it isn't enough. SMAA is only working on lines that are at least 1 pixel large. But we don't want to clamp actual visual thickness to 1 so we fade based on the line size.

Nope it isn't enough. SMAA is only working on lines that are at least 1 pixel large. But we don't want to clamp actual visual thickness to 1 so we fade based on the line size.
Member

Added subscribers: @Jkecwlkr, @filedescriptor

Added subscribers: @Jkecwlkr, @filedescriptor

This issue was referenced by 09f7c93858

This issue was referenced by 09f7c93858297ab8beafc9cf9bfa06f7d8e68ea6

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Antonio Vazquez self-assigned this 2021-02-17 13:41:00 +01:00
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
7 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#80862
No description provided.