Some notes about Environment Maps, Hdri and stuff... (work in progress) by Rafael Otake
Environment mapping is a method that consists of warping a 2D image by projecting it to a sphere that surrounds a 3d scene, like a huge bubble, of which the centre is the point of view.
This bubble provides information that can be used as:
There are several ways to project this 2D image; the basic types can be:
- Planar (Spherical probe)
There can be some variations using an hemisphere, considering that in some cases the bottom half is below the horizon:
- Planar (Hemispherical probe)
The proportion of the 2D image (width x height) depends on what kind of projection is used.
We must remember that it is a 2D image projecting on a 3D object, so it has very strong deformations and deformations are specific to each kind of projection method used. The techniques for creating each of this type of environmental maps are specific too.
Here are just 2 examples using some NASA photos from the "Blue marble". The 1st, a shot of the Atlantis using a fish eye lens, that could be used as a planar projection and the 2nd, a composite of satellite images as a spherical map of this little planet. This last one could be a little strange for environment mapping, (because it is seen from the inside) but it's the best example of this deformation on the poles... besides the fact that it is beautiful.
These deformations are "corrected" when warping them (back) on the sphere with the proper projection, again in these cases, planar and spherical respectively.
Maybe the most common type of projection used in environmental mapping is Spherical.
Note: Not all images are bitmaps; some can be procedural images.
These examples (Earth Maps) show that the quest for unwarping and getting rid of this distortions have been here for a while.
Panoramas are photos that cover (in some cases) 360°, that can be used as spherical or cylindrical maps (depending of how are they created and manipulated), taken either with a special camera (with a rotating objective), or by composing several shots with special software.
Its easy to make panoramas taking several shots. The amount of shots depends mainly on the "visual angle" of your camera.
This is the relation betwen the focal length of the objective and the size of the sensor (or film).
The 135mm film is used as a reference and 50mm lens considered as the normal lens (for this reference).
If the film is bigger, the normal lens is bigger too and if you have a tiny camera, both the sensor and the normal lens are smaller.(The images are not to scale)
Ok. I have a simple camera and I don't have a clue of the focal distance
Ask a friend to help you and you need your digital camera with optical zoom.
Ask her... (the female 3d model looks nice) to extend the arms to measure the distance between the camera and she and pose extending her arms.
Adjust the zoom so you can see the tip of the fingers on both sides. You can consider that equivalent to 35mm on a 135mm.
Adjust the zoom so you can see half forearm (the middle point from elbow to wrist). You can consider that equivalent to 50mm on a 135mm. That is your normal focal distance.
Can we go back to the panorama stuff?
The basic technique is:
- Put your camera on a tripod, and take the necessary shots rotating the camera (center row images).
- Tilt your camera up and make another round. You need to repeat this 3 times, and the 4th time you are pointing to the top of your head; just take 4 shots there.
- Repeat for the lower rows and take 4 final shots to the ground you are standing on.
If we are taking pictures with a 35mmequivalent lens, we need about 8 shots rotating 360° (every 45°) and 7 rows in total (tilt 22.5°), plus 4 shots above your head and 4 to the floor you are standing on. 64 in total.(I haven't updated the animation)
- It's important that your camera has manual settings for light exposure, because in automatic settings the different light conditions of your scene will make the camera to adjust; for example the sky darker and a tree lighter.
- Turn off the automatic white balance too.
If you don't have those features, you will need to spend some time adjusting the images in a retouching program.
- Look at some reference points while rotating the camera, to make sure you are not missing some spots. While pointing the camera down, look in the upper corners and vice versa.
- If you use a 35 mm lens the 64 pictures taken with care will do fine. Make some tests, if you notice missing spots; try zooming out a little in all the shots (28mm).
- The resolution of the finished image can be pretty big, for example a 6Mpx camera (3,000x2,000px) with this 64 shots with a 35mm lens, will produce an image around 200Mpx (20,000x10,000px). Some experimentation needed.
Take your photos at high resolution and experiment with lower resolution versions, maybe fourth size.
Use your favorite program to stitch them together...
What are High Dynamic Range Images?
Let's start from the beginning... what is this dynamic range?
The Wikipedia reads:
"Dynamic range is a term used frequently in numerous fields to describe the ratio between the smallest and largest possible values of a changeable quantity, such as in sound and light."
Lets see some examples
Here is a photo from Charlie Chaplin's film "The Kid" (1921).
In this close up of Jackie Coogan, we can see there is no detail in the face, or in the background. The levels of grey that the film captured were too limited; that is the reason actors had to use strong make up on the eyes and lips, to enhance facial expression.
So... what is happening?
Here is a grayscale file. This file contains not only 2 dimension information (x, y) but also depth info, regarding the brightness of each pixel...
But in most of the cases, the device used to capture the image can't respond to all the range needed and crops the values.
Normally this range is equalized to fit the use we need.
We are used to seeing our photos as we shot them so we normally won't notice the crop but in some cases, this is evident, like this daylight shot for an interior-exterior angle.
This is when high dynamic range enters the game
This technique consists of taking the same motive with different exposures. The overexposed image will capture details on the dark areas and the underexposed image will capture detail on the highlights...
...and merge them together. Now we have an Hdr image.
Seeing this, it is obvious that the image has more information than a normal photo; that is why we need a new file format, not a standard jpg, for example.
In most cases we can't see an Hdri correctly because the standard software and the standard monitors crop again the image displayed.
And Tone mapping?
Tone mapping is a technique (or several techniques) to compress and adjust an HDRI image to a normal image Ldri (low dynamic range image). Squashing the range, not cropping it.
So now we can see details we did not have before; in the highlights in this case.
And what are Globals?
This depends on the program, but basically is the information on the surroundings of a 3D scene. It can contain an environmental map but additional information too, like its type of projection, intensity, rotation etc...
Ok, I tried to explain the diference betwen several concepts that sometimes are confused.
Environmental Maps, Hdri, Panoramas, Tone Mapping, Globals... some environmental maps can be Hdri, some not, some can be panoramas, some taken with fish eye lenses, some spherical, some cylindrical, some images can be tone mapped and are Hdri no more, etc, etc...
As always... an explanation generates more questions than answers...
Thanks to the Kerkythea's forum for its support. Specially to Roy and Carole.