14
$\begingroup$

I've got a noisy render that I'd like to composite with slight lens distortion (Fit=True, Distort=0.03, Dispersion=0.001):

enter image description here enter image description here

I'm noticing a repeating pattern of square artifacts in the output of the lens distortion node. Here is zoomed in on the lens-distorted image:

enter image description here enter image description here

Is there a way to improve the quality of this lens distortion?

$\endgroup$
13
$\begingroup$

This is not a bug. It is simply how the the image manipulation algorithm works. This must be fairly common since Corel seems to use a similar algorithm in Paint Shop Pro:

enter image description here

It's worth noting that the square pattern only appears close to the center... outside the center it becomes more like a concentric circular pattern radiating out.

The reason for these artifacts is that you are distorting an image made up of square pixels. Ideally, this is what would happen to the pixel array:

enter image description here

However, you obviously cannot distort the pixels themselves and still have a proper 2D array that can be read by typical image software. So you must do some sort of combination of deleting and averaging of pixels. Because that can't be done on a pixel level (there are no fractions of pixels), the image must be subdivided into sections in order to deal with each subset. In the center, it makes sense to do this in square sections (since the distortion is minimal), but on the edges it should be concentric sections (since the distortion is circular in nature).

A uniformly noisy image (with large, flat, mono-chromatic planes) is pretty much the worst case scenario for this algorithm because of the contrast between individual pixels on sections that would otherwise have little variation. You probably wouldn't even notice the artifacts on a smooth image unless you were really pixel-peeping. Here's the same distortion applied to an image rendered at 500 samples:

enter image description here

In short, this is to be expected. The only way I know to reduce the effect is to apply noise reduction before distortion in your Composite node chain, or start with a less noisy image. Essentially, the lower the contrast between individual pixels, the less visible the artifacts will be.

| improve this answer | |
$\endgroup$
  • 3
    $\begingroup$ I agree with @bertmoog that increasing the samples will help. As a workaround, try to render the image at a higher resolution (or a larger image size) and then resize it back to the intended image size to make the artifacts less noticeable. $\endgroup$ – user1853 Oct 5 '17 at 20:53
-1
$\begingroup$

Are you saving and loading your render between steps?

This looks more like a JPEG blocking artifact than any kind of interpolation / rounding bug, but it only applies if you're saving the output from rendering the noisy image and reloading it to apply the lens distortion.

See https://photo.stackexchange.com/a/29646 for an example, the last sample image with visual block structure. If this is the case, saving as PNG or TGA or nearly anything other than JPG will fix the squares, since it's the JPG format itself that's adding them.

| improve this answer | |
$\endgroup$
  • 3
    $\begingroup$ The issue is visible before saving the image into any format. It is indeed caused by the lens distortion node (as explained by @bertmoog) $\endgroup$ – user1853 Oct 5 '17 at 23:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.