Define a mixture of one / three or six textures corresponding to the X, Y and Z local axis.
Triplanar mapping is a 3D renderer that maps 3 or 6 times an object along the X, Y and Z axis.
Instead of UV mapping, triplanar mapping works with 3 or 6 renderers used as textures. Each of them is assigned to an axis and blended on the edges.
This texturing technique avoids problems of stretching texture.