Search Unity

Bug Recorder - Case 1423485 - Premultiplied Alpha Bug - PNG and EXR

Discussion in 'Audio & Video' started by newguy123, Nov 10, 2021.

  1. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Hi Guys

    Unity 2021.2.1f1+ HDRP 12.1+ with Raytracing (WITH TAA instead of DLSS):
    Makes no difference if it's TAA or DLSS

    This looks like a bug to me related to pre multiply alpha issue. PNG and EXR results in same issue. You get jaggy alpha edges

    I'm rendering out PNG with alpha. I have a Physcial Based Sky as my environment, and on my cam I've set the background to pure black color.

    However, my image sequence have LOADS of shimmer/flickering around the outer edges of the CG elements, where the sky touches my cg elements. That same outer edges also appear to have no anti-aliasing. The cg itself is fine and with practically 0 flicker and practically perfect anti-aliasing

    Here's a portion of the render at 200%:
    upload_2021-11-10_21-31-46.png

    and with the alpha:
    upload_2021-11-10_21-32-17.png


    This is from the EXR, but PNG gives same result. You can clearly see the jaggy edges.

    I also tried in Resolve/Fusion, and it looks the same.
     
    Last edited: Aug 18, 2022
  2. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    In resolve with staright alpha:
    upload_2021-11-11_10-9-17.png

    In resolve with premultiplied alpha:
    upload_2021-11-11_10-10-0.png

    Clearly there's an issue

    @vladala could you take a look for me please
     
    Last edited: Nov 11, 2021
  3. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    I've also tried various AA options, all with same jaggy alpha edge result
    DLSS
    TAA - Medium
    No AA

    All the same on alpha edges (of course "inside" the cg parts, the AA is different based on the AA I choose, but on the background alpha edges, its still a mess)
     
  4. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Investigating some more, and I wonder perhaps if this could help troubleshoot thigns:

    Here I have a custom pass volume, white assigned. Injection point: "BEFORE Post Process"
    (things seem fine and I could probably output this and use it as my alpha, but then I have to run the output twice, and over 8000 frames, that could take some time.
    upload_2021-11-12_15-48-7.png

    Next up, same as above, but injection point: "AFTER Post Process"
    upload_2021-11-12_15-49-46.png

    Looking at those 2 shots, it feels to me its the wrong way around. I would expect the smoother, correct one to be the AFTER Post process, but from these screenshots, it seems its the wrong way around.
     
  5. antoinecharton

    antoinecharton

    Unity Technologies

    Joined:
    Jul 22, 2020
    Posts:
    189
    Hello,

    Thanks for all the infos we are taking a look at it.
     
    newguy123 likes this.
  6. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Thanks @antoinecharton , looking forward to your findings
     
  7. antoinecharton

    antoinecharton

    Unity Technologies

    Joined:
    Jul 22, 2020
    Posts:
    189
    I have logged a bug for it we will see what we can do. We found issues with it without Raytracing as well. For your problem I don't have a way around until we fix it other than the one you already found with AOV. One suggestion you could try is using additive alpha with some tweaking you could have similar outputs as premultiplied. It's a way around but until then it might do the trick for you.

    Let me know if you find anything else :).
     
    newguy123 likes this.
  8. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Any light at the end of the tunnel on this issue @antoinecharton ?
    Could you maybe give us the bug number so I can check when it is fixed....
     
  9. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Last edited: Jan 23, 2022
  10. antoinecharton

    antoinecharton

    Unity Technologies

    Joined:
    Jul 22, 2020
    Posts:
    189
  11. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
  12. antoinecharton

    antoinecharton

    Unity Technologies

    Joined:
    Jul 22, 2020
    Posts:
    189
    Not yet. We are gonna do a pass on graphic bugs soon and this one is in the list. Just to be completely transparent if the problem is not in the recorder package it might be a bit longer to solve.
    The issue tracker is directly linked to our jira so as soon as someone starts looking at it it will be updated in progress.
     
    newguy123 likes this.
  13. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Thanks, looking forward to it

    Keep up the good work
     
    antoinecharton likes this.
  14. antoinecharton

    antoinecharton

    Unity Technologies

    Joined:
    Jul 22, 2020
    Posts:
    189
    Hello,
    Could you try changing the post-processing buffer format to R16G16B16A16 (HDRP asset -> Post-processing -> Buffer Format). It should at least remove the weird aliasing you see on the alpha map.
    Let us know if that solve/improve your issue.
     
  15. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Tried that, didnt help in my case
     
  16. antoinecharton

    antoinecharton

    Unity Technologies

    Joined:
    Jul 22, 2020
    Posts:
    189
    Could you share the output you had with this setting? I am looking for a difference between what you had and what you got now. It will help us rule out some problems :)
     
  17. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Sorry for the late reply @antoinecharton
    Here's my settings:
    upload_2022-2-3_10-56-18.png

    And here is the wrong output it produces (PNG file displayed in Photoshop and zoomed 200%):
    upload_2022-2-3_10-57-24.png

    For giggles:
    upload_2022-2-3_10-58-58.png

    But output still the same:
    upload_2022-2-3_10-59-22.png

    But the setting make no difference:
    upload_2022-2-3_11-0-44.png
     
  18. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    (carryin on from previous message due to 5 atachment limit per message)
    upload_2022-2-3_11-1-59.png

    upload_2022-2-3_11-2-41.png

    upload_2022-2-3_11-3-15.png

    Unity 2021.2.2f1 with Raytracing, Recorder 4.0.0-pre.2
     
  19. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Cam settings:

    upload_2022-2-3_11-4-45.png
     
    antoinecharton likes this.
  20. antoinecharton

    antoinecharton

    Unity Technologies

    Joined:
    Jul 22, 2020
    Posts:
    189
    Hello,

    The team found where the issue was coming from. DLSS doesn't support alpha channels and the limitation comes from the Nvidia side (their DLSS SDK). Unfortunately we can't do anything about it.

    In your case you could try using TAA Upscale. We checked it and it works correctly with Alpha channel.

    Let us know if this works for you. We could add this in the limitations and solutions of the recorder if this does the trick.
     
  21. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Hmmm @antoinecharton I'm afraid that still doesnt work. It just smudges the heck out of the image, and then the alpha looks exactly the same:

    upload_2022-2-16_19-29-43.png

    upload_2022-2-16_19-34-39.png
     
  22. antoinecharton

    antoinecharton

    Unity Technologies

    Joined:
    Jul 22, 2020
    Posts:
    189
    Hello,

    Sorry it didn't work. Could you send a repro project. Help -> Report a bug. If this is possible try to remove everything you can not related to the bug.

    In the details just put a link to this thread.

    Once done send me the ID.
     
  23. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Ive now finally submitted a bug report for this @antoinecharton
    (Case 1423485) Alpha AA bug against background when Rendering with Recorder

    I used a NEW scene using latest Unity 2022.2.0a11 and HDRP and Recorder 4.0.0-pre.4

    There is only a cube in the scene and a single tree with grey material assigned.

    Here is screenshot from opened in Photoshop, and comped over a red/pink(ish) colour to make the alpha issue more apparent (PNG and EXR tests result in same look)

    This is crop of a 4K render with TAA:
    upload_2022-4-27_17-43-53.png

    And here's one with DLSS instead of the TAA that I used in my bug report. Its slightly better, but still very noticable
    upload_2022-4-27_17-58-34.png

    And if I switch on Accumulation and set samples to 8, it gets even weirder as now it adds a white edge to the inside LOL
    upload_2022-4-27_18-2-0.png
     
    Last edited: Apr 27, 2022
  24. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Accumulation set to 32 samples (cam using TAA on High Preset)
    upload_2022-4-28_11-43-37.png
     
    Last edited: Apr 28, 2022
  25. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Accumulation set to 128 samples (cam using TAA on High Preset. There is no animation in the scene, not from the cube or the cam, but something weird going on for sure)
    upload_2022-4-28_11-48-1.png
     
  26. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    DLSS on Cam with Accumulation 128. Getting there.But still some weird halo type of white effect on the inside of outer edges:
    upload_2022-4-28_11-54-10.png
     
  27. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    SMAA with 128 Accumulation. Upper edges still have jaggies:

    upload_2022-4-28_12-1-30.png
     
  28. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    I dont want to bother checking with MSAA as I eventually need Raytraxcing/Pathtracxing enabled also and MSAA doesnt work with that
     
  29. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    EDIT: Added the case number to the thread title
    Case 1423485
     
  30. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Sooooo, what now?
     
  31. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    I just noted the "resolution note" for the issue tracker:
    upload_2022-8-17_11-31-25.png

    Are you kidding me? Do the QA guys have any compositinig experience AT ALL?

    Even just the fact that they don't note the correct problem is mind boggling

    upload_2022-8-17_11-33-29.png


    Can a senior person at Unity, that knows something about compositing, please update the issue with the correct problem, and note that there is no current solution. The issue is present with AND without DLSS so it has nothing to do with DLSS. No matter what AA solution you set, the alpha is totally ignored in terms of AA. I'm not sure how much clearer I should be making my examples.....

    @antoinecharton
    @markvi
    @vladala
     
  32. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    I just checked the Jira ticket and @vladala is the one that resolved the bug. I see that he is away until Monday so he could maybe talk to you when he is back.
     
  33. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    OK, thanks for checking @The_Island
     
  34. vladala

    vladala

    Unity Technologies

    Joined:
    Mar 3, 2017
    Posts:
    189
    I have been too quick to close the bug as by design (got confused trying to fix your scene). Will re-open and probably it will get forwarded to the graphics pipeline team since they own the rendering aspect.

    Meanwhile, I noticed that you are using TAA. Is there a particular reason for it ? TAA will have ghosting problems a lot of the time, and if you enable accumulation, it will mess up your result.

    Here are some options you have:
    1) Enable AA with accumulation (if using recorder 4.0.0). Disable TAA in this case
    2) Use SMAA (I noticed that this does not have the same alpha issue)
    3) Render at a higher resolution and downsample with an a good filter (bicubic, lanczos, etc).

    Here are some results:
    SMAA: Image Sequence_SMAA_0030.png
    4k with accumulation: Image Sequence_ACCUM_0030.png

    I tried comping both images in after effects and the results looked ok (confirming results looked bad for TAA).