Atomistic mechanisms of van der Waals epitaxy and property optimization of layered materials