Early on in World War I, artists were brought in to custom paint camouflage on war ships and large passenger liners. Based in part on the artistic fashions of the time, particularly Cubism, this soon became known as "Dazzle Painting" and continued to be used until the end of World War II.
U-boats did not aim their torpedos directly at a ship to sink it. Because the target was moving, it was necessary to aim ahead of its path in order for the torpedo to arrive in the correct spot at the same time as the ship. If the torpedo is too early or too late, it will miss. The primary goal of dazzle painting was to confuse the U-boat commander who was trying to observe the course and speed of his target.