Sign in to follow this  
g t

Pixel grid rendering problems when zooming

Recommended Posts

I noticed that at certain zoom levels the pixel grid is rendered unevenly. This gives the image a 'speckled' appearance as if it had light grey dots all over it.

The effect is easily seen when using Ctrl+Scroll on the mouse wheel to zoom.

Attached is a zoomed version of the problem, at a zoom level around 480%.

 

I noticed this with and without hardware acceleration.

 

To reproduce:

1. Start with new image (white background) and pixel grid enabled

2. Ctrl+Scroll mouse until around 400%-500% zoom (I was at 448% but visible at other zoom levels)

--> pixel grid has speckled appearance

 

Issues/Expectations

 

It seems that there are a few issues that cause this effect:

1. when two pixel grid lines overlap they get darker

 -> expected: pixel grid should have a uniform color

2. adjacent pixel grid lines do not necessarily have their pixels in the same position, causing a seemingly random (Moiré-like) pattern

 -> expected: pixels in adjacent lines should line up

3. the pixel grid spacing varies, probably due to rounding. The attached example shows a spacing of either every 4 or 5 pixels.

 -> expected: hard to avoid. perhaps a different zoom mode that only allows zoom levels that result in a uniform pixel size?

 

Otherwise, perhaps solid lines could be used below a certain zoom level to avoid the dotted line Moiré effect. 

 

Diagnostics

Application    paint.net 4.0.21 (Final 4.21.6589.7045)
Build Date    Montag, 15. Januar 2018
Install type    Classic
    
Hardware accelerated rendering (GPU)    True
Animations    True
DPI    96,00 (1,00x scale)
Language    en-US
    
OS    Windows 7 Enterprise Service Pack 1 x64 (6.1.7601.65536) (0x4)
.NET Runtime    4.0.30319.42000
Physical Memory    16.263 MB
    
CPU    Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
    Speed    ~2712 MHz
    Cores / Threads    4 / 8
    Features    DEP, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, XSAVE
    
Video Card    NVIDIA Quadro M2000M
    Dedicated Video RAM    4.034 MB
    Dedicated System RAM    0 MB
    Shared System RAM    7.875 MB
    Vendor ID    0x10DE
    Device ID    0x13B0
    Subsystem ID    0x80D5103C
    Revision    162
    LUID    0x0001CBCC
    Flags    None
    Outputs    2
    
Video Card    Intel(R) HD Graphics 530
    Dedicated Video RAM    192 MB
    Dedicated System RAM    0 MB
    Shared System RAM    1.632 MB
    Vendor ID    0x8086
    Device ID    0x191B
    Subsystem ID    0x80D5103C
    Revision    6
    LUID    0x0001CEE3
    Flags    None
    Outputs    0

 

pixelgrid.png

Edited by g t

Share this post


Link to post
Share on other sites

The pixel grid can't render perfectly at non-integral zoom levels. It's just the nature of rendering with a finite number of pixels.

Share this post


Link to post
Share on other sites

Thanks for the reply. I understand that the uneven spacing between grid lines is probably unavoidable.

 

However, issue #1 (that grid pixels get darker when plotted on top of each other) seems like a minor bug.

 

Issue #2 (that grid pixels do not line up) would seem to me to be avoidable too (probably depends on the algorithm), so any 'errors' would at least be distributed evenly across the grid.

 

An attached zoomed in image shows these two problems more clearly, so the upper horizontal line starts at offset 1 and the lower at offset 0.

 

If this solution is too difficult, I would suggest again using solid lines at non-integral zoom levels.

 

The uneven grid rending is very distracting when editing zoomed images as it appears the image has 'randomly' scattered light grey pixels on an otherwise white background.

pixelgrid2.png

Share this post


Link to post
Share on other sites

Okay, I see what you mean. I've filed a bug to investigate this at some point, although I'm not sure when it'll float to the top of the queue

Share this post


Link to post
Share on other sites

I've got a fix for issue #1 that'll be in the upcoming 4.1.2 update. This was pretty easy to fix by rendering to a layer* first at full opacity, and then composing the layer on top of the canvas with the desired opacity. Compare this to 4.1.1 and earlier where the grid pixels were all drawn directly to the canvas at the desired opacity -- so, as you saw, grid pixels that overlapped would get darker.

 

* a Direct2D layer, not a Paint.NET layer :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this