#### Archived

This topic is now archived and is closed to further replies.

This topic is 6035 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi everyone, For advanced raytracing stuff like antialiasing, soft shadows, diffuse materials, depth of view, etc. I know you need to do sampling stuff using Jittering, Stochastic Sampling, Monto-carlo techniqes, etc. Can anyone explain to me what is "Jittering" and show me some examples and explain to me about Stochastic sampling and why we need monto-carolo techniques? Thanks

##### Share on other sites
I can provide a somewhat high level view of these things.

Jittering just means slightly rotating the camera so the view varies just a bit---jitter the camera back and forth. The jitter is actually a small rotation about an arbitrary quaternion through the camera lens. You get a few things by jittering the camera and sampling each pixel multiple times as the camera is rotated:

1) antialiasing effects, if the jitter is small enough that objects basically cover the same pixels as the root or center camera position. This is a more natural type of antialiasing than you would get if you just do something like subpixel sampling in hardware, since its closer to the way a real camera/lens works, and the way eyes work.

2) field-of-view effects, where objects away from the camera's focal point are blurred.

The distance the camera is jittered away from its center location will depend on the aperture setting (related to "f-stop") of the virtual camera. For example, if the camera is a pinhole camera, then most everything will be in focus and you would not jitter for field-of-view since the field-of-view is infinite for all practical purposes. If the camera you are simulating is a modern camera, such as a 35mm camera with detachable lenses, then you would set the maximum jitter angle to be a function of the camera aperture. Its a function of the geometry of rays that can physically pass through the edge of the lens aperture, and touch the corners of the film image plane. This way you get different levels of field-of-view blurring for different aperture settings, just like in real life. (I realize this would be easier with a picture, but I just don't have time to illustrate my posts.) Thus, for a pinhole camera, you would only jitter to get antialiasing. (But you can get more interesting images if you simulate a non-pinhole camera!)

To get quality field-of-view effects, with no banding or quantization artifacts, you probably have to jitter the camera to many different angles, just to get good coverage of the range of rays that would pass through a real camera. *This* is where stochastics and monte carlo techniques come in. The gist of stochastic sampling is that it basically means random sampling. There's a bunch of theory related to stochastics, but at a high level the word stochastic means random. To avoid things like moire patterns, which are ugly and distracting visual artifacts that emerge due to uniform sampling or discretizations, you jitter the camera randomly (e.g., stochastically).

You can see such distracting artifacts in texture mapping as well. If you just take a texture and tile it over a plane, say 100 x 100 times, your eye will pick up on the pattern of tiles. This can be bad if you wanted the plane to look like a nice, real-world terrain. A better way to tile is to have multiple textures that are different but with a variety of common overlaps, then randomly place them on the terrain, rotating and overlapping different. You can then make the plane look more like a nice terrain with just a few textures if you use the random overlap technique. (See www.gamaasutra.com for a recent article that describes this better than I can do quickly.)

The meaning of "monte carlo" techniques is deeply related to stochastic sampling. Monte Carlo techniques are random sample techniques. The monte carlo sampling theory tells you, among other things, just how many samples you need. Do you need 2, 4, 16, a million? And the answer depends, obviously, on how accurate you want the result to be. In image generation, I imagine monte carlo techniques would tell you how many jitter points you need to sample.

Another part of monte carlo methods is the selection of random distributions. Most of us are familiar with the "bell curve" in population statistics (or whatever). That bell curve is actually called the "normal" distribution in probabilistic theory (which is basically used to model stochastic processes). There are other distributions as well, including uniform, lognormal, Wiebull, many others. The different distributions are necessary to produce computer models of different real-world things, and in image generation you would probably choose different distributions to get better coverage of the range of jitter angles.

Jittering can also be applied to lights, and this is a very basic way to get soft shadowing. The random distribution choice is going to be very important for light source jittering.

So, I hope that helps a bit. Sorry that I don't have time to produce images, and that I don't have a web site to reference.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

Edited by - grhodes_at_work on December 13, 2001 3:39:20 PM

##### Share on other sites
I was watching Juriasic Park III on DVD and they had a bonus feature on Industrial Light and Magic. One of the guys mentioned adding "camera shake". I assume that is jitter. I hadn''t ever really thought about it, but it seemed to make sense that it would make the image more realistic particularly when mixed with live action. Is that also how you would get rid of the outline on blue screened images? It seems like a lot of blue screened images have a small halo type of outline where it transistions from the foreground image to the background.

##### Share on other sites
quote:
Original post by LilBudyWizer
I was watching Juriasic Park III on DVD and they had a bonus feature on Industrial Light and Magic. One of the guys mentioned adding "camera shake". I assume that is jitter. I hadn''t ever really thought about it, but it seemed to make sense that it would make the image more realistic particularly when mixed with live action. Is that also how you would get rid of the outline on blue screened images? It seems like a lot of blue screened images have a small halo type of outline where it transistions from the foreground image to the background.

Nope. ''Camera shake'' is just what it sounds like, artifically jostling around the camera so it looks more like the footage was shot using a physical hand held camera. This makes CGI shots interface well with the other shots in the movie, since you notice this kind of thing more when only certain shots are way too smooth.

This is kind of like lens flare - your eye doesn''t see it, but it makes CGI look more like the conventional camera work that we''re used to.

• 11
• 20
• 12
• 10
• 38
• ### Forum Statistics

• Total Topics
631401
• Total Posts
2999864
×