With water an ever more scarce resource, authorities are turning their attention to getting the most out of wastewater.