Quasirandom sampler

Discussion related to the Engine functionality, implementations and API.
alpistinho
Posts: 69
Joined: Thu Jul 05, 2018 11:38 pm
Location: Rio de Janeiro

Re: Quasirandom sampler

Post by alpistinho » Mon Mar 11, 2019 12:10 am

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

alpistinho
Posts: 69
Joined: Thu Jul 05, 2018 11:38 pm
Location: Rio de Janeiro

Re: Quasirandom sampler

Post by alpistinho » 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.

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.

User avatar
Dade
Developer
Posts: 2133
Joined: Mon Dec 04, 2017 8:36 pm

Re: Quasirandom sampler

Post by Dade » Mon Mar 11, 2019 10:56 pm

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

alpistinho
Posts: 69
Joined: Thu Jul 05, 2018 11:38 pm
Location: Rio de Janeiro

Re: Quasirandom sampler

Post by alpistinho » Thu Mar 14, 2019 12:45 am

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

User avatar
Dade
Developer
Posts: 2133
Joined: Mon Dec 04, 2017 8:36 pm

Re: Quasirandom sampler

Post by Dade » Thu Mar 14, 2019 4:59 pm

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