Horrible downscaling of PNG grids in DR17 Beta 1

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline

peterbaumann

  • Posts: 128
  • Joined: Tue Apr 16, 2019 7:23 pm
  • Real Name: Peter Baumann

Horrible downscaling of PNG grids in DR17 Beta 1

PostSat Nov 21, 2020 8:06 pm

I'm working with some grids for lockdown-style music videos which have been created in Affinity Designer at 4k resolution. I've found that most of rescaling filters in Resolve don't work well for these pngs, resulting in black/white outlines or an embossed look around the gridlines. From my tests, nearest neighbour/bilinear can give ok results, but anything with angled lines looks horribly jagged as demonstrated by the video below. Oddly, the left-to-right diagonal line seems to be more of an issue for the scaler than the top-to-bottom line.



I know that as a temporary workaround I can rescale the grids in Affinity to 1080p to remove the jagged edges (presumably as Resolve isn't having to scale the images anymore), but is there any way to improve scaled PNGs in Resolve natively? Logos in particular can be particularly troublesome to work with in Resolve (either producing similarly jagged edges or blotchy edges) and it's a pain to have to take everything into a third party app to adjust before bringing them back into Resolve.
M1 Max Macbook Pro 16-inch (2021)
OS Monterey 12.6.1
Apple M1 Max
10-Core CPU
32-Core GPU
64GB RAM

Intel MacBook Pro 15-inch (2018)
OS Catalina 10.15.7
2.6GHz 6-Core Intel Core i7
32GB RAM
Radeon Pro Vega 20 4GB
Offline
User avatar

Dmytro Shijan

  • Posts: 1766
  • Joined: Wed Sep 17, 2014 7:15 pm
  • Location: UA

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostSun Nov 22, 2020 12:14 am

There are a lot of new (almost hidden) Image Scaling Options in Resolve 17. To see that list you need switch Resize filter to "Custom". Try them...

Image
BMMCC/BMMSC Rigs Collection https://bmmccrigs.tumblr.com
My custom made accessories for BMMCC/BMMSC https://lavky.com/radioproektor/
Offline
User avatar

Dmytro Shijan

  • Posts: 1766
  • Joined: Wed Sep 17, 2014 7:15 pm
  • Location: UA

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostSun Nov 22, 2020 12:35 am

Another option - try change Alpha mode in Clip Attributes.
Seems Resolve can't smoothly downscale edges in transparent images.
Screen Shot 2020-11-22 at 2.31.14 AM.jpg
Screen Shot 2020-11-22 at 2.31.14 AM.jpg (33.52 KiB) Viewed 3222 times
BMMCC/BMMSC Rigs Collection https://bmmccrigs.tumblr.com
My custom made accessories for BMMCC/BMMSC https://lavky.com/radioproektor/
Offline

peterbaumann

  • Posts: 128
  • Joined: Tue Apr 16, 2019 7:23 pm
  • Real Name: Peter Baumann

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostMon Nov 23, 2020 12:08 pm

Unfortunately the alpha mode didn't seem to make any difference (apart from 'None' and 'Invert' which don't work for this kind of thing).

I cycled through the scaling options using the Inspector panel on the right so it's per-clip and Nearest Neighbour was probably the best, but as is shown in the original video it's still noticeably worse than a 1080p png on a 1080p timeline. Almost all the other options add weird black/white lines or emboss-style effects to the boxes if I use those so I'm pretty much stuck with downscaling externally for now.

Anyone from Blackmagic able to confirm that this is the only solution at the moment?
M1 Max Macbook Pro 16-inch (2021)
OS Monterey 12.6.1
Apple M1 Max
10-Core CPU
32-Core GPU
64GB RAM

Intel MacBook Pro 15-inch (2018)
OS Catalina 10.15.7
2.6GHz 6-Core Intel Core i7
32GB RAM
Radeon Pro Vega 20 4GB
Offline

Hendrik Proosa

  • Posts: 3312
  • Joined: Wed Aug 22, 2012 6:53 am
  • Location: Estonia

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostMon Nov 23, 2020 12:38 pm

Do not use sharpening filters on plain color graphics. Sharpen effect comes from specific filtering kernel and inevitably will produce a high-contrast edge that you see. Cubic, gaussian, quadratic and linear should be safe (if they are mucked up it is imho a bug). Lanczos and Sinc are sharpening filters, nearest neighbor can create aliasing artifacts. Mitchell is somewhat between softening and sharpening. What Box, Bessel and Catmull-Rom do, I don't know.
I do stuff
Offline

peterbaumann

  • Posts: 128
  • Joined: Tue Apr 16, 2019 7:23 pm
  • Real Name: Peter Baumann

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostMon Nov 23, 2020 1:05 pm

Thanks for the explanation, very helpful. I've uploaded another video with all of the filters for comparison. I don't think any of the 4k grids downscaled in Resolve are usable to be honest (these are with the Alpha mode set to Straight).

M1 Max Macbook Pro 16-inch (2021)
OS Monterey 12.6.1
Apple M1 Max
10-Core CPU
32-Core GPU
64GB RAM

Intel MacBook Pro 15-inch (2018)
OS Catalina 10.15.7
2.6GHz 6-Core Intel Core i7
32GB RAM
Radeon Pro Vega 20 4GB
Offline

Hendrik Proosa

  • Posts: 3312
  • Joined: Wed Aug 22, 2012 6:53 am
  • Location: Estonia

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostMon Nov 23, 2020 3:15 pm

What color management are you using by the way? This kind of artifacts can creep out when filtering is done on nonlinear values, because it can produce a mismatch between rgb channels and associated alpha. To put it bluntly, any operations done with alpha on nonlinear values produces errors, how noticeable it is, depends on exact color handling.
I do stuff
Offline

peterbaumann

  • Posts: 128
  • Joined: Tue Apr 16, 2019 7:23 pm
  • Real Name: Peter Baumann

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostMon Nov 23, 2020 3:34 pm

Davinci YRGB, which I think is the default one? Don't think I've changed it since downloading the DR17 Beta and creating a test database.
Attachments
Screenshot 2020-11-23 at 15.32.13.png
Screenshot 2020-11-23 at 15.32.13.png (154.06 KiB) Viewed 3107 times
Screenshot 2020-11-23 at 15.32.17.png
Screenshot 2020-11-23 at 15.32.17.png (149.51 KiB) Viewed 3107 times
M1 Max Macbook Pro 16-inch (2021)
OS Monterey 12.6.1
Apple M1 Max
10-Core CPU
32-Core GPU
64GB RAM

Intel MacBook Pro 15-inch (2018)
OS Catalina 10.15.7
2.6GHz 6-Core Intel Core i7
32GB RAM
Radeon Pro Vega 20 4GB
Offline

peterbaumann

  • Posts: 128
  • Joined: Tue Apr 16, 2019 7:23 pm
  • Real Name: Peter Baumann

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostWed Nov 25, 2020 11:45 am

Anyone know if the downscaling issue is 'expected behaviour' or whether it's a bug/something wrong in the settings?

I've uploaded an archive of the project here if anyone wants to test on their system: https://drive.google.com/drive/folders/10lJNk6PlMCIA07CrosOjM4_1DG_IwTXc?usp=sharing
M1 Max Macbook Pro 16-inch (2021)
OS Monterey 12.6.1
Apple M1 Max
10-Core CPU
32-Core GPU
64GB RAM

Intel MacBook Pro 15-inch (2018)
OS Catalina 10.15.7
2.6GHz 6-Core Intel Core i7
32GB RAM
Radeon Pro Vega 20 4GB
Offline

Florian Gintenreiter

  • Posts: 108
  • Joined: Tue Mar 05, 2013 2:29 pm
  • Location: Vienna, Austria

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostSat Dec 05, 2020 10:45 pm

I ran into the same problem with PNG logo graphics. The same issue plagued some Resolve 15 Betas back in 2018. I wrote a forum post about the same thing then. It seems to be back and I'm having the issue on Resolve Beta 3.

https://forum.blackmagicdesign.com/viewtopic.php?f=21&t=74766
Hardware: MacBookPro 16" 2023, M3 Max, 64GM Ram, Blackmagic Ultra Studio 4K mini, Resolve Micro Panel, Speed Editor, PreSonus 26c Audio Interface
Offline
User avatar

Stefano Marconcini

  • Posts: 91
  • Joined: Fri Feb 26, 2016 7:05 am
  • Location: Italy

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostThu Dec 31, 2020 10:52 am

The problem still there on beta 6.
WIN10, i9 9900K 3.6Ghz, Gigabyte Z390 PRO AORUS, Gtx 3080 latest studio driver, 64 GB RAM Crucial, M2 EVO Samsung 512, Mini monitor (used) Intensity Pro 4K (on board but not used), Mini Panel, Speed Editor

MacBook M1 MAX - SONOMA - 32 core - 32 Gb RAM
Offline

richards

  • Posts: 75
  • Joined: Sun Nov 22, 2020 7:47 pm
  • Real Name: Richard Sim

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostThu Dec 31, 2020 11:08 pm

peterbaumann wrote:Anyone know if the downscaling issue is 'expected behaviour' or whether it's a bug/something wrong in the settings?
Stefano Marconcini wrote:The problem still there on beta 6.
I've just done some exhaustive tests of Resolve's alpha compositing of PNGs, and my conclusion is that Resolve is handling alpha and filtering correctly in most situations. The only situation I've found that it is doing the wrong thing is, oddly enough, when playback is paused and filtering is set to a non-trivial mode (e.g. Sharper, Smoother, etc; Bilinear, Nearest Neighbour, etc are unaffected by this). But even in those cases, as soon as playback is started the alpha filtering is displayed correctly.

I believe the problem people are seeing is the unfortunately non-intuitive behaviour of alpha compositing. For something that almost everybody (and I constantly get tripped up by too despite 'knowing' better, now) believes should be/is a trivial thing, it's actually surprisingly hard to get right. It goes back to how the source images are made - not how Resolve is handling them. The short answer is the mysterious "Premultiplied" alpha mode is the best way to get the results you intuitivly expect, except the use of premultiplied alpha is complex/poorly supported/quite unintuitive itself. Premultiplied alpha was specifically invented (well, technically it's the mathematically correct compositing operation, so invented isn't the right word - maybe discovered) for compositing.

A good introduction and overview is this article: https://limnu.com/premultiplied-alpha-primer-artists/

If anyone wants to read the source material for this, the research paper (Compositing Digital Images, Porter & Duff, Lucasfilm, 1984) is still available from Pixar: https://graphics.pixar.com/library/Compositing/

*edit: Re-reading this, it comes off a bit... holier than thou. Not my intent. To give a concrete explanation back to the original posters question about PNG files coming from Affinity Designer, the very last bullet point in the article I linked is the key to it all: "PNG images are always stored unmasked (unpremultiplied)". What that means is that Affinity Designer has to store something in the PNG's transparent areas - but you haven't put anything in those areas, they're transparent after all! If you dig into Affinity Designer's Export > PNG > More... there's a Matte colour. It seems a little broken (the default "transparent swatch" shows up as RGB 255,0,0, but it's actually using transparent black), but if you change it to a colour, it'll use that in all the transparent areas of the PNG. The default transparent black is correct however, so just leave it as that. The good news is that, using transparent black is the correct thing for "Premultiplied" alpha! But bad news is, it's not the default "Straight" alpha.

So if the default is correct, why isn't Premultiplied working? Tough to answer without having the source Affinity Designer file and PNG's to check.
Last edited by richards on Fri Jan 01, 2021 12:15 am, edited 1 time in total.
HW: AMD Ryzen 9 3900X, 64GB DDR4 3600 CL16 RAM, 3x2TB NVMe SSDs (1xGen4, 2xGen3), 8GB Nvidia GeForce RTX 2070 Super, dual monitor (4k, 1080P)
SW: DaVinci Resolve Studio 17b7, Win10 Pro 20H2, Nvidia Studio Driver 460.89, latest BIOS/chipset/drivers/etc.
Offline
User avatar

Stefano Marconcini

  • Posts: 91
  • Joined: Fri Feb 26, 2016 7:05 am
  • Location: Italy

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostThu Dec 31, 2020 11:33 pm

Thank you Richard, but into Fusion all works good.
WIN10, i9 9900K 3.6Ghz, Gigabyte Z390 PRO AORUS, Gtx 3080 latest studio driver, 64 GB RAM Crucial, M2 EVO Samsung 512, Mini monitor (used) Intensity Pro 4K (on board but not used), Mini Panel, Speed Editor

MacBook M1 MAX - SONOMA - 32 core - 32 Gb RAM
Offline

richards

  • Posts: 75
  • Joined: Sun Nov 22, 2020 7:47 pm
  • Real Name: Richard Sim

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostFri Jan 01, 2021 2:19 am

I got ahead of myself when I said that Resolve seems to be handling alpha compositing correctly - I'd only tested Straight alpha, but it appears that Premultiplied is pretty much unusably broken. I have to do more testing, but right now it just doesn't act right at all in my tests, and when it's used the Composite Mode of clips in the timeline appears to be ignored.

Stefano Marconcini wrote:Thank you Richard, but into Fusion all works good.
It might be something about where Fusion comps sit in the data flow in Resolve compared to where Timelines/clips are composited. I'll add it to my list of things to try soon. First, figuring out what's up with Premultiplied...
HW: AMD Ryzen 9 3900X, 64GB DDR4 3600 CL16 RAM, 3x2TB NVMe SSDs (1xGen4, 2xGen3), 8GB Nvidia GeForce RTX 2070 Super, dual monitor (4k, 1080P)
SW: DaVinci Resolve Studio 17b7, Win10 Pro 20H2, Nvidia Studio Driver 460.89, latest BIOS/chipset/drivers/etc.
Offline
User avatar

Stefano Marconcini

  • Posts: 91
  • Joined: Fri Feb 26, 2016 7:05 am
  • Location: Italy

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostMon Jan 04, 2021 10:54 pm

Thank you.


Inviato dal mio iPhone utilizzando Tapatalk
WIN10, i9 9900K 3.6Ghz, Gigabyte Z390 PRO AORUS, Gtx 3080 latest studio driver, 64 GB RAM Crucial, M2 EVO Samsung 512, Mini monitor (used) Intensity Pro 4K (on board but not used), Mini Panel, Speed Editor

MacBook M1 MAX - SONOMA - 32 core - 32 Gb RAM
Offline

richards

  • Posts: 75
  • Joined: Sun Nov 22, 2020 7:47 pm
  • Real Name: Richard Sim

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostTue Jan 05, 2021 12:30 am

I forgot to post an update to this saga - it turns out a lot of my testing has been invalidated by a caching bug in Resolve unfortunately. Despite having the Render Cache set to None, Resolve is caching the "result" of the image somewhere, and would not update that cached version even if I removed the image from both the timeline and the project's Media entirely. No wonder I was seeing such odd and unpredictable results!

The only reliable workaround for the caching that I've found so far was to change the length of the image's clip in the timeline, which does appear to force a refresh of the cached version.

The bad news is that even with that workaround, Premultiplied alpha isn't handled correctly. It's certainly more correct than I'd seen in my last test, but it'll still result in black fringes due to the incorrect Compositing Mode being used. You can choose different Compositing Modes (thanks bug...), but none of them are what's actually needed for Premultiplied. The modes at the end of the list (Foreground, Alpha, etc) don't seem to do anything; I was hoping that one of those would be a poorly named, but correct, mode, and maybe they're supposed to be if they worked.

I haven't re-tested Straight alpha, mainly because it'll never give correct downsampling so will always have fringes (see my first post about the math).
HW: AMD Ryzen 9 3900X, 64GB DDR4 3600 CL16 RAM, 3x2TB NVMe SSDs (1xGen4, 2xGen3), 8GB Nvidia GeForce RTX 2070 Super, dual monitor (4k, 1080P)
SW: DaVinci Resolve Studio 17b7, Win10 Pro 20H2, Nvidia Studio Driver 460.89, latest BIOS/chipset/drivers/etc.
Offline

richards

  • Posts: 75
  • Joined: Sun Nov 22, 2020 7:47 pm
  • Real Name: Richard Sim

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostTue Jan 05, 2021 12:52 am

Here's a project that demonstrates the issue with Premultiplied alpha - or more specifically, the incorrect Compositing Mode that it uses (because the correct one doesn't exist). Resolve team, please add the required [One, InvSrcAlpha] Composite Mode!

One note about the project: I used a TIFF image rather than a PNG, because the PNG format explicitly does not support premultiplied alpha, whereas the TIFF format does. It's a major pain in the ass to generate correct Premultiplied content...

The resulting black fringes:
AlphaBlendingTest-01.png
AlphaBlendingTest-01.png (5.54 KiB) Viewed 2827 times


AlphaBlendingTest-01.dra.zip
(512.24 KiB) Downloaded 110 times
HW: AMD Ryzen 9 3900X, 64GB DDR4 3600 CL16 RAM, 3x2TB NVMe SSDs (1xGen4, 2xGen3), 8GB Nvidia GeForce RTX 2070 Super, dual monitor (4k, 1080P)
SW: DaVinci Resolve Studio 17b7, Win10 Pro 20H2, Nvidia Studio Driver 460.89, latest BIOS/chipset/drivers/etc.
Offline

peterbaumann

  • Posts: 128
  • Joined: Tue Apr 16, 2019 7:23 pm
  • Real Name: Peter Baumann

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostTue Jan 05, 2021 12:50 pm

Thanks for running all these tests, @richards.

Fingers crossed BM are looking into this and can add it to an upcoming beta release!
M1 Max Macbook Pro 16-inch (2021)
OS Monterey 12.6.1
Apple M1 Max
10-Core CPU
32-Core GPU
64GB RAM

Intel MacBook Pro 15-inch (2018)
OS Catalina 10.15.7
2.6GHz 6-Core Intel Core i7
32GB RAM
Radeon Pro Vega 20 4GB
Offline

peterbaumann

  • Posts: 128
  • Joined: Tue Apr 16, 2019 7:23 pm
  • Real Name: Peter Baumann

Re: Horrible downscaling of PNG grids in DR17 Beta 1

PostSun Feb 07, 2021 12:14 pm

At first glance, it seems this has been fixed in beta 8. Thanks BM.

I've re-rendered the test video in Beta 8 here:
M1 Max Macbook Pro 16-inch (2021)
OS Monterey 12.6.1
Apple M1 Max
10-Core CPU
32-Core GPU
64GB RAM

Intel MacBook Pro 15-inch (2018)
OS Catalina 10.15.7
2.6GHz 6-Core Intel Core i7
32GB RAM
Radeon Pro Vega 20 4GB

Return to DaVinci Resolve

Who is online

Users browsing this forum: Bing [Bot], dirk-pel, Fully_Loaded34, KrunoSmithy, Mads Johansen, qsipher, Robert John and 266 guests