Allow heightfield color/material layers to be of different resolutions than the height layer.

This block:  if (height) {} appears to contain the only side effects of the foreach loop, and height is not updated inside the loop.  Hence it seems like the foreach loop could be put inside the if(height) check.

This doesn't block the merge -- it is merely an optimization.