The sun affects the water vapor in the atmosphere by heating it and causing it to rise. The higher the water vapor rises, the cooler it becomes, and the water vapor condenses into clouds.