A three-dimensional body shape is problematic for camouflage because overhead lighting produces a luminance gradient across the body's surface. Countershading, a form of patterning where animals are darkest on their uppermost surface, is thought to counteract this luminance gradient and enhance concealment, but the mechanisms of protection remain unclear. Surprisingly, no study has examined how countershading alters prey contrast, or investigated how the presence of a dorsoventral luminance gradient affects detection under controlled viewing conditions. It has also been suggested that the direction of the dorsoventral luminance gradient (darkest or lightest on top) may interfere with predators' abilities to resolve prey's three-dimensional shape, yet this intriguing idea has never been tested. We used live fish predators (western rainbowfish, Melanotaenia australis) and computer-generated prey images to compare the detectability of uniformly pigmented (i.e. non-countershaded) prey with that of optimally countershaded prey of varying contrasts against the background. Optimally countershaded prey were difficult for predators to detect, and the probability and speed of detection depended on prey luminance contrast with the background. In comparison, non-countershaded prey were always highly detectable, even though their average luminance closely matched the luminance of the background. Our findings suggest that uniformly pigmented three-dimensional prey are highly conspicuous to predators because overhead lighting increases luminance contrast between different body parts or between the body and the background. We found no evidence for the notion that countershading interferes with predator perception of three-dimensional form.