Animal camouflage is a paradigmatic example of evolution by natural selection, and can only be understood in terms of adaptation to deceive the brains of potential predators and to the environment. Counter-shading is a very common pattern of coloration in the animal kingdom. Countershaded animals are darker on the side that faces a greater light intensity (typically, the back) and have a lighter opposite face. This pattern counterbalances shadowing and may make the animal harder to see against its background, or potentially modifies its perceived shape. Here we model the interaction of light and body shape to predict what the coloration of an animal should be to deceive a predator that has evolved the ability to detect shape from shading. We assess to what extent optimal patterns for crypsis depend on both light distribution and body orientation. We unveil the logical link between matching the background and reducing shape cues.