Integration intuition

Started by
5 comments, last by GaryPolter 12 years, 10 months ago
I'm having trouble developing an intuition for integration that does not deal with area. One example is the function for computing ambient occlusion (http://en.wikipedia.org/wiki/Ambient_occlusion)

For ambient occlusion, the visibility function is integrated over a hemisphere with respect to the solid angle. Conceptually, I get it - we sweep over a hemisphere and sum the ambient occlusion value for every infinitesimally small solid angle. For some reason I don't intuitively understand this - my brain hasn't "clicked".

I intuitively understand and can mentally picture "normal" area integration for both single and double integrals, but I just can't do it for this.

Can any of you guys help me understand what's going on? What area of calculus is this?

Thanks for any insight.
Advertisement

I'm having trouble developing an intuition for integration that does not deal with area. One example is the function for computing ambient occlusion (http://en.wikipedia....bient_occlusion)

For ambient occlusion, the visibility function is integrated over a hemisphere with respect to the solid angle. Conceptually, I get it - we sweep over a hemisphere and sum the ambient occlusion value for every infinitesimally small solid angle. For some reason I don't intuitively understand this - my brain hasn't "clicked".

I intuitively understand and can mentally picture "normal" area integration for both single and double integrals, but I just can't do it for this.

Can any of you guys help me understand what's going on? What area of calculus is this?

Thanks for any insight.



Picture splitting your hemisphere into hundreds of tiny surface elements, just like we do to the Earth with longitude and latitude. At each surface element your function will have a value that can be calculated (though it may not be that easy, since you have to calculate it over a small surface area). Now make the surface elements infinitely small, giving you an infinite number of them to take up the whole hemisphere. The surface area of each surface element is now approaching zero. What you're doing when you integrate over the hemisphere wrt the solid angle is adding up the value your function returns at every one of those infinitely small surface elements.

Don't know if that mental picture helps.
So, if your function tells us how much light is emitted from any given point on the hemisphere (specified by giving a solid angle, but it could just as easily be re-expressed to be specified by giving polar coordinates, for e.g.), then integrating that function over the hemisphere is equivalent to meticulously taking the measurement of light emitted at each point on the hemisphere and adding them all up to find the total amount of light emitted. The only thing is you have to take that measurement an infinite number of times, which is where calculus comes in.
Integrals often represent averages. For instance, if 68% of the hemisphere is unobstructed, the integral of the visibility function is going to be something like 2*pi*0.68 (where 2*pi is the total area of the hemisphere, which is what you would get if you integrated the constant 1). There are several ways of computing an average:

* You could generate many random points on the hemisphere and check what fraction of them are unobstructed (this is called Monte Carlo integration). As the number of samples goes to infinity, your fraction will converge to a value which is the integral.

* You could pick samples from a regular grid of latitude and longitude coordinates, but in this case you have to multiply by a weight that has to do with the density of samples around the points where you are integrating. As you make the grid finer and finer, your computed average converges to a value which is the integral.

* If you have a precise symbolic description of the visibility function, you could use methods from calculus to compute the exact integral.


The first two methods are numerical and the last one is analytical. Most of the time you'll be using numerical methods in computer graphics.

Does that help?
Thanks for the information guys, it's starting to make more sense.

alvaro: I get what you're saying about the average, but I'm not clear on what you mean by "integrate the constant 1". Could you please elaborate using a 2D integration example?

I think I'm confused because I can't understand how to apply the relationship between w and dw. w is the angle of the vector represented by pi and phi. dw is the differential area of the ... angle? Using Monte Carlo integration, would my sample set contain w as represented by pi and phi?

Thanks again!

alvaro: I get what you're saying about the average, but I'm not clear on what you mean by "integrate the constant 1". Could you please elaborate using a 2D integration example?

Think of the usual integral of a function of one variable. If you compute the integral of 1 on a particular interval, the result is simply the length of the interval. Similarly, when you integrate 1 on a hemisphere, you get the area of the hemisphere, which is 2*pi. My point is that if you have a function that takes values 0 and 1 on the hemisphere and you want to know what fraction of the hemisphere is 1, you can compute the integral and then divide by the integral of 1, which is 2*pi.

I think I'm confused because I can't understand how to apply the relationship between w and dw. w is the angle of the vector represented by pi and phi. dw is the differential area of the ... angle?[/quote]
The precise definition of dw is a very tricky matter, and I recommend you don't go into it in detail if you want to stay sane :). You can think of it as indicating that w is the integration variable. I believe Physicists like to think of dw as being a tiny area around w, but I don't know if this would help you.

Using Monte Carlo integration, would my sample set contain w as represented by pi and phi?[/quote]
You can parametrize your hemisphere any way you want, but make sure you use a uniformly random distribution on the hemisphere. This page might help.

The precise definition of dw is a very tricky matter, and I recommend you don't go into it in detail if you want to stay sane :). You can think of it as indicating that w is the integration variable. I believe Physicists like to think of dw as being a tiny area around w, but I don't know if this would help you.



I took a look at one of my old calculus books and there are actually a few pages on integrating over a sphere to calculate the area of it. It uses theta and d_theta, where d_theta is a tiny change in theta (same as f(x) and dx). That made sense to me, and I can properly visualize how dw would look.

Of course, in this instance, we don't want the area under the hemisphere, but are using the integral instead to calculate how much light is emitted from our point.

Thanks to everyone who posted in this thread, you've all been a great help.

This topic is closed to new replies.

Advertisement