A.I. based Open Source De-noiser for Daz Studio PC and MACs

1235

Comments

  • mCasualmCasual Posts: 4,607

     i'll see if i can fix this

    Son of the Raven said:

    mCasual said:

    ok i found the solution

    in the script, which you can open in a notepad or in the daz script IDE tab

    if you search for the 2 lines that read 

    "exe Files (*.exe)" 

    you replace this with

    "Any File" 

    and the mac will now let you click on the denoiser oidnDenoise

    That worked to let me select the binaries, but I'm getting the message "Could not start the process" when clicking on Apply/Create Output Image. The binaries selected are "magick" and "oidnDenoise"

  • mCasualmCasual Posts: 4,607
    edited January 2021

    Son of the Rav

    well it was painful but i found a solution

    i was able to install imagemagick after i installed macports for antique macbooks

    and i found the bizarre reeason why my mcjDenoise script could not launch imagemagick and opendenoise ( execution permissions and avoiding the use of quotation marks )

    imagemagick can convert your png jpg etc to the pfm format which intel open denoise requires, tested works

    my macbook is apparently too old or weak for opendenoise, but i can now launch opendenoise and see it run and refuse to do the job

    but on your modern macbook it should denoise the pfm version of your render athen imagemagick converts the denoised image into a png or jpg etc...

    Thursday it shall be

    unrelated old render

     

    tonsofmats.jpg
    2560 x 1440 - 560K
    Post edited by mCasual on
  • mCasual said:

    well it was painful but i found a solution

    i was able to install imagemagick after i installed macports for antique macbooks

    and i found the bizarre reeason why my mcjDenoise script could not launch imagemagick and opendenoise ( execution permissions and avoiding the use of quotation marks )

    imagemagick can convert your png jpg etc to the pfm format which intel open denoise requires, tested works

    my macbook is apparently too old or weak for opendenoise, but i can now launch opendenoise and see it run and refuse to do the job

    but on your modern macbook it should denoise the pfm version of your render athen imagemagick converts the denoised image into a png or jpg etc...

    Thursday it shall be

    unrelated old render

    Cool. Not sure if I said exactly what I'm running, but in case it's relevant, I'm using a 2015 13" macbook pro, 3.1 i7, running mojave.

  • mCasualmCasual Posts: 4,607
    edited January 2021

    there's a new version of mcjDenoise, my Daz Script that lets you use Intel Open Denoise to A.I.-Denoise your renders, for now i only have an antique macbook so apparently i cant run openDenoise, but your modern macs should , there's also the version for PCs https://sites.google.com/site/mcasualsdazscripts9/mcjdenoise

    i had to figure out the not-well-documented execute-permissions of Daz Scripts, then use the .command extension then avoid quotation marks when running that .command file 

    Son of the Raven said:

    mCasual said:

    mcjDenoise2021ForMac.png
    182 x 182 - 38K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    Sorry about this but the 2:01 PM version was hardwired for the location of imagemagick on my macbook, something like opt/library/bin/convert The 4pm version should use the imagemagick app you specify ( convert or magick in new versions )
  • mCasual said:

    Sorry about this but the 2:01 PM version was hardwired for the location of imagemagick on my macbook, something like opt/library/bin/convert The 4pm version should use the imagemagick app you specify ( convert or magick in new versions )

    Thanks for the heads up, though I didn't get a chance to download until after your revision.

    Just tried it for the first time, and the script could not launch.

    Message from log file:

    2021-01-22 22:41:00.924 Loading script: /Users/Shared/My DAZ 3D Library/Scripts/mcasual/mcjDenoise2021ForMac.dsa
    2021-01-22 22:41:00.925 WARNING: Script Error: Line 78
    2021-01-22 22:41:00.925 WARNING: SyntaxError: Parse error
    2021-01-22 22:41:00.925 WARNING: Stack Trace:
        <anonymous>()@/Users/Shared/My DAZ 3D Library/Scripts/mcasual/mcjDenoise2021ForMac.dsa:78
    2021-01-22 22:41:00.925 Error in script execution: /Users/Shared/My DAZ 3D Library/Scripts/mcasual/mcjDenoise2021ForMac.dsa

  • Son of the Raven said:

     

    Message from log file:

    2021-01-22 22:41:00.924 Loading script: /Users/Shared/My DAZ 3D Library/Scripts/mcasual/mcjDenoise2021ForMac.dsa
    2021-01-22 22:41:00.925 WARNING: Script Error: Line 78
    2021-01-22 22:41:00.925 WARNING: SyntaxError: Parse error
    2021-01-22 22:41:00.925 WARNING: Stack Trace:
        <anonymous>()@/Users/Shared/My DAZ 3D Library/Scripts/mcasual/mcjDenoise2021ForMac.dsa:78
    2021-01-22 22:41:00.925 Error in script execution: /Users/Shared/My DAZ 3D Library/Scripts/mcasual/mcjDenoise2021ForMac.dsa

    Changed line 78 to read (just added second quotation marks):

        wDlg.caption = appName + "2021 for Macs";

    seems to have done the trick. Now I'm running into a different issue that seems to be because of imagemagick, not your script. Think I'm trying to use a binary package of imagemagick made for high sierra, not mojave, so I need to look at that later - and I have message into the imagemagick people regarding this.

  • HellwolveHellwolve Posts: 161

    This is awesome work! Much apreciated; I'll gladly use this in my workflow :-D However, I've got one question; how do I preserve the transparancy of a .png render? Saving the result out to a .png doesn't seem to work?

     

  • mCasualmCasual Posts: 4,607
    edited January 2021

     i fear this is the result of OpenDenoise's pfm format ... but maybe not, maybe i can change something in the imagemagick conversion options

    Hellwolve said:

    This is awesome work! Much apreciated; I'll gladly use this in my workflow :-D However, I've got one question; how do I preserve the transparancy of a .png render? Saving the result out to a .png doesn't seem to work?

     

    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited January 2021

    January 22nd 2021 2:00PM SORRY i forgot a closing quote at line 78 of the mac version  which prevented it from working

    today's zip file contains the modified mac version

    ( thanks SonOfRaven )

    Next week i may receive my 2012 macbook pro I5 which may let me actually run the intel OpenDenoiser

    Unrelated image

    getElectric.gif
    640 x 360 - 3M
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited January 2021

     i researched the matter briefly

    i downloaded and used the free app XNVIEWMP to view the PFM images and extract/view the alpha layer

    they seem to have an alpha layer but it's just a grayscale version of the image, not the alpha layer from the input file

    i also used an online converter and just like imagemagick the alpha layer becomes a grayscale version of the RGB channels

    so the only solution i can imagine is to use imagemagick to transfer the alpha layer from the input image to the denoised image

    i'll see if i can figure the imagemagick command to do that 

    in the meantime, some old people probably think of this when they see PFM mentionned 

     

    Hellwolve said:

    This is awesome work! Much apreciated; I'll gladly use this in my workflow :-D However, I've got one question; how do I preserve the transparancy of a .png render? Saving the result out to a .png doesn't seem to work?

     

    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited January 2021

    i researched some more and the PFM image format doesnt support alpha layers, there's a PF4 format that does support alpha layers but i think imagemagick doesnt support it

    on my PC the imagemagick convert utility is named magick.exe

    the command line to take the alpha image from your undenoised image and apply it to the denoised image looks like this

    "C:/Program Files/ImageMagick-7.0.10-Q16-HDRI/magick.exe" denoised.png alpha.png -compose copy-opacity -composite combo.png

    alpha.png would be the undenoised image

    denoised.png  would be the denoised image

    combo.png would be the combination of the two

     

    i will add a checkbox to the script that  will do this automatically

     

     

    Hellwolve said:

    This is awesome work! Much apreciated; I'll gladly use this in my workflow :-D However, I've got one question; how do I preserve the transparancy of a .png render? Saving the result out to a .png doesn't seem to work?

     

    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited January 2021

    new version of mcjDenoise can carry-over the alpha/transparency layer of the original ( so google mcjDenoise of find it at mcasualsdazscripts9 )

    FB_IMG_1611466852017.jpg
    1080 x 608 - 43K
    Post edited by Chohole on
  • Son of the Raven said: Now I'm running into a different issue that seems to be because of imagemagick, not your script. Think I'm trying to use a binary package of imagemagick made for high sierra, not mojave, so I need to look at that later - and I have message into the imagemagick people regarding this.

    The solution to this *MAY* be using the brew install method (at the very least it should make imagemagick work on mojave, if you use it directly through terminal), however, it is installed in an invisible location, so browsing to it through the script does not work - at least with everything in standard settings.

    Have set all files to visible via terminal and still could not view invisible files/folders through the script, BUT Daz was running while I did this, so perhaps quitting and restarting Daz will allow the invisible to be visible. Am rendering something that I want to let finish then will try quitting and restarting Daz.

  • mCasualmCasual Posts: 4,607

    i installed my imagemagick using mac what was the name macports, and convert got installed in something like  /opt/local/bin

    maybe if you have trouble to get there, and if luck has it, imagemagick convert works standalone, you could copy it from there to one of your user folders

    Son of the Raven said:

    Son of the Raven said: Now I'm running into a different issue that seems to be because of imagemagick, not your script. Think I'm trying to use a binary package of imagemagick made for high sierra, not mojave, so I need to look at that later - and I have message into the imagemagick people regarding this.

    The solution to this *MAY* be using the brew install method (at the very least it should make imagemagick work on mojave, if you use it directly through terminal), however, it is installed in an invisible location, so browsing to it through the script does not work - at least with everything in standard settings.

    Have set all files to visible via terminal and still could not view invisible files/folders through the script, BUT Daz was running while I did this, so perhaps quitting and restarting Daz will allow the invisible to be visible. Am rendering something that I want to let finish then will try quitting and restarting Daz.

  • mCasualmCasual Posts: 4,607
    edited January 2021

     at line 807 of the script, there's a line that reads

     var converter = quoted( getSetting( "converter", "" ) );

    you could try changing it to

    var converter = quoted( "convert" ) );

    or

    var converter = quoted( "magick" ) );

    or

    var converter = quoted( "/opt/local/bin/convert" ) );

    Son of the Raven said:

    Son of the Raven said: Now I'm running into a different issue that seems to be because of imagemagick, not your script. Think I'm trying to use a binary package of imagemagick made for high sierra, not mojave, so I need to look at that later - and I have message into the imagemagick people regarding this.

    The solution to this *MAY* be using the brew install method (at the very least it should make imagemagick work on mojave, if you use it directly through terminal), however, it is installed in an invisible location, so browsing to it through the script does not work - at least with everything in standard settings.

    Have set all files to visible via terminal and still could not view invisible files/folders through the script, BUT Daz was running while I did this, so perhaps quitting and restarting Daz will allow the invisible to be visible. Am rendering something that I want to let finish then will try quitting and restarting Daz.

    Post edited by mCasual on
  • mCasual said:

     at line 807 of the script, there's a line that reads

    First off, hopefully I'll remember to include the useful detals, because I'm rewriting this response after firefox reloaded this page after I typed my response and hit backspace to delete and correct something. FU firefox (but still runs much more lightly than safari).

    I did not try your suggestion so cannot comment on it.

    Restarting Daz did not allow the browsing from your script to show all files, however I came across this little helpful trick: press + ⇧ Shift + . and it will show/hide your files, and it worked while browsing through your script.

    My path to imagemagick, with the brew install, is /usr/local/Cellar/imagemagick/7.0.10-58/bin/magick

    May have needed to close script after that then open it again, but after getting the brew installed imagemagick binary selected, it worked MAGNIFICENTLY! Thank you!

    Have only used on the one test image so far, next I should try an image that is actually using transparency, but without having experimented more, I have a couple of questions: what exactly does the jpeg quality setting do?; are there any adjustments for how detailed the denoising is done (this question is coming out specifically thinking about preserving things like hair detail)?

    Once again, thank you so much.

  • Oh, can't remember if this was already mentioned, but in case someone does not know and is wishing there was a way to use this script while an image is in the process of rendering, you can simply open the script from its location on your system (My Daz 3D Library/Scripts/mcasual).

  • Son of the RavenSon of the Raven Posts: 119
    edited January 2021

    Tried on an image that uses transparency, and now I have a couple more questions.

    - first, already had this question actually, why does the script output 3 images?

    - one of these three images retains the transparency, but without noise reduction, the other two end up with a black background; how do you handle these/what are you supposed to do with them?

    Post edited by Son of the Raven on
  • mCasualmCasual Posts: 4,607

    i noticed that too, i'm not sure and i didnt review that aspect of the script 

    the batch file created and executed by the script does this:

    magick.exe Pic.png -endian LSB temp_inp.pfm
    oidnDenoise -ldr  temp_inp.pfm" -o temp_out.pfm
    magick.exe temp_out.pfm Pic_out.jpg
    magick.exe yourimage.png" -compose copy-opacity alphaPic_out.png

    the first 2 images are generated in Daz Studio's temp folder

    the 2 others are your denoised image without alpha inheriting

    the other is the dinoised with inherited alpha

    so the other images must be leftovers generated by imagemagick

    i did a test and it's the alpha compositing step of imagemagick that generates those 2

    personally i just delete them

    Son of the Raven said:

    Tried on an image that uses transparency, and now I have a couple more questions.

    - first, already had this question actually, why does the script output 3 images?

    - one of these three images retains the transparency, but without noise reduction, the other two end up with a black background; how do you handle these/what are you supposed to do with them?

  • mCasual thank you for your hard work your scripts are always nice and usefull.

  • Son of the RavenSon of the Raven Posts: 119
    edited January 2021

    When trying to denoise an image with transparency, the copy that comes out with transparency does not seem to be denoised. I must be doing something wrong, perhaps my settings are not right. I'm rendering in 3840x2160, trying denoise before resizing (tried resizing one image to 1080 then denoise, but denoise result was better with orig render size). Have selected "Retain Png Source Alpha", have tried "PNG: Default. Economical format", "PNG24: 8bit RGB without alpha", "PNG32: RGB with alpha", "PNG00: same depth from input image".

    Have not yet touched the jpeg quality, just trying with it set to 50.

    Any thoughts/suggestions there? If need be I can try to magic wand erase the black background in ps, but that's never perfect.

    Do you resize images after rendering, and if so, which size do you denoise?

    Post edited by Son of the Raven on
  • mCasualmCasual Posts: 4,607
    I think it's better to not downsize because the denoiser probably looks for sharp pepper pixels And downsizing usually also applies a gaussian filter that smoothens the image Maybe imagemagick is unable to read the alpha layer from your source image Sometimes the intel denoiser doesnt denoise the whole image, so look at the output image for signs of denoising. for cases like that the albedo map can help but i dont really know how to get an albedo map from daz though you could use a very well lit opengl render as the albedo
  • Son of the RavenSon of the Raven Posts: 119
    edited January 2021

    mCasual said:

    I think it's better to not downsize because the denoiser probably looks for sharp pepper pixels And downsizing usually also applies a gaussian filter that smoothens the image Maybe imagemagick is unable to read the alpha layer from your source image Sometimes the intel denoiser doesnt denoise the whole image, so look at the output image for signs of denoising. for cases like that the albedo map can help but i dont really know how to get an albedo map from daz though you could use a very well lit opengl render as the albedo

    Son of the Raven

    Two of the output images are clearly denoised - out and out-0, but both of these have the black background, and out-0 gets a funky shift in it; out-1 has the transparency but does not come out denoised. Every image I've tested, whether checking the preserve png alpha or not, have the same results regarding this.

    My source image is just the png render from Daz. I've only recently switched to using Iray, so not sure if there are any kind of settings I'm using that might affect this.

    It seemed logical to me that denoising the larger would retain detail better, and in comparison when using your script it seems to me it does a better denoise job on the larger image than the reduced image (but I only did 2 tests with resizing before denoising).

    Post edited by Son of the Raven on
  • mCasualmCasual Posts: 4,607

     

    sorry again

    in the previous version the alpha layer preservation option introduced an error

    the version of 10:30PM 01/26/2021 corrects this

    though the mac version of the alpha preservation option doesnt seem to work on macs

     

    well i received my more recent macbook with catalina, i unstalled xcode, to install homebnrew, to install imagemagick

    and it looks like i have many versions of imagemagick, the convert one and the magick one, i used magick

    and for catalina to accept running imagemagic's libraries i had to go in system prefs/sec and privacy/general and allow each component to run after catalina refused to run them

     

    Son of the Raven said:

    mCasual said:

    I think it's better to not downsize because the denoiser probably looks for sharp pepper pixels And downsizing usually also applies a gaussian filter that smoothens the image Maybe imagemagick is unable to read the alpha layer from your source image Sometimes the intel denoiser doesnt denoise the whole image, so look at the output image for signs of denoising. for cases like that the albedo map can help but i dont really know how to get an albedo map from daz though you could use a very well lit opengl render as the albedo

    Son of the Raven

    Two of the output images are clearly denoised - out and out-0, but both of these have the black background, and out-0 gets a funky shift in it; out-1 has the transparency but does not come out denoised. Every image I've tested, whether checking the preserve png alpha or not, have the same results regarding this.

    My source image is just the png render from Daz. I've only recently switched to using Iray, so not sure if there are any kind of settings I'm using that might affect this.

    It seemed logical to me that denoising the larger would retain detail better, and in comparison when using your script it seems to me it does a better denoise job on the larger image than the reduced image (but I only did 2 tests with resizing before denoising).

  • mCasualmCasual Posts: 4,607
    edited January 2021

    good news

    my macbook test with png 32bit with alpha as the output format

    and the "retain png source alpha" option checked\

    did produce a png file (alphanoyzee_out-1.png)  that does contain an alpha layer as shown here 

    note that in the iray render options you must have the environment dome as not-visible and in the daz environment tab , you must not have a backdrop

    that's how i produce renders with an alpha layer

    in the folder of 

     

     

    Son of the Raven said:

    mCasual said:

    bbb.jpg
    668 x 700 - 49K
    aaa.jpg
    1112 x 1166 - 114K
    Post edited by mCasual on
  • Son of the RavenSon of the Raven Posts: 119
    edited January 2021

    mCasual said:

    good news

    my macbook test with png 32bit with alpha as the output format

    I think I'm missing something (or a couple somethings). Is the intention for the user to use the alpha to separate the desired content from the black background in an image editor, so that you use it on _out to preserve the content of your image and delete the background?

    When I open _out-1 in photoshop, I don't show an alpha channel, there are channels for RGB, Red, Green, Blue. Now I'm far from being an expert with image work, so it would be very easy for me to miss something obvious, whether in what I'm looking at or in how you intend for this to put to use.

    If we are meant to use the alpha with an image program like photoshop to clear _out, then I could make an alpha, but I think I'm missing something about what I am supposed to be doing.

    Here's a shot of the channels for _out-1

     

    Screen Shot 2021-01-27 at 12.41.59 AM.png
    305 x 429 - 15K
    Post edited by Son of the Raven on
  • mCasualmCasual Posts: 4,607
    edited January 2021

     when the png has an alpha layer, the background will show up as gray checkers

    then copy a background image or area of an image

    and paste it on the image with the alpha layer

    your background image becomes a layer

    in the Layers tab, click and drag the background layer so that it is below the alpha layer

    and the background is now only seen in transparent areas 

    Son of the Raven said:

    mCasual said:

    good news

    my macbook test with png 32bit with alpha as the output format

    I think I'm missing something (or a couple somethings). Is the intention for the user to use the alpha to separate the desired content from the black background in an image editor, so that you use it on _out to preserve the content of your image and delete the background?

    When I open _out-1 in photoshop, I don't show an alpha channel, there are channels for RGB, Red, Green, Blue. Now I'm far from being an expert with image work, so it would be very easy for me to miss something obvious, whether in what I'm looking at or in how you intend for this to put to use.

    If we are meant to use the alpha with an image program like photoshop to clear _out, then I could make an alpha, but I think I'm missing something about what I am supposed to be doing.

    Here's a shot of the channels for _out-1

     

    domo.jpg
    1024 x 542 - 76K
    domomo.jpg
    640 x 360 - 60K
    Post edited by mCasual on
  • Son of the RavenSon of the Raven Posts: 119
    edited January 2021

    Son of the Raven said:

    mCasual said:

    good news

    my macbook test with png 32bit with alpha as the output format

    I think I'm missing something (or a couple somethings). Is the intention for the user to use the alpha to separate the desired content from the black

     

    This is perhaps just a difference between image editors, where some, like gimp, will automatically create/present an alpha channel, whereas photoshop does not.

    However, it turns out to be super easy to give the _out image with black background the transparency of the original. Open both images in photoshop. Duplicate the layer of your _out image to your original image, so that the layer with the transparency is below the denoised layer with the black background in the layer list. Place your cursor in between the two layers, press alt (cursor will change), left click, and the denoised layer is now clipped to the original, so you see the denoised version of your image with the original transparency.

    Screen Shot 2021-01-27 at 1.43.53 PM.png
    1823 x 1034 - 480K
    Post edited by Son of the Raven on
  • mCasual, on the topic of resizing images, do you strictly render the same size as your final intention, or were you just referring to denoising before reducing size?

Sign In or Register to comment.