For a robust solution you need much more complex algorithm (like triplanar mapping, 3D textures, etc).
For this specific case, you may need to recalculate the normal vectors – they were not recalculated in the original demo, because it was not needed that much.
obj2.geometry.computeVertexNormals();