Smart sampling methods that improves performance.

Practical and theoretical implementation discussion.
Post Reply
shiqiu1105
Posts: 138
Joined: Sun May 27, 2012 4:42 pm

Smart sampling methods that improves performance.

Post by shiqiu1105 » Mon Oct 13, 2014 8:27 pm

Hey guys,

I have been trying to optimize my own renderer, and I have been comparing my performance against embree 1.1.

When we use the same bvh traversal methods, embree is still 30-50% faster than mine implementation.
So I was trying to find out why.

And I did notice that one thing causing the perf difference is the way embree generates samples.
Unlike me, who generates samples for each pixel, embree generate only 64 for samples for the entire frame in one iteration.
And during rendering, each pixel selects randomly from the 64-sized sample pool to use.

I tried this after realizing what embree does, and my perf was instantly boosted to almost the same with embree, but the resulting image was full of ringing-like artifact, which is really not surprising considering I am using only 64 random sample sets for the entire image.

Embree didn't generate 64 samples randomly. instead it seems to stratified them, so the 64 samples' quality are high.

It seems like a really smart thing, considering it almost saved all the cost from sample generation.
Is this approach published or documented somewhere, any prove that it doesn't hurt the convergence rate much?

Thanks,

ingenious
Posts: 281
Joined: Mon Nov 28, 2011 11:11 pm
Location: London, UK
Contact:

Re: Smart sampling methods that improves performance.

Post by ingenious » Mon Oct 13, 2014 10:42 pm

Yeah, I also noticed it some time ago when I was exploring their source code. And apparently this trick is still there :) It doesn't reduce the numerical convergence in any way. It only adds correlation between pixels which can potentially be visually disturbing. This reminds me of coherent path tracing. I'm not aware of any papers that investigate inter-pixel sampling correlation, which is strange, because a lot of the artifacts in rendering come precisely from there. Photon mapping and (ir)radiance caching are prominent examples, where most of the splotches are not due to bias as much as due to the effective correlation that the sample reuse brings.
Image Click here. You'll thank me later.

shiqiu1105
Posts: 138
Joined: Sun May 27, 2012 4:42 pm

Re: Smart sampling methods that improves performance.

Post by shiqiu1105 » Mon Oct 13, 2014 11:45 pm

ingenious wrote:Yeah, I also noticed it some time ago when I was exploring their source code. And apparently this trick is still there :) It doesn't reduce the numerical convergence in any way. It only adds correlation between pixels which can potentially be visually disturbing. This reminds me of coherent path tracing. I'm not aware of any papers that investigate inter-pixel sampling correlation, which is strange, because a lot of the artifacts in rendering come precisely from there. Photon mapping and (ir)radiance caching are prominent examples, where most of the splotches are not due to bias as much as due to the effective correlation that the sample reuse brings.
I just did two experiments with my own renderer.
Both with path tracing and random sampler. The sponza scene is with 256 spp, while the cornell box is with 64spp.

Perceptually I could tell little difference between using one sample per pixel vs. reusing 64 samples. (Maybe the reusing approach is a tiny little bit noisier, am I crazy?)

In the cornellbox, reusing sample achieves maybe ~150% performance against per pixel samples.
In sponza however, the difference is much smaller, likely due to longer traversal time, and texture fetch...

I doubt that the sample reusing will work with some algorithms like MLT.
I guess I will stick with my original approach..

Screenshots attached.
normal.jpg
Per pixel sample, 256spp
normal.jpg (237.97 KiB) Viewed 5010 times
pool.jpg
Reusing 64 samples, 256spp
pool.jpg (233.33 KiB) Viewed 5010 times
normal2.jpg
Per pixel sample, 64spp
normal2.jpg (222.96 KiB) Viewed 5010 times

shiqiu1105
Posts: 138
Joined: Sun May 27, 2012 4:42 pm

Re: Smart sampling methods that improves performance.

Post by shiqiu1105 » Mon Oct 13, 2014 11:46 pm

pool2.jpg
Reusing 64 samples. 64spp
pool2.jpg (222.7 KiB) Viewed 5010 times

macnihilist
Posts: 8
Joined: Thu Mar 22, 2012 9:36 am

Re: Smart sampling methods that improves performance.

Post by macnihilist » Tue Oct 14, 2014 9:31 am

I have not tried it exactly the way it is implemented in Embree, but I used similar methods to speed up GPU rendering, and I feel I should add a quick comment:
From my experience you have to be careful as soon as caustics or similar 'sharp' effects come into play, because they really can reveal that you are working with a small set of samples behind the scenes. This can reach the point where preview renders with few samples are downright misleading.

Post Reply