Announcement

Collapse
No announcement yet.

Second denoise is useless?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Second denoise is useless?

    Code:
    renderer.PostEffectsUpdated += new EventHandler<VRayEventArgs>((source, e) =>
    {
    Console.WriteLine(" ~~~ Got a new denoised image!");
    RenderElement denoiseRE = renderer.RenderElements.Get(RenderElementType.DENO ISED);
    // You shouldn't perform slow operations inside this callback because this will block the event queue.
    VRayImage denoisedImage = denoiseRE.GetImage();
    denoisedImage.SaveToPNG(outputImagePath, transparent, 16);
    });
    
    renderer.StartSync();
    renderer.WaitForRenderEnd();
    Console.WriteLine(" ~~~ First manual denoising");
    renderer.DenoiseNow();
    renderer.WaitForRenderEnd(50000);
    
    Console.WriteLine(" ~~~ Second manual denoising");
    renderer.DenoiseNow();
    renderer.WaitForRenderEnd();
    I found that PostEffectsUpdated was invoked only once..​

  • #2
    Probably none of PostEffectsUpdated events you get is caused by your DenoiseNow() calls. Most probably you get only one automatically fired at the end of rendering (after your first WaitForRenderEnd() call). Next DenoiseNow() need some time but your next WaitForRenderEnd calls return immediately because rendering has already finished. And probably your program ends before the event handler had any chance to be called.

    Comment


    • #3
      So, how to correctly know DenoiseNow ends. WaitForRenderEnd is not suitable.
      my render mode is bucket
      Code:
      SettingsImageSampler settingsIS {
      type=1;
      ....
      }
      Last edited by baoxiaohe_developer; 21-02-2023, 07:02 PM.

      Comment


      • #4
        You simply don't need to call denoiseNow() manually in your case because when rendering finishes, the denoiser will be called automatically and you'll get the event. Still, you'll have to wait for the event to occur after WaitForRenderEnd() returns. You can use AutoResetEvent, ManualResetEvent or something else.

        Comment


        • #5
          that's right, thks.

          Comment

          Working...
          X