PDA

View Full Version : "Sample" Definition


A-Boy-From-Heaven
10-29-2007, 09:33 PM
Hi,
It has always remained a question for me that what "samples" really are.
Everywhere in any 3d app I see the word "sample"
for example AA sampling, FG points per sample, sampling radius, Photons per smaple.
I have always difficulties on understanding and explaing such terms to my friends. The fact is that I'm looking for a general and theoretic difinition so that can be easily understood without any knowledge of any 3D apps.
Thanks.

playmesumch00ns
10-30-2007, 02:29 PM
A sample is the result of an evaluation of a function with a given set of parameters. The exact function you're evaluating determines the type of sampling you're doing. For instance, the function that determines whether a particular point is is shadow from a particular light source might be called the shadow function, and so the result of that function for a particular point and light pair would be called a shadow sample.

We usually take multiple samples of any given function and average the results, a process called monte-carlo integration*, in order to avoid aliasing. For instance in our light example, each shadow sample we take will either be "on" or "off". If we only take one shadow sample per pixel, we will end up with a jagged shadow edge. However, if we take multiple shadow samples and jitter the parameters slightly (i.e. use slightly different source or destination points), then average the results, we get a nice, smooth shadow boundary instead.


*actually monte-carlo integration is a bit more complicated than this, but you can think of it like that conceptually.

A-Boy-From-Heaven
10-30-2007, 06:30 PM
Thanks a lot for your detailed answer. So the overall number of samples is relative to the size of the image. right?

soulburn3d
10-30-2007, 10:30 PM
Thanks a lot for your detailed answer. So the overall number of samples is relative to the size of the image. right?

Not necessarily, it depends on what sort of samples you're talking about. For example, many renderers antialias by sampling the same pixel over and over again, and then takes an average. So a larger image means more pixels, but the number of samples per pixel is controlled by a user setting in the renderer.

- Neil

playmesumch00ns
10-31-2007, 06:45 PM
I think what he's getting at is that since you take a certain number of samples per pixel, a larger image will mean more pixels which means a greater total number of samples. This is correct.

Ultimately though it's the number of samples per-pixel that will define the fidelity of the image.

Edit: off the top of my head I can only think of one type of sampling that's completely orthogonal to the resolution of the display image and that's photon shooting.

soulburn3d
10-31-2007, 07:37 PM
I think what he's getting at is that since you take a certain number of samples per pixel, a larger image will mean more pixels which means a greater total number of samples. This is correct.

That's only true if you use the same number of samples per pixel in each image. If I sample a 2k image with 1 sample per pixel, and a 1k image with 16 samples per pixels, there will be more samples in the smaller image. So number of samples really is non dependent to image size, even though a larger image does mean more pixels.

- Neil

playmesumch00ns
10-31-2007, 08:49 PM
Hehe I think we just splitting hairs here to be honest aren't we?

soulburn3d
10-31-2007, 11:43 PM
Hehe I think we just splitting hairs here to be honest aren't we?

Well, it's a small point, but I just want to be sure we're all on the same page :)

- Neil

CaptainObvious
11-02-2007, 02:55 PM
Also, keep in mind that adaptive sampling will throw the whole thing off. For example, many renderers anti-alias only high-contrast edges. As you crank up the resolution, the relative coverage of the edges will be reduced, lowing the average number of samples taken per pixel.

But that is DEFINITELY splitting hairs!

soulburn3d
11-02-2007, 03:32 PM
Also, keep in mind that adaptive sampling will throw the whole thing off. For example, many renderers anti-alias only high-contrast edges. As you crank up the resolution, the relative coverage of the edges will be reduced, lowing the average number of samples taken per pixel.

But that is DEFINITELY splitting hairs!

Haha! Yup, that's why it's so tough to make a definite correlation between samples and image size, there's too many exceptions :)

- Neil

CGTalk Moderation
11-02-2007, 03:32 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.