added mesh smoothing and vertex merging as well as threshold discarding to the shader