Mechanism of preferential orientation in sputter deposited titanium nitride and yttria-stabilized zirconia layers