Image Editor: Remove drawing artifacts #106173

Closed
Jeroen Bakker wants to merge 13 commits from Jeroen-Bakker:image-editor-drawing-artifacts into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

Due to floating point precision issue it could happen that some
lines of the image were drawn twice, leading to drawing artifacts.
Previously this artifact was reduced by disabling the division of
the image engine. This resulted in less performance than expected.

In the image engine the screen is divided into a grid. For each
segment in the grid a GPU texture is created. The resolution of
these textures are fixed. When scrolling the textures only need
to drawn with an offset.

The problem was that the calculation of the offset used the uv
coordinates as the source, that lead to precision issues.
This PR uses a single UV coordinate and the texture resolution
to calculate the area to draw per texture. Results are better
adjacency of the textures.

This PR also increases the number of subdivisions in other to
improve the performance when zooming or refreshing the images.

Although we want to fix this in Blender 3.5, this change introduces
a different behavior. And we should first make sure everything
works as expected. If so we can backport eventually to Blender 3.5.1

The short term solution should be fixed for a Blender 3.5.1 release.
The longer term solution might not make it to 3.6 and most likely be
added to 4.0

Due to floating point precision issue it could happen that some lines of the image were drawn twice, leading to drawing artifacts. Previously this artifact was reduced by disabling the division of the image engine. This resulted in less performance than expected. In the image engine the screen is divided into a grid. For each segment in the grid a GPU texture is created. The resolution of these textures are fixed. When scrolling the textures only need to drawn with an offset. The problem was that the calculation of the offset used the uv coordinates as the source, that lead to precision issues. This PR uses a single UV coordinate and the texture resolution to calculate the area to draw per texture. Results are better adjacency of the textures. This PR also increases the number of subdivisions in other to improve the performance when zooming or refreshing the images. Although we want to fix this in Blender 3.5, this change introduces a different behavior. And we should first make sure everything works as expected. If so we can backport eventually to Blender 3.5.1 The short term solution should be fixed for a Blender 3.5.1 release. The longer term solution might not make it to 3.6 and most likely be added to 4.0
Jeroen Bakker added this to the 3.6 LTS milestone 2023-03-27 14:05:44 +02:00
Jeroen Bakker added the
Interest
Images & Movies
label 2023-03-27 14:05:44 +02:00
Jeroen Bakker self-assigned this 2023-03-27 14:05:44 +02:00
Jeroen Bakker added 2 commits 2023-03-27 14:05:49 +02:00
Author
Member

@Sergey can you check if how the performance of the image editor is on your system?

@Sergey can you check if how the performance of the image editor is on your system?

@blender-bot package macos-x86_64

@blender-bot package macos-x86_64
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR106173) when ready.

As the performance goes the panning has smaller but more often hiccups. The zooming is still horrible.

When comparing to 3.4 the panning is faster (except of those hiccups), the zooming is still slower.

When comparing against 3.0, even after this changes the performance is not back to what it used to be. The 3.0 is still unbeatable when working with large 8bit PNGs.

As the performance goes the panning has smaller but more often hiccups. The zooming is still horrible. When comparing to 3.4 the panning is faster (except of those hiccups), the zooming is still slower. When comparing against 3.0, even after this changes the performance is not back to what it used to be. The 3.0 is still unbeatable when working with large 8bit PNGs.
Hans Goudey changed title from ImageEditor: Remove drawing artifacts. to Image Editor: Remove drawing artifacts 2023-03-27 16:39:23 +02:00
Author
Member

Thanks for the feedback. I will add the previous implementation back (3.0) when image is smaller than 8k. for larger images the current implementation will still be used.

I think that is the best approach to move forward. This will give smooth scrolling and zooming for images upto 8k. Larger images will have the same performance as this patch gives.

The 8K limit is based on my expertise what the largest memory allocation can be done on certain OpenGL platforms.

Thanks for the feedback. I will add the previous implementation back (3.0) when image is smaller than 8k. for larger images the current implementation will still be used. I think that is the best approach to move forward. This will give smooth scrolling and zooming for images upto 8k. Larger images will have the same performance as this patch gives. The 8K limit is based on my expertise what the largest memory allocation can be done on certain OpenGL platforms.
Jeroen Bakker added this to the EEVEE & Viewport project 2023-03-27 17:26:45 +02:00

@Jeroen-Bakker Forgot to mention, there are still some artifacts on the tile boundaries.

Interestingly, they even seem colored lines (red and pink) on the actual display. On the screenshot they are just discontinuity.

In any case, in 3.4 the same exact .blend file with same image configuration looks smooth.

@Jeroen-Bakker Forgot to mention, there are still some artifacts on the tile boundaries. Interestingly, they even seem colored lines (red and pink) on the actual display. On the screenshot they are just discontinuity. In any case, in 3.4 the same exact .blend file with same image configuration looks smooth.
Jeroen Bakker added 3 commits 2023-03-28 10:37:00 +02:00
Author
Member

Marking as WIP as current code isn't ready for review or testing.

  • Shaders are failing on macos.
  • Still researching how to draw with a single draw call.
Marking as WIP as current code isn't ready for review or testing. - Shaders are failing on macos. - Still researching how to draw with a single draw call.
Jeroen Bakker added 1 commit 2023-03-31 15:21:15 +02:00
Jeroen Bakker added 1 commit 2023-04-03 07:50:03 +02:00
Jeroen Bakker added 1 commit 2023-04-03 08:04:51 +02:00
Jeroen Bakker changed title from Image Editor: Remove drawing artifacts to WIP: Image Editor: Remove drawing artifacts 2023-04-03 10:38:56 +02:00
Jeroen Bakker added 2 commits 2023-04-03 14:18:35 +02:00
Jeroen Bakker added 1 commit 2023-04-04 09:03:23 +02:00
Jeroen Bakker added 1 commit 2023-04-04 10:00:34 +02:00
buildbot/vexp-code-patch-coordinator Build done. Details
50fa3ae949
Increased the number of texture to 36.
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR106173) when ready.
Jeroen Bakker changed title from WIP: Image Editor: Remove drawing artifacts to Image Editor: Remove drawing artifacts 2023-04-04 11:38:55 +02:00
Jeroen Bakker added 1 commit 2023-04-11 11:56:18 +02:00
Jeroen Bakker closed this pull request 2023-04-11 16:22:27 +02:00
Jeroen Bakker deleted branch image-editor-drawing-artifacts 2023-04-13 08:55:53 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
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 Assignees
3 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#106173
No description provided.