Progressive adaptive sampling

Project:YafaRay
Component:YafaRay Core
Category:feature request
Priority:normal
Assigned:David Bluecame
Status:closed
Description

Montecarlo noise removal in adaptive sampling does not describe a linear function but a curve. For a given number of eye samples and a threshold per pass, the algorithm becomes less effective as the number of passes increases till a 'floor' is reached in which a few pixels are smoothed out compared with the previous pass. This 'floor' can be lowered only by adding more eye samples for pass or by decreasing the threshold limit, but these samples would be probably wasted in the first adaptive passes in which fewer samples are enough for removing noise.

A solution to keep the algorithm effective as solving noise becomes increasingly difficult in each pass is to make adaptive sampling in a progressive way by increasing number of samples x pass as the number of passes increases. A decision point to shift to a new number of samples or threshold could be when a lower limit for solved samples is reached compared to the previous pass, which would mean that combination of samples and a threshold is reaching a 'floor'. Also I think I would be good to uncouple number of samples for first pass which is for antialiasing purposes, from sampling strategy for adaptive sampling which mainly is for montecarlo noise removal IMO.

Comments

#1

Assigned to:Anonymous» David Bluecame
Status:active» ready to commit

Hello,

That's an excellent idea!!  This feature will be available in the upcoming YafaRay-E v1.1.0

I've sent the next pull requests with the changes:

https://github.com/YafaRay/Blender-Exporter/pull/32

https://github.com/YafaRay/Core/pull/98

 

Just an example of how this will work. A new "Resampled Floor" parameter will be available below the AA Threshold parameter in Builder. This parameter does not work in SPPM.

INFO: PhotonMap: Done.
INFO: PhotonMap: Photonmap building time: 1.68657
INFO: PhotonMap: Rendering 10 passes
INFO: PhotonMap: Min. 1 samples
INFO: PhotonMap: 20 per additional pass
INFO: PhotonMap: Resampled pixels floor: 20000
INFO: PhotonMap: Max. 181 total samples
INFO: PhotonMap: Rendering pass 1 of 10...
INFO: PhotonMap: Rendering pass 2 of 10, resampling 30214 pixels.
INFO: PhotonMap: Rendering pass 3 of 10, resampling 5603 pixels.
INFO: PhotonMap: Resampled pixels (5603) below the floor (20000): new AA Threshold for next pass = 0.045
INFO: PhotonMap: Rendering pass 4 of 10, resampling 9136 pixels.
INFO: PhotonMap: Resampled pixels (9136) below the floor (20000): new AA Threshold for next pass = 0.0405
INFO: PhotonMap: Rendering pass 5 of 10, resampling 10673 pixels.
INFO: PhotonMap: Resampled pixels (10673) below the floor (20000): new AA Threshold for next pass = 0.03645
INFO: PhotonMap: Rendering pass 6 of 10, resampling 11958 pixels.
INFO: PhotonMap: Resampled pixels (11958) below the floor (20000): new AA Threshold for next pass = 0.032805
INFO: PhotonMap: Rendering pass 7 of 10, resampling 13017 pixels.
INFO: PhotonMap: Resampled pixels (13017) below the floor (20000): new AA Threshold for next pass = 0.0295245
INFO: PhotonMap: Rendering pass 8 of 10, resampling 14317 pixels.
INFO: PhotonMap: Resampled pixels (14317) below the floor (20000): new AA Threshold for next pass = 0.026572
INFO: PhotonMap: Rendering pass 9 of 10, resampling 15281 pixels.
INFO: PhotonMap: Resampled pixels (15281) below the floor (20000): new AA Threshold for next pass = 0.0239148
INFO: PhotonMap: Rendering pass 10 of 10, resampling 16056 pixels.
INFO: PhotonMap: Resampled pixels (16056) below the floor (20000): new AA Threshold for next pass = 0.0215234
INFO: PhotonMap: Overall rendertime: 98.8664s

I hope this is what you want... ;-)

#2

Thanks for looking into this! It seems that the algorithm you made really takes on more samples as the thresold gets lowered instead of losing efficiency. I wonder if you could as well increase either eye rays or secondary montecarlo samples (this option would be more efficient in fact) as the thresold gets lowered. The idea is that in theory, to halve montecarlo noise levels in path tracing like algorihms (this would include for instance final gather which is more or less a path tracer), you should use 4 times more samples (Henrik Wann Jensen dixit). As the lower thresold makes the algorithm to take on more difficult noise, in theory it will be better if we as well could use more montecarlo samples for solving it. Anyway thanks David !!! :)

#3

Status:ready to commit» fixed

Feature included in the new YafaRay-E v1.1.0. See: http://www.yafaray.org/community/forum/viewtopic.php?f=12&p=31294#p31294

#4

Status:fixed» needs review

A prototype with several new features available here for your review. Please give me your feedback.

http://www.yafaray.org/community/forum/viewtopic.php?f=12&t=5125

#5

Status:needs review» ready to commit

This feature will be available in the upcoming YafaRay-E v2.0.0

#6

Status:ready to commit» fixed

Hello,

Fixed in Release v2.0.0

http://www.yafaray.org/community/forum/viewtopic.php?f=12&t=5132

#7

Status:fixed» closed

Fixed for 2 weeks without any further comments, closing.

#8

Status:closed» active

Hi David, can we set 4 as upper limit for secondary bounces (light samples and GI samples rate) in case users want to keep AA samples in arithmetic progression please?

With AA samples and secondary sampling in geometric acceleration I get very fast reduction rates in resampling numbers, but it really makes the engine choke with the huge amount of ray tracing going on after 7-8 passes in normal work. I would like to try an arithmetic-geometric acceleration but with a higher geometric rate in secondary samples (4) and to see whether "4 the amount of samples to halve montecarlo noise" saying is true.

I don't get such a nice resampling decceleration with only rate 2 in secondary samples while keeping AA samples in arithmetic progression :(

thank you !!!

#9

Hello,

I will make the change for the next version, but for now if you want to experiment you can do the change yourself

 

In the file prop/yaf_scene.py change the max value from 2.0 to 4.0 in the next properties:

    sample_multiplier_factor = FloatProperty(
        name="AA sample multiplier factor",
        description="Factor to increase the AA samples multiplier for next AA pass",
        min=1.0, max=2.0, precision=2,
        default=1.0)
 
    light_sample_multiplier_factor = FloatProperty(
        name="Light sample multiplier factor",
        description="Factor to increase the light samples multiplier for next AA pass",
        min=1.0, max=2.0, precision=2,
        default=1.0)
 
    indirect_sample_multiplier_factor = FloatProperty(
        name="Indirect sample multiplier factor",
        description="Factor to increase the indirect samples (FG for example) multiplier for next AA pass",
        min=1.0, max=2.0, precision=2,
        default=1.0)

 

I hope it helps!

#10

Status:active» ready to commit

This change will be applied to the next version.

https://github.com/DavidBluecame/Blender-Exporter/commit/4334b1ee558b855...

#11

Status:ready to commit» fixed

Changed in YafaRay-E v2.1.0

#12

Status:fixed» active

(edited) sorry I posted this in the wrong case, please ignore.

#13

Status:active» fixed

#14

Hi David,

Can we leave this topic open for more review, since I am still doing lot of test and your idea about differential sampling based on pixel brighness has got so many posibilities. I will try to post results on several scenes about how optimal thresolds vary across a render.

#15

Status:fixed» needs review

No problem, changed.

#16

Status:needs review» fixed

I think it's the other case open (progressive AA for dark pixels) the one I should keep open for review. So, I'm reverting this back to "fixed" and moving the other to "pending review"

#17

Status:fixed» closed

Fixed for 2 weeks without further comments, closing...