Bug 414983 - Motion Blur filter gives 512 x 512 tiling edge artifacts
Summary: Motion Blur filter gives 512 x 512 tiling edge artifacts
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Filters (show other bugs)
Version: 4.2.8
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-09 16:27 UTC by Ahab Greybeard
Modified: 2020-03-10 13:24 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahab Greybeard 2019-12-09 16:27:50 UTC
SUMMARY
This was reported in the Krita Artists Forum: https://krita-artists.org/t/motion-blur-bug/1720

This happens for krita version 4.2.6 onwards to the latest Dec 08 Windows nightly portable .zip.

Here is an examples file (100MB .kra) made with the 4.2.8 appimage: https://www.dropbox.com/s/wbfi3uton2q5byi/MBTilingOriginal.kra?dl=1

This contains two different 8-bit RGB images which have had the Motion Blur filter applied. Also, it has an edge detected (Prewitt, All Sides, 1x1) image to emphasise the artifacts.
I used manual application rather that a filter layer in case the filter layer operations added any extra artifact effects.

An edge detected version of the original image is included to ensure that the edge detection filter does not introduce artifacts, which it does not (but see Additional Notes a:).

I tried it with the original images converted to 16-bit integer images and saw no noticable differences in the artifacts. (See Additional Notes b:)

STEPS TO REPRODUCE
1. Apply a Motion Blur fliter to the image. If you adjust the Angle parameter (using the rotation dial at first) around the zero degrees value +/- 20 degrees you generally get line artifacts appearing. But they can appear all around the dial.

2. Fine adjustment of Angle value can make them worse or better.

3. Length values of 4 or less seem to give no artifacts. Length values of 5 or more do generally give artifacts but very large values of 30 or more do not, it seems. (Only limited testing was done.)

4. Use of the edge detection filter helps to emphasise and also reveal faint artifacts.

OBSERVED RESULT
See the attached .kra file

EXPECTED RESULT
There should be no artifacts

SOFTWARE/OS VERSIONS
Krita

 Version: 4.2.8
 Languages: en_GB, en
 Hidpi: true

Qt

  Version (compiled): 5.12.5
  Version (loaded): 5.12.5

OS Information

  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 4.19.0-6-amd64
  Pretty Productname: Debian GNU/Linux 10 (buster)
  Product Type: debian
  Product Version: 10

OpenGL Info
 
  Vendor:  "NVIDIA Corporation" 
  Renderer:  "GeForce GTX 750 Ti/PCIe/SSE2" 
  Version:  "4.6.0 NVIDIA 418.74" 
  Shading language:  "4.60 NVIDIA" 
  Requested format:  QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
  Current format:    QSurfaceFormat(version 4.6, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
     Version: 4.6
     Supports deprecated functions true 
     is OpenGL ES: false 

QPA OpenGL Detection Info 
  supportsDesktopGL: true 
  supportsOpenGLES: true 
  isQtPreferOpenGLES: false 

Hardware Information

  GPU Acceleration: auto
  Memory: 16039 Mb
  Number of Cores: 8
  Swap Location: /tmp

Current Settings

	Current Swap Location: /tmp
	Undo Enabled: 1
	Undo Stack Limit: 18
	Use OpenGL: 1
	Use OpenGL Texture Buffer: 1
	Use AMD Vectorization Workaround: 0
	Canvas State: OPENGL_SUCCESS
	Autosave Interval: 360
	Use Backup Files: 1
	Number of Backups Kept: 1
	Backup File Suffix: ~
	Backup Location: Same Folder as the File
	Use Win8 Pointer Input: 0
	Use RightMiddleTabletButton Workaround: 0
	Levels of Detail Enabled: 0
	Use Zip64: 0

ADDITIONAL INFORMATION
a: As used, with default values, the edge detection filter introduces no artifacts. If you use Formula:Any, Output:some Edge option, Radius:Any then you get horizontal artifacts at a 512 spacing, even on a plain colour image. This may need to be the subject of a separate bug report.

b: With 16 bit images, the edge detection applied to the original images is notably different from the result of applying it to 8-bit images. This is not related to the purpose of this bug report and there may be a logical explanation but it seems strange.
Comment 1 Tiar 2019-12-12 11:09:29 UTC
From my testing is seem to happen from 4.2.0-preview onwards.
Comment 2 Dmitry Kazakov 2020-03-10 13:24:49 UTC
Git commit a5c1f8a0bf2d2d3ee7f4b1ad86ada04e6bc50e0c by Dmitry Kazakov.
Committed on 10/03/2020 at 13:23.
Pushed by dkazakov into branch 'master'.

Fix artifacts in Motion Blur filter

1) Kernel size should be odd to do convolution right
2) halfWidth/halfHeight should be calculated consistently in all the
   three functions. Before the ptch there was a misprint in needRect
   and changeRect: both used 'cos' for both width and height.

M  +1    -1    libs/image/kis_lod_transform.h
M  +43   -53   plugins/filters/blur/kis_motion_blur_filter.cpp

https://invent.kde.org/kde/krita/commit/a5c1f8a0bf2d2d3ee7f4b1ad86ada04e6bc50e0c