Brazil r/s Examples v1.2.0


HDR - Mirrored Ball Distortions

By: R. Annema

1. Introduction

Many of you have gotten into the practice of shooting your own HDR images from a 'Mirrored Ball' - be it a ballbearing or a gazing ball from a garden center, the principles are the same.  Those of you already doing this will know what the methods are behind creating them, and this document doesn't attempt to explain the process - for this, please see other references.

What this document will go over, however, is the inherent distortions one may encounter when creating (HDR) images from such a source, and their causes.
 

2. Why a Mirrored Ball 'sees' the entire' environment

But first, a very brief introduction into why a Mirrored Ball works the way it does - that is: 'seeing', nearly - and this will become important in the next sections, the entire environment 360° around.

Basic Mirrored Ball setup
Fig [2.1] - Basic Mirrored Ball setup
Figure 2.1 shows a basic setup of Mirrored Ball, represented by the green circle, and a camera, represented by the blue dot and lines indicating its Field of View.

180° degree spread?
Fig [2.2] - 180° degree spread?
This camera appears to see, at best, half the Mirrored Ball - which may lead you to believe it only 'sees' 180° of the environment, as illustrated in Figure 2.2.   However, the Mirrored Ball is reflective - and thus the law of reflection applies : "the angle of incidence equals the angle of reflection".  As such, we have to determine just what the Mirrored Ball reflects by looking at the angle that the camera's view makes to a point on the Mirrored Ball.

Law of reflection at work
Fig [2.3] - Law of reflection at work
Figure 2.3 shows the result of doing exactly this, indicating the view angles and their reflected angles in red.  As you can see, the further the angle of the camera's view nears the edge of the Mirrored Ball, the more outwards - and eventually forwards (that is, behind the Mirrored Ball) - the reflected angle becomes.  In fact, the maximum reflected angle is reached at exactly the edge - this angle is also known as the tangent angle.

Larger Ball, or shorter distance
Fig [2.4] - Larger Ball, or shorter distance
This tangent angle is entirely dependent on the distance of your camera from the Mirrored Ball and the size of the Mirrored Ball.  The camera's field of view is irrelevant to this angle, as you can see because the field of view of the camera is quite a bit larger than this tangent angle
You can calculate this tangent angle by using the formula : arctan(opposite/adjacent).  Where 'opposite' refers to the radius of your Mirrored Ball and 'adjacent' refers to the distance between your camera and the center of the Mirrored Ball. 'arctan' refers to the arc tangent function of the result value.  Most pocket calculators will have this labeled as arctan, atan or tan-1.
Figure 2.4 shows the effects of varying the size of the Mirrored Ball and the distance of the camera to it.

Less detail at edges (backside environment)
Fig [2.5] - Less detail at edges (backside environment)
Note how the the angle between the reflected angles becomes much larger as the angles of the view of the camera reach the side of the Mirrored Ball.  What this means in practice is that a proportionally large part of the environment's reflection, that which is 'behind' the Mirrored Ball will be concentrated at the edge of your Mirrored Ball - being compressed, as it were.  Given that both film and digital camera CCDs have a limited resolution (grain size in the case of film), it means that more of the environment will be packed into less grains or pixels at the edge of the Mirrored Ball.  As a result, that part of the reflected environment will be much less detailed, which also shows in a result transformed panorama.

Figure 2.5 shows such a transformed panorama, taken from a theoretically ideal setup.  The red regions are reflections of the environment above and below the Mirror Ball whilst the blue region is a reflection of the environment in front of (i.e. reflecting back to the camera) the Mirror Ball.  Focus on the distortions in the green region.  This region are what is at the 'back' of the panorama, i.e. what was 'behind' the Mirrored Ball.  You'll notice there is some blurring going on in its center.  This is where the resolution was too low due to the compression of the environment towards the edge of the Mirror Ball

Sections 3 and 4 will go over more realistic setups and distortions resulting from that.
 

"The ideal mirrored ball would be one with a high enough mass to bend light enough to get rid of that dead spot behind it" - Nathan Fariss


3. Dead Spot

Occlusion Cone for camera near to Mirrored Ball
Fig [3.1] - Occlusion Cone for camera near to Mirrored Ball
Projections of a Near view of Mirrored Ball
Fig [3.2] - Projections of a Near view of Mirrored Ball
The primary cause of the distortion is directly related to the tangent angle.  Everything in a scene that is obscured by the Mirrored Ball itself will not be present in the reflections.  Figure 3.1 shows this issue in the familiar Sponza Atrium scene, where a bright 'beachball' object is obscured from view by the Mirrored Ball.
After running the reflected image through HDRshop to convert the panorama from a Mirrored Ball to a Lat/Long projection (Figure 3.2), it should be clear that the 'beachball' object is nowhere to be seen.

Occlusion Cone for camera far from Mirrored Ball
Fig [3.3] - Occlusion Cone for camera far from Mirrored Ball
Projections of a Far view of Mirrored Ball
Fig [3.4] - Projections of a Far view of Mirrored Ball
By putting more distance between the camera and the Mirrored Ball the tangent angle becomes smaller, and less of the view becomes obscured.  Results of such a setup are shown in Figures 3.3 and 3.4.

This is one thing to keep in mind when shooting pictures of Mirrored Balls for HDR imaging.  But do read on...

Occlusion Cone for camera very, very far from Mirrored Ball
Fig [3.5] - Occlusion Cone for camera very, very far from Mirrored Ball
Eventually, putting the camera far away enough, we reach an almost orthogonal projection (shown in Figure 3.5), and the tangent angle becomes 0°. &nbps;However, there are two problems with such a setup :
1. In order to put the camera so far away, the camera has to be placed - in this scene - well outside of the Sponza Atrium.  There's a good chance that you simply can't, phsycally, position a camera there, or that some other object would obstruct the view of the Mirrored Ball.  Not to mention that you would need quite the extreme tele lens in order to have the Mirrored Ball fill as much of the frame as possible.
2. Even when doing so, the 'beachball' object is still partially obstructed by the Mirrored Ball simply due to the size of the Mirrored Ball itself.

Occlusion Cone for camera Near to smaller Mirrored Ball
Fig [3.6] - Occlusion Cone for camera Near to smaller Mirrored Ball
A more likely solution, then, is to use a smaller Mirrored Ball (note that the Mirrored Ball in the Sponza Atrium so far is rather.. huge).  Given a smaller Mirrored Ball we don't have to place the camera so far away, and we won't be needing an extreme tele lens setup either.  Figure 3.6 portrays this new situation, with Figure 3.7 showing the results.

It should be clear then that the amount of the environment that the Mirrored Ball reflects does indeed depend on the ratio between the radius of the Mirrored Ball and the distance of the camera to the Mirrored Ball.  Specifically, the smaller this ratio, the lesser the scene is obstructed.
 

4. Distortion from Dead Spot

Distortion from a 20° tangent angle
Fig [4.1] - Distortion from a 20° tangent angle
That Dead Spot behind the Mirrored Ball is also at the root of the most severe of the distortions you wil likely encounter.  When you run a Mirrored Ball image through HDRshop to create a Latitude/Longitude panorama, it assumes that the Mirrored Ball actually sees the full 360° of the environment and will create the Latitude/Longitude panorama accordingly.
This assumption that the Mirrored Ball reflects the full 360°, whilst it may only reflect 320°, is what causes a particular distortion - pinching.

Figure 4.1 shows the effect of pinching on a 320° reflection (tangent angle is 20°).   Note that there is severe distortions towards the back (remember, left/right in the transformed panorama).

90° offset setup
Fig [4.2] - 90° offset setup
What is often proposed to get rid of this distortion, as well as reflections of the photographer, is to take two pictures of the Mirrored Ball, at 90° offsets, as depicted in Figure 4.2.   This way the full 360° of the environment can be captured, as what is 'behind' the Mirrored Ball when seen from one camera angle becomes to the right, or left, of the Mirrored Ball when seen from the other camera angle.  Using the results of these two pictures, one can them composite one over the other to get rid of the distortions, and photographer.

20° tangent angle view - Camera 1
Fig [4.3] - 20° tangent angle view - Camera 1
20° tangent angle view - Camera 2
Fig [4.4] - 20° tangent angle view - Camera 2
20° tangent angle view - Composite between Camera 1 and Camera 2
Fig [4.5] - 20° tangent angle view - Composite between Camera 1 and Camera 2
Figures 4.3 through 4.5 show three sets of images from such a setup / operation.  As you can see, Figures 4.3 and 4.4 both have distortions due to the pinching effect, as well as a reflection of the photographer in the image.  In Figure 4.5 a composite is made from the two images, and the main distortions as well as the photographer's reflections are gone.

However, you may also notice that there is still some distortion, as well as much ghosting.  Although the compositing method gets rid of the major part of the distortion, it doesn't get rid of the overall distortion at all.  And it's not quite as trivial as some tutorial authors would like you to believe (feel free to try with the images given above).

Different compositing method
Fig [4.6] - Different compositing method
Some may point out that a different method is actually proposed by a Tutorial associated with HDRshop.  This method is emplored in Figure 4.6 - rather than compositing the transformed panoramas, a pre-transformed version of one of the Mirrored Ball images (say, Camera 2) is composited onto the other (say, Camera 1).  Although this method would work nicely in theory, you can tell from the input images not matching up that compositing this isn't any much easier, and actually doesn't get rid of the basic distortion from the edge compression, as can be seen in the result transformed panoramas - the first is still missing our 'beachball' object, whilst the second has a less noticeable but still preent pinching as well.
 

5. Analysis of the distortions

Distortion pattern for a Chrome Ball to Latitude/Longitude projection transformation
Fig [5.1] - Distortion pattern for a Chrome Ball to Latitude/Longitude projection transformation
The cause of the main distortion is still the fact that HDRshop assumes the Mirrored Ball to reflect a full 360° environment, and will transform (or distort) the image accordingly.

In fact, this distortion is in effect through HDRshop for any Mirrored Ball image. The shape of the distortion is always the same, shown in Figure 5.1 with red for left/right, green for front/back and blue for top/bottom.

Distortion intensities for a Chrome Ball to Latitude/Longitude projection transformation
Fig [5.2] - Distortion intensities for a Chrome Ball to Latitude/Longitude projection transformation
Only the intensity of the distortion changes - as a function of the tangent angle as discussed earlier. Figure 5.2 shows the intensity (blue is little distortion, red is severe distortion) for tangent angles from 10° to 170° in 20° intervals.  As should be clear, the higher tangent angles suffer from far more intense distortion.
 

6. Reducing distortion

Determining the scaling factor
Fig [6.1] - Determining the scaling factor
What should be done, then, is let HDRshop work on the full 360° that it expects by expanding the input image of the Mirrored Ball.  Since we know the tangent angle of our view of the Mirrored Ball, and we know how big our Mirrored Ball is in our image, we can calculate how much bigger our image should be using the trigonometry shown in figure 6.1.

Knowing our tangent angle, in this case 20°, we can determine what extent of our Mirrored Ball we can see (adjacent side 'a') by using the Cosine rule : a = cos(A) · hypotenuse.  In the case of the setup shown in Figure 6.1, the hypotenuse is simply the radius of the Mirrored Ball.  To determine how much larger the full radius (r) of the sphere is, we only have to divide the radius by the adjacent side, giving us the formula : scaling factor = r / ((cos(A) · r) nbsp;Since we are looking for a scaling factor, the actual radius of the Mirrored Ball is irrelevant, and the formula becomes scaling factor = 1 / cos(A).  The size of the Mirrored ball image then has to be scaled up by the same extent by expanding the image (i.e. adding pixels to the top, bottom, left and right sides).

Fig [6.2] - Expanded Mirrored Ball image In our case, the tangent angle is 20° gives us a scaling factor of 1 / cos(20*2) = 1.06418.  Doubling that up due to the law of reflection, and we get a value of 1.13247  The square enveloping the Mirrored Ball in the image is 256 pixels wide and high, so it has to be expanded to 256 · 1.13247 = 289.913 ~= 290 pixels wide and high, or 17 pixels all around.  Figure 6.2 shows the result of this on our test pano, along with its panoramic transformation to Latitude/Longiture projection in HDRshop.  What should be immediately clear is that all the overall distortion is gone, and we are now left with a gap at the left and right side of the transformed panorama.  However, it is these parts that we can now easily replace by a picture taken from a 90° offset.
 
[more content]
 


All trademarks and copyrights on this page are owned by their respective owners.
Everything else: ©2003  SplutterFish, LLC. All Rights Reserved. Privacy