Search Unity

Feature Request More Samples for Path Tracing?

Discussion in 'High Definition Render Pipeline' started by AcidArrow, Mar 8, 2021.

  1. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,724
    Is there a way to go above 4096 samples with Path Tracing?

    If not, why not?
     
  2. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    765
    Hello, there is actually two soft reasons why it's 4096.
    1. Our sampling sequence is made of 256 optimal samples, that are then reused after that (by shifting dimensions of the sequence), and the more you go past 256, the more you lose the good properties of the sequence towards a pure random one.
    2. After a large number of samples, you really get diminishing results and because of the implementation of our path tracer (unidirectional with next event estimation), they are some setup where it's will be next to impossible for the final image to converge so it doesn't make a lot of sense to wait for 100k samples for next to no better results.

    However, since those are soft reasons, you can easily modify the upper value of the maximumSamples variable in the script and try :
    com.unity.render-pipelines.high-definition\Runtime\RenderPipeline\PathTracing\PathTracing.cs

    Don't forget to reset the override (or remove/re-add it for the new value to be taken into account)
     
    jeremedia, AcidArrow and Sab_Rango like this.
  3. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,724
    I mean, that's true for all path tracers and other brute force like methods, not sure if you mean the returns are extra diminished in this specific path tracer.

    I just want something better than my current workflow, which is to render at x3 times the resolution I want and then resize down, which works and I get (almost) clean results, but surely being able to throw more samples at it would be faster?

    I've just edited the PathTracing.cs file and will see if that helps me enough.

    In any case, please consider an official better solution, since my feedback is : the current implementation / sample limit is not enough to get clean results.
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,724
    For the record, I found that increasing the limit allowed me to have much cleaner results.
     
    jeremedia and chap-unity like this.
  5. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    765
    It does helps in some setup, I agree.

    It as been added as an improvement that can be tracked here (a few hours is need for the link to be up)
     
    Last edited: Apr 8, 2021
    jeremedia likes this.
  6. jeremedia

    jeremedia

    Joined:
    Apr 21, 2015
    Posts:
    63
  7. jeremedia

    jeremedia

    Joined:
    Apr 21, 2015
    Posts:
    63
    Had to remove and re-add the Path Tracing volume override to get the slider max to update. Thanks again for increasing this value.
     
    chap-unity likes this.
  8. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    765
    Indeed, if you change default values, they won't be updated right away on HDRP 11, you'll need to either delete/re-add the override or reset it by clicking on the 3 vertical dot menu.

    This has been fixed only recently in HDRP 12
     
    jeremedia likes this.