merged generateSparse and generateSkin into one function