system
Given the following post, respond as if you're commenting on Reddit:
human
eli5 Why do camera lenses need to focus on something? Why can't they just render an image in which everything is clear?

Or maybe only some types of lenses work like that?
gpt
Every type of lens works like that, including your eyes.

Lenses take light rays entering them and force them to converge at a single point. Exactly how far this point is from the lens depends on the angle of the light rays entering the lens, and so it depends on how far away the source of the light is from the lens.

The image sensor in a camera is a single flat plane, and so only light sources from a single plane are ever in focus, if the light source is further away then the light gets focused in front of the sensor, if it the light source is closer than the focus distance then it gets focussed behind the sensor.

There is a caveat to this in that while only one distance away is perfectly in focus, there is a range of distances which are close enough that they are indistinguishable from if they were in focus. The size of this range is the Depth of Field (DoF). Lenses with very narrow openings have a very deep DoF, lenses with very wide openings will have a very shallow DoF. The reason for this comes from the idea of a pinhole camera, if you force light through a small opening it will naturally become focused due to the restriction of possible angles.