Calculate greyscale values on the fly