Planar and vertical nanostructures for thermoelectric generation