One method for computing diffuse global illumination is radiosity (Radiosity). The solution to the illumination problem is gained by bouncing light around all the surfaces in a scene until nothing changes anymore. To do this, one has to consider how much of the light arriving at one surface will be sent to another one. The proportion of the total light exchange is called view factor (sometimes form factor or configuration factor).
I once had to deal with a related problem, not radiosity, where I had to more or less compute the view factor of a differential surface patch (a point on a surface) and a disk. The point is located along the disk's normal, but rotated somewhat. This post will deal with the case, that disk is fully visible. You can find this and many other formulas at http://www.thermalradiation.net/, even with references on where they are from. Sadly, when I looked up the sources for the specific formulas, they were horribly described and nearly unreadable imho.
So I plan to do a (hopefully) more easily understood derivation.
The quantity we want to compute is as follows:
FdA1,A2=∫A2πr2cosβ1cosβ2dA2
We have a differential area dA1 and an area A2. We now integrate over A2, and for every differential area dA2 on it, we connect it to dA1. The length of that connection is r, the angle with the normal of dA1 is cosβ1 and the angle with the normal of dA2 is cosβ2.
There are various ways to deal with that problem depending on the geometry involved. One way can be found in a paper by Sparrow ("A new and Simpler Formulation for Radiative Angle Factors",1963). The key insight is, that Stoke's theorem can be used to compute that area integral, meaning you can transform the integral over the area into one over the surface's contour. The result is the following:
l1,m1,n1 are the components of dA1's normal expressed in a given coordinate system with the x,y,z axes. Or, as worded in the paper, they are the directional cosines, the cosines of the angle between the normal and each axis (or in other words, their dot product). The ∮C notation means, that we need a closed boundary curve, meaning we end where we start. The other values are the coordinates, their index representing which surface they belong to. Since we only go over the surface A2, only those coordinates vary. d2 is the squared distance between two points, so it can be computed as:
d2=(x2−x1)2+(y2−y1)2+(z2−z1)2
We can now get to our problem. First, let's sketch the setup:
In this sketch, two views are included. Below the line in the middle is the yz plane. We are always free to choose a coordinate system best suited for our endeavor. Here we choose one, where our point is located in the origin. Its surface patch is oriented, such that its normal lies completely in the yz plane. The disk's normal point along the negative z axis and is located directly on top of the point. As the surface patch already takes care of the orientation, the disk can be placed entirely in the xy plane, as shown in the top half of the image. The disk is located at z=h and has a radius r. The angle between the differential area's normal and the z-axis (or the disk's negative normal) is θ. The parameter we will use to describe the points on the circle is α, the orientation as shown.
For a more 3D-ish view of the scene, have a look at http://www.thermalradiation.net/sectionb/B-13.html. Our case here corresponds to the first case on the site. I will also use the same identifiers, so that we will arrive at the same expressions at the end.
With that in mind, we can define all relevant values. Let's start with the directional cosines. Since our surface normal does not extend into the x direction, they have an angle of π/2 (90∘) and therefore the cosine is 0. From the picture, we have the angle θ between n and z, so that cosine is cosθ. The last entry is between n and y. The angle beween them is 2π−θ. So we have cos(2π−θ)=sinθ.
l1m1n1=n⋅x=0=n⋅y=sinθ=n⋅z=cosθ
Next up are the values for the first surface (the differential area). Due to our choice of coordinate system, the point on the surface lies in the origin, so we have
x1y1z1=0=0=0
The last missing entries are the ones for the second area, or in this case, the area's contour and the squared distance. First, the disk is located at a constant z value: h. The disk's contour is a circle, so the usual description for a circle can be used.
x2y2z2=rsinα=rcosα=h
α varies from 0 to 2π for the whole circle. We could do only the half, since it's symmetric, but it doesn't matter much here. From that we can compute the differentials. For some function we have df=dxdfdx, where dxdf is just the derivative with respect to dx. Here, the parameter is α, so the result is:
Next post we will incorporate the fact, that some parts of the disks may connect with our surface from behind. They have to be removed from the calculation, which complicates the whole thing a bit.
View-factor partially visible
We want to compute the view factor of a disk and an oriented differential area located along the disk's normal. Before, we assumed all of the disk to be visible from our surface. But if our surface is rotated enough, the infinite plane it lies on intersects the disk. The cut off part is then behind the surface, so there is no radiation transfer. We will now handle that case. As before, we will derive the formula given in http://www.thermalradiation.net/sectionb/B-13.html. First a sketch of the updated setup:
The update from the last post is that we cut off the part of the disk behind the plane. The resulting shape is outlined in the very dark blue.
We will now find the condition for when the disk is fully visible. From the image, we can see that it is fully visible, if k is larger than the disk's radius r. Since the normal is perpendicular to the plane, we have ϕ=2π−θ. Computing the tangent yields:
tanϕ=tan(2π−θ)=cotθ=hk
And following from that
k=hcotθ
For the visibility condition:
r≤kr≤hcotθhr≤cotθcot−1(hr)≥θcot−1(H1)≥θ
The last line uses the definition H=rh. The reversal of the inequality sign comes from the fact, that the inverse cotangent function is monotonically decreasing. This is the same condition as given in the reference. If it holds, we can apply the previous post's reasoning and are finished.
For the next steps we will compute β.
cosββ=rk=rhcotθ=Hcotθ=cos−1(Hcotθ)
Since we will need it later, we can derive another useful expression with the identity sin(cos−1x)=1−x2
sinβ=sincos−1(Hcotθ)=1−H2cot2θ=X
We will now proceed with the actual computation. It will be split into two parts, since the contour can be decomposed into two parts: A circle segment and a straight line.
Circle segment
Pretty much all the setup is the same as in the last part, so I will refer to that for more information. The only difference is the interval over which to integrate. Before we had the full circle in [0,π]. Now a part is missing. The new interval goes up to π−β and starts at that value in negative −(π−β)=−π+β. One simplification can be done. Since the disk is symmetric, we could just integrate over half the disk and double the result. Doesn't matter in the end, just a bit less to write. We will now compute the values from before with the new bounds.
The second contour segment is a line. We have computed a few values before:
l1m1n1x1y1z1=0=sinθ=cosθ=0=0=0
From our sketch we can see, that the line is constant in z and y direction and only varies in x. Instead of computing some line parametrization, we will just let x2 vary from the line's start point to its endpoint. As before we will integrate over one half of the line and multiply the result by 2. The half length of the line is given by w in the sketch. We have to be careful not to change direction going around the contour. To comply with the winding direction of α, we will vary the line from w to 0. Now on to compute w:
sinβXw=rw=rw=rX
To compile all missing values:
x2y2z2=−k=−hcotθ=h
d2=x22+y22+z22=x22+h2cot2θ+h2
dx2dy2dz2=0=0
In the following, we will use 1+cot2θ=csc2θ=sin2θ1 a few times. With that we also have 1+cot2θ=sinθ1. Also, just as a heads up, I will not go into the detail of the final explicit integration in each formula, as those can be acquired either from consulting something like WolframAlpha or integration tables. Just one reminder: tan−1(0)=0. We have to compute the following expression:
The first term is 0, since l1=0. Now on to solve the two remaining ones, keeping in mind the doubling of the result with half the line and the direction.
Nearly done! Only one more to go! We will do some of the initial steps from the last one again in one go. Also, since there is a term cotθ=sinθcosθ we do some rearranging.