Camouflage through background matching is a widespread antipredator strategy in which animals blend in with their background to avoid detection. To maximise survival in a variable natural environment, animals can have colourations that either match one of the backgrounds maximally (i.e. specialist strategy) or match multiple backgrounds partially (i.e. generalist strategy). Theoretical work indicates that the optimal strategy depends on the extent of visual difference between the backgrounds (i.e. heterogeneity) or how commonly the animal will encounter the background types. However, the role of another critical determinant of detection, the visual complexity of the background, on optimal camouflage strategy (specialist versus generalist) in the face of background heterogeneity, remains unknown. Here, we performed a virtual predation experiment employing humans as surrogate ‘predators’ and explored how background complexity influences camouflage in heterogeneous backgrounds. Under low heterogeneity, we found the latency to attack generalists was higher than that for specialists on a complex background, but there was no difference between specialists and generalists on a simple background. At intermediate heterogeneity, both specialist and generalist targets took a similar time to be attacked irrespective of complexity, suggesting that both the strategies may co-exist. In contrast, at high levels of heterogeneity, we found generalists were attacked sooner when compared to specialists irrespective of whether the background was simple or complex. Our results thus suggest that complex backgrounds favour the evolution of a generalist background matching strategy that maximises fitness in multiple backgrounds but only when the visual difference between the backgrounds is low. Overall, our study provides key insights highlighting the underappreciated role of background complexity on the optimization and evolution of camouflage colouration in a heterogeneous environment. Many animals often face the challenge of encountering multiple visually distinct backgrounds due to variation in their environment, i.e. background heterogeneity. How should animals optimise camouflage when there is background heterogeneity? Theoretical studies have proposed that animals may match one of the many backgrounds (specialise) or match multiple backgrounds partially (generalise) as an optimal solution. However, cognitive constraints from the predator’s perspective may also have a role to play in this optimization problem, but this has not been examined. Our experiments involving humans as ‘predators’ show that when background complexity renders the search task more difficult, generalist targets took a longer time to be attacked than specialist targets, but only in less heterogeneous backgrounds. However, irrespective of complexity, specialist targets are better than generalists at avoiding attack in highly heterogeneous backgrounds. Cognitive constraints of predators may, therefore, play a significant role in the optimization of camouflage colouration in heterogeneous environments.