<div dir="ltr"><div>Storing the number of samples is usually not needed, and often impractical to combine with other sampling decisions taken along the path.</div><div><br></div><div>It&#39;s difficult to tell without implementation details, what is the exact reason samples must be discarded? Transporting rays to another surface sounds pretty similar to BSDF scattering, where we use importance sampling and divide the throughput by the probability density function (pdf). Basically rather than counting the number of valid samples, we increase the weight of the valid samples to compensate for the invalid ones.</div><div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 23, 2017 at 6:59 PM, Mohamed Sakr <span dir="ltr">&lt;<a href="mailto:3dsakr@gmail.com" target="_blank">3dsakr@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hey,<br><br>the easiest approach is: store the number of samples per pixel in an image, divide the final image by the samples image.<br>I would avoid discarding samples as you will waste compute power, just find a way to reduce samples from the start (it needs a redesign to change how the kernel works), Lukas Stockner may have more idea about this as he tried to do an adaptive sampler before I guess.<br><br>cheers,<br>Mohamed Sakr</div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_-8657494346709016256h5">On Fri, Jun 23, 2017 at 1:51 PM, Escot Lucas <span dir="ltr">&lt;<a href="mailto:lucas.escot@ens-lyon.fr" target="_blank">lucas.escot@ens-lyon.fr</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-8657494346709016256h5"><div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p>Hello everyone,</p>
<p>I originally asked the following question on the #blendercoders IRC but was advised to send it here.</p>
<p><em>Context</em>: I am currently working on a modified version of Cycles, in which the user have control over how light paths behave: they are able to transport/move rays hitting a specific surface to another one.</p>
<p>Such a modification implies that during the path tracing process, <strong>some paths/samples must be discarded</strong> (to do that I simply don&#39;t add their contribution to the final image, in kernel_path.h/kernel_path_trac<wbr>e()).</p>
<p>It means some pixels are downsampled since some of their samples might be discarded, however Cycles still divides for each pixel the total contribution by <em>the total number of samples</em> which is assumed to be constant over the entire image.</p>
<p>Hence my question: is there a simple way to make this last operation (averaging pixel samples) rely on a local number of samples, for each pixel, rather than a constant amount of samples for the entire image?</p>
<p>I hope this is the right place to ask such a question, and that some of you will have an answer.</p>
<p>Regards.</p><span class="m_-8657494346709016256m_-7356900228592876713HOEnZb"><font color="#888888">
<div>-- <br>
<p id="m_-8657494346709016256m_-7356900228592876713m_-7509738023783480948signature" style="font-size:smaller;color:595959"><span style="font-weight:bold">Lucas Escot</span><br>L3 Informatique Fondamentale<br><span style="font-weight:bold">ENS de Lyon</span><br><span>Telephone: 06 88 62 63 86</span></p>
</div>
</font></span></div>
<br></div></div>______________________________<wbr>_________________<br>
Bf-cycles mailing list<br>
<a href="mailto:Bf-cycles@blender.org" target="_blank">Bf-cycles@blender.org</a><br>
<a href="https://lists.blender.org/mailman/listinfo/bf-cycles" rel="noreferrer" target="_blank">https://lists.blender.org/mail<wbr>man/listinfo/bf-cycles</a><br>
<br></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
Bf-cycles mailing list<br>
<a href="mailto:Bf-cycles@blender.org" target="_blank">Bf-cycles@blender.org</a><br>
<a href="https://lists.blender.org/mailman/listinfo/bf-cycles" rel="noreferrer" target="_blank">https://lists.blender.org/mail<wbr>man/listinfo/bf-cycles</a><br>
<br></blockquote></div><br></div></div>