Quasirandom sampler

Discussion related to the LuxCore functionality, implementations and API.
User avatar
alpistinho
Developer
Developer
Posts: 198
Joined: Thu Jul 05, 2018 11:38 pm
Location: Rio de Janeiro

Re: Quasirandom sampler

Post by alpistinho »

How do I edit the OpenCL code? I see that there are some .cl files, but not for all the things that exist in the C++ code
Support LuxCoreRender project with salts and bounties
User avatar
alpistinho
Developer
Developer
Posts: 198
Joined: Thu Jul 05, 2018 11:38 pm
Location: Rio de Janeiro

Re: Quasirandom sampler

Post by alpistinho »

alpistinho wrote: Sun Mar 10, 2019 10:37 pm Why is it bad for sampling that some pixels are skipped?
I've been thinking and I guess it is because each pixel should be sampled according to a separate Sobol sequence. When the pass is increased globally and some pixels were skipped, the distribution for those becomes compromised and worsens the sampling quality.

I will implement the pass variable for each pixel, possible using the Film class. Unfortunately I am in a hurry this week and don't expect to have much time until the next.
Support LuxCoreRender project with salts and bounties
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Quasirandom sampler

Post by Dade »

alpistinho wrote: Mon Mar 11, 2019 9:48 pm
alpistinho wrote: Sun Mar 10, 2019 10:37 pm Why is it bad for sampling that some pixels are skipped?
I've been thinking and I guess it is because each pixel should be sampled according to a separate Sobol sequence. When the pass is increased globally and some pixels were skipped, the distribution for those becomes compromised and worsens the sampling quality.
Yes, that it is what I was trying to say in my previous post.
Support LuxCoreRender project with salts and bounties
User avatar
alpistinho
Developer
Developer
Posts: 198
Joined: Thu Jul 05, 2018 11:38 pm
Location: Rio de Janeiro

Re: Quasirandom sampler

Post by alpistinho »

Dade wrote: Wed Mar 06, 2019 11:09 pm The current advantage is that there is one single global "pass" instead of a "pass" for each pixel. It saves some ram but it is pretty bad for sampling.
Can't I use the SAMPLECOUNT channel for that? It is stored anyways and counts how many passes each pixel received, no?

I guess I have done something stupid or are not understanding something, since the result does seem to converge but it is funny looking during the rendering.

This is the only code change on SobolSampler::InitNewSample:

Code: Select all

if (rndGen->floatValue() < adaptiveStrength) {
	// Skip this pixel and try the next one
	continue;
} else {
	pixelPass = *(film->channel_SAMPLECOUNT->GetPixel(pixelX, pixelY));
}
				
...
			
sample0 = pixelX +  sobolSequence.GetSample(pixelPass, 0);
sample1 = pixelY +  sobolSequence.GetSample(pixelPass, 1);
I haven't touched SobolSampler::GetSample, but I guess I should have used the pixelPass for it too and it may be the cause for the artifacts.

Using SAMPLECOUNT as pass
new.png
Global pass
current.png
Support LuxCoreRender project with salts and bounties
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Quasirandom sampler

Post by Dade »

alpistinho wrote: Thu Mar 14, 2019 12:45 am Can't I use the SAMPLECOUNT channel for that? It is stored anyways and counts how many passes each pixel received, no?
There would be a problem with SAMPLECOUNT and hybrid rendering: it is the sum of CPU and GPU work while CPU and GPU threads uses 2 different samplers. The pass count buffer must be part of the SobolSharedData object and updated atomically (i.e. in a thread safe way). Something you can not do across both CPU and GPU.
Support LuxCoreRender project with salts and bounties
Post Reply