Hi.
The ambient light is just a 'fix' for not having enough computational power. Usually, light is reflected multiple times from multiple surfaces. In reality, if you have a single point light in a room (a light bulb for example), then you would still get some light that reaches areas which have no direct "line of sight" to the light source. Therefore, shadows are not just black areas. On the computer (if you are not using raytracing) you don't calculate multiple reflections since it is really expensive. You just compute the light that comes directly from the light source and reflects directly into the camera (diffuse light). In result, you get totally black shadows, which doesn't look realistic. So you add some kind of base lighting to the whole scene so that shadows aren't pitch black anymore. You basically approximate the light which would result from more than one reflection by a constant value.
You add them because you are calculating the total amount of light at a position. If you had multiple point lights, you would also add them up to get the total amount of light.
So what about the multiplication? Surfaces absorb and reflect certain wavelengths of the light. The colour we see is just the light which was reflected. So if a specific wavelength (or colour) is fully absorbed, its value needs to be zero. How do we achieve this? Just multiply by 0! On the other hand, if a colour is fully reflected, it needs to be multiplied by 1. if a colour is absorbed by 50%... just multiply by 0.5 per cent. I think you get the pattern here
59 minutes ago, cebugdev said:
why are the materials added
You add the different light amounts, not the materials. You just need the reflectivity from the material inside of your diffuse light calculation to calculate the right amount of reflected light towards the camera.
In general, you calculate the light (colour) intensity that reaches a certain pixel of the camera and use it as the output of your fragment shader. It's like our eyes work. The colour you see is determined by the light that reaches each part of the retina. Therefore, you need to know how light is reflected depending on the angle (this happens in the diffuse calculation) and which wavelengths/colours are reflected (this is the multiplication with the colour).
Greetings