Matte
Mattes are used in photography and special effects filmmaking to combine two or more image elements into a single final image. Covers are often used to combine a foreground image (for example, actors on a set or a spaceship) with a background image (for example, a landscape view or a star field with planets).
In this case, the matte is the background image. In the film and its stage, mattes can also be physically large sections of painted canvas depicting vast natural expanses of landscape. In film, a matte principle requires masking specific areas of the film emulsion to selectively control which areas are exposed. However, many complex special effects scenes contain dozens of discrete image elements, requiring very complex use of mattes and layering overlays on top of each other.
For a simple matte example, we might want to depict a group of players with a giant city in front of a store and the sky visible above the store's roof. To combine the third, we would have two images, the actors on the set and the image of the city. This requires two masks/mats. One could mask everything above the roof of the store, and the other everything below it. By using these masks / mattes when copying these images to the third, we can combine the images without creating ghostly double exposures.

In-camera Matte Shooting
Also known as the Dawn Process, the in-camera matte shot is created by first mounting a piece of glass in front of the camera. Black paint is applied to the glass on which the background will be changed. The actors are then filmed on minimal sets. The director shoots a few extra minutes of footage to be used as test strips. The matte painter then develops a test strip (with darkened areas in the shot) and projects a frame of the 'Matted' shot onto the easel mounted glass.
This test video clip is used as a reference for painting the background or landscape to be matted on a new piece of glass. The live-action portion of the glass is painted black, then more test images are revealed to adjust and confirm the color match and edging. Next, critical parts of the matted live-action scene (with the desired acts and actors in place) are lined up to burn the painted elements into the black areas. Flat black paint blocks light from part of the film it covers, preventing double exposures on hidden live action scenes.