Using V-Ray denoiser tool (vdenoise.exe) with send to scripts + Backburner submission.

General Idea.

This is going to be quick tip for anyone who would love to easily denoise sequence of exr files with vdenoise.exe without typing in commands manually. This workflow could also be used for number of different tools or scripts like encoding video with ffmpeg or converting exr sequence to mov using DJV.

The trick is to use windows send to scripts. If you don’t know it yet, in Windows you can create custom .bat files that will run commands from under right mouse button’s send to menu. This is very helpful if you want to automate some file processing tasks and save a lot of time in the process.

Denoising sequence of files locally.

Denoising after render is extremely helpful as this way vdenoise.exe can use neighboring frames for improved results. Below is example of script that will convert sequence of layered .exr files from V-Ray. It will only work if you setup render with denoiser render element.

Basic Script will go like this:
@echo off
set input=%1
set denoiser_input=%input:~0,-8%????.exr
"C:\Program Files\Chaos Group\V-Ray\3dsmax 2016 for x64\tools\vdenoise.exe" -inputFile="%denoiser_input%" -useGPU=2 -display=0
pause

To use this script just go to run (windows+R) type in this command below and press Enter. shell:sendto
This will open up folder containing all your send to scripts. Just create one called “denoise_sequence.bat” and copy the content of above’s basic script. When naming the file remember that windows hides file extension by default (https://support.microsoft.com/en-us/kb/865219)

Also you may need to change path to vdenoise.exe depending on your V-Ray version and installation directory. I also added -useGPU=2 to use all available GPUs in given workstation and -display=0 to not show denoising window. Feel free to change those or add more options.

Once you’ve done this go and test it out by running on an sequence that you want to denoise RMB->Send to -> denoise_sequence . Doing this will popup command window where you can track progress of the denoising.

s5eb90b4b-50b7-434d-aca9-2c40c16059ecM

Also here is a little updated version of the script that will work with spaces in filenames and also with vrimg files:

@echo off
set input=%~f1
IF %~x1==.exr (set denoiser_input=%input:~0,-8%????.exr)
IF %~x1==.vrimg (set denoiser_input=%input:~0,-10%????.vrimg)
"C:\Program Files\Chaos Group\V-Ray\3dsmax 2016 for x64\tools\vdenoise.exe" -inputFile="%denoiser_input%" -useGPU=2 -display=0
pause

Denoising using Backburner.

Now once you know how to do that, lets write a little bit more complex script that will add sequence for denoising as Backburner Job. I will assume you know what Backburner is and it’s correctly setup in your network.

Script goes like this:

@echo off
set input=%1
set filename=%~n1
set denoiser_input=%input:~0,-8%????.exr
set jobname=%filename:~0,-5%
"C:\Program Files (x86)\Autodesk\Backburner\cmdjob.exe" -jobname:%jobname% -manager:Manager_IP_address -numTasks:2000 "C:\Program Files\Chaos Group\V-Ray\3dsmax 2016 for x64\tools\vdenoise.exe" -inputFile="%denoiser_input%" -useGPU=2 -display=0 -frames=%%%tn
pause

Modify paths to executable if needed and specify correct manager_IP_address.

This one will call out cmdjob.exe and create job with 2000 tasks of which every single one will try to denoise frame corresponding to task number. You may change this to higher number for different sequence ranges than 0-2000 or you could write something smarter that will actually find out what is the range of sequence and create exact number of tasks.

sd6e87cde-0535-461e-b695-2c77db788e95J

Those 2 little scripts can easily be modified to fit your workflow. Check what kind of options are available in cmdjob.exe or vdenoise.exe by trying to run it from CMD.

Featured image is still frame from one of the latest videos we’ve produced with the help of denoiser. https://www.instagram.com/p/BHuWcRmD8gf/?taken-by=dabarti_cgi

Have Fun!

11 Comments

  • Riaan v Jaarsveldt says:

    Hey guys, i realise this is an old threat however I hope someone can help. I can’t seem to find a way to have the standalone denoiser output the denoised render elements in addition to the beauty pass for pass composition afterwards. No point in having a denoised beauty pass with a noisy reflection pass to boost reflections, for instance. Am I missing something? Much appreciated.

  • James Burrell says:

    Hi there,

    Just wanted to give everyone some pointers on how to address the issue about frames not starting from 0. I also had the same problem but the way I got around it was to just do a more manual set of commands but hey, it worked out fine.

    my filenames for example are like so: 20a_VRIMG_xxxxx.vrimg
    say we’re starting with this: 20a_VRIMG_10170.vrimg
    and ending with this: 20a_VRIMG_10180.vrimg

    The command you need to insert in your .bat file is -tp_start:x where x is the number of the first frame (10170)
    Then your -numTasks parameter needs to be the number of the final frame (10180)
    Of course you could be more clever and remove the first few digits but who cares.

    Hopefully this helps out someone 🙂

    • James Burrell says:

      One problem this brings up is it seems backburner assigns tasks as a percentage of sorts. So if you submit the case above, it will only assign 2 or 3 servers to the entire job. I would recommend removing as many ??’s from the filename parameter, and remove as many digits from the numTasks and tp_start number as you possibly can to allow BB to assign more servers to the job. Strange little bug.

    • John Harper says:

      I couldn’t get -tp_start:X to affect anything. I tried all sorts of things, but I couldn’t get it to work.

  • Stefan Baur says:

    Hi thanks a lot for this tutorial.

    Here some thoughts/inputs when i expiremented with this:

    -when you turn the window on using the script for backburner (-display=1) the job won’t finish. So just stick with the script provided like above (-display=0)
    -i had difficulties using EXR as output. Sometimes the vraydenoiser will crash, sometimes not. Using vrimg as output always worked for me.
    -i have added: -mode=mild just before -inputFile=”%denoiser_input%” to use another denoising strength
    -im denoising really large image sizes and our renderfarm has weak graphic cards but powerfull processors, so i changed -useGpu=2 into -useCpu=1

    But i have encountered a problem which drives me Nuts!
    When i denoise a sequence over backburner it will only denoise the first 100 frames. No matter what number i change in -numTasks:
    Frame 0-99 will be denoised (takes about 5 minutes per frame). All frames after will be completed after 1second but with no output.

    Please help!
    cheers
    Stefan

    • john harper says:

      Sefan,
      I can run with -display=1 just fine…here is my code:

      @echo off
      set input=%1
      set filename=%~n1
      set denoiser_input=%input:~0,-8%????.exr
      set jobname=%filename:~0,-5%
      “C:\Program Files (x86)\Autodesk\Backburner\cmdjob.exe” -jobname:%jobname% -manager:Quad -numTasks:250 “C:\Program Files\Chaos Group\V-Ray\3dsmax 2016 for x64\tools\vdenoise.exe” -inputFile=”%denoiser_input%” -useGPU=2 -display=1 -autoClose=1 -frames=%%%tn
      :pause

      just make sure you send to from the shared network folder, not locally.

      EXR works fine for me.

      I have a render farm with 980 ti, 2 per box, 1280×720 test renders take about 3 seconds to denoise using gpu=2

      regarding your problem, I set the numTasks to a number higher than my sequence where is will properly denoise the sequence, and any additionals will do like you said, in less than a second complete the task…it takes so short I don’t worry about it. I’ve been doing frames over 100 with success.

      It’s been a couple months since I got all this working, so I don’t remember what all I tested with cmdjob and vdenoise.exe to get this all to work for me…check my code and my comments below…maybe something there can help you.

      im running win7 pro 64 bit and max 2016, and vray 3.5701

  • john harper says:

    I’m getting a problem…the files are not being read or written and the job gets through in about 5 seconds with no new denoised files.

    I’ve been trying to figure this out, but thought I’d prompt here in case someone had an idea for me to try…here is an excerpt from my bb server.exe log file…note the times…it should take about 6 seconds per frame, but it isn’t, and no files read or written.

    2017/01/12 12:49:23 INF Receiving new job from ip_address
    2017/01/12 12:49:23 INF Job ‘Job_Name’ received and ready
    2017/01/12 12:49:23 INF Launching ‘Command Line Tool’
    2017/01/12 12:49:23 INF New task assigned: 3
    2017/01/12 12:49:24 INF [ServerMessage]ProcessStarted processId=5224
    2017/01/12 12:49:24 INF Cmdjob adapter: V-Ray Denoiser tool for denoising still images and image sequences.

    2017/01/12 12:49:24 INF Cmdjob adapter: Copyright (C) 2016 by Chaos Group Ltd. All rights reserved.

    2017/01/12 12:49:24 INF Cmdjob adapter: Build from Nov 22 2016

    2017/01/12 12:49:24 INF Cmdjob adapter:

    2017/01/12 12:49:24 INF Cmdjob adapter: Using radius 10, strength 1 and threshold 0.001

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: Using device 0: GeForce GTX 980 Ti

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: Driver version 376.19

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: Using device 1: GeForce GTX 980 Ti

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: Driver version 376.19

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: OpenCL compiled successfuly

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: OpenCL compiled successfuly

    2017/01/12 12:49:24 INF Cmdjob adapter: Denoising 146 file(s), blending 3 frame(s).

    2017/01/12 12:49:24 INF Block of 1 task(s) completed
    2017/01/12 12:49:24 INF New task assigned: 5
    2017/01/12 12:49:24 INF [ServerMessage]ProcessStarted processId=1944
    2017/01/12 12:49:24 INF Cmdjob adapter: V-Ray Denoiser tool for denoising still images and image sequences.

    2017/01/12 12:49:24 INF Cmdjob adapter: Copyright (C) 2016 by Chaos Group Ltd. All rights reserved.

    2017/01/12 12:49:24 INF Cmdjob adapter: Build from Nov 22 2016

    2017/01/12 12:49:24 INF Cmdjob adapter:

    2017/01/12 12:49:24 INF Cmdjob adapter: Using radius 10, strength 1 and threshold 0.001

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: Using device 0: GeForce GTX 980 Ti

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: Driver version 376.19

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: Using device 1: GeForce GTX 980 Ti

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: Driver version 376.19

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: OpenCL compiled successfuly

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: OpenCL compiled successfuly

    2017/01/12 12:49:24 INF Cmdjob adapter: Denoising 146 file(s), blending 3 frame(s).

    2017/01/12 12:49:24 INF Block of 1 task(s) completed
    2017/01/12 12:49:24 INF New task assigned: 9
    2017/01/12 12:49:24 INF [ServerMessage]ProcessStarted processId=2908
    2017/01/12 12:49:24 INF Cmdjob adapter: V-Ray Denoiser tool for denoising still images and image sequences.

    2017/01/12 12:49:24 INF Cmdjob adapter: Copyright (C) 2016 by Chaos Group Ltd. All rights reserved.

    2017/01/12 12:49:24 INF Cmdjob adapter: Build from Nov 22 2016

    2017/01/12 12:49:24 INF Cmdjob adapter:

    2017/01/12 12:49:24 INF Cmdjob adapter: Using radius 10, strength 1 and threshold 0.001

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: Using device 0: GeForce GTX 980 Ti

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: Driver version 376.19

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: Using device 1: GeForce GTX 980 Ti

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: Driver version 376.19

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: OpenCL compiled successfuly

    2017/01/12 12:49:24 INF Cmdjob adapter: VDenoise: OpenCL compiled successfuly

    2017/01/12 12:49:24 INF Cmdjob adapter: Denoising 146 file(s), blending 3 frame(s).

    2017/01/12 12:49:24 INF Block of 1 task(s) completed
    2017/01/12 12:49:24 INF New block of 59 tasks assigned
    …etc

    • john harper says:

      I think I found my problem, my frame sequence starts with something other than 0, how would I use -frames=%%%tn for other frame numbers?

    • This could be tricky. I’ve switched to Thinkbox Deadline a while ago and the code for backburner was very raw here, mainly as example. It doesn’t take into account frame range. In order to do that you should somehow calculate number of frames you need to process and pass it to this argument “-numTasks:2000” or use tasklist option…

      “%%%tn” is there to pass task number from backburner back to VDenoise… But if the job is created with wrong tasks range it will fail due to missing frames… It’s worse if it fails at the start as it will fail the whole job. If it fails at the end … at least it denoised all needed frames first.

      Maybe you could manually change task range after the job is created to match the frame range ?

    • john harper says:

      Thanks…I’ll have to look into that when I get more time.

      I found the frames will work only starting at frame 1.

      I did find a workaround for doing frame ranges…when I render a range from max, I set the frame offset so the file name frame number is set to 0001.

      for example, range 3295-whatever, offset would be at -3294, so first filename frame number would be 0001.

      render to get my sequence.

      then run the bb vdenoise (I also found, I have to send to when in the folder from the network folder, not local so

      (my computer is called Quad)

      //Quad/TestFolder/Test0001.exr (this will run vdenoise thru bb properly with all nodes on network)

      not

      D:TestFolder/Test0001.exr (this will invoke only the vdenoise on Quad, not over the network with my render nodes)

      now I get my denoised sequence

      then I use Adobe Bridge to rename the denoised sequence with the proper frame number (3295 as in example above) and this helps me keep track of everything.

      It’s tedious, but works and saves me time once I got used to it…maybe we all can figure out something better in the future. I’ve asked Vlado if he would include a frame offset in the vdenoise parameters, so we would reset the offset there, thereby saving the denoised files back to the proper frame number and he said he would look into it.

      The problem is bb cmdjob, but we all know it’s impossible to get Autodesk to fix anything.

  • Stan Brusse says:

    This is working perfectly, awesome tool, thanks a lot!

Leave a Reply