3D m-ary alphabet codes are possible for m<=4. As mentioned in the M-ary Alphabet Codes discussion, Hadamard Matrices and Binary Walsh matrices are m-ary alphabet matrices with m=2. Therefore, m=2 will not be discussed in detail here since such codes were already covered in the 3D-Hadamard Codes discussion. 3D m-ary alphabet codes are not possible for m>4.

m=2

The base matrix can be created by having the A2 matrix in opposing corners and a row/column of zeros wrapping around every exterior face. This is identical to the 2x2x2 Hadamard Matrix mentioned in the 3D-Hadamard Codes discussion (substituting {1,-1} with {0,1}).

G^{3D}_{2,1} =  \begin{bmatrix} \begin{bmatrix}0&0 \\0&1 \end{bmatrix} \begin{bmatrix}1&0 \\0&0 \end{bmatrix} \end{bmatrix}

Another way to construct a 3D m-ary matrix with m=1 is to radiate zero along every axis from one corner, and then radiate one along every axis from the opposing corner. This is identical to the 3D Hadamard Code Variant mentioned in the 3D-Hadamard Codes discussion (substituting {1,-1} with {0,1}).

G^{3D}_{2,1}ALT =  \begin{bmatrix} \begin{bmatrix}0&0 \\0&1 \end{bmatrix} \begin{bmatrix}0&1 \\1&1 \end{bmatrix} \end{bmatrix}

m=3

The base matrix can be created by having the A3 matrix in opposing corners and a row/column of zeros wrapping around every exterior face.

G^{3D}_{3,1} = \begin{bmatrix} \begin{bmatrix}
0&0&0 \\
0&1&2\\
0&2&1\end{bmatrix} \begin{bmatrix}
1&2&0 \\
2&0&1\\
0&1&2\end{bmatrix} \begin{bmatrix}
2&1&0 \\
1&2&0\\
0&0&0\end{bmatrix} \end{bmatrix}

Note that every exterior face of the cube results in a G3,1 matrix. The interior faces do not form a m-ary code matrix. Also note that a G3,1 matrix can contain one of two possible A3 matrices, and the exterior faces contain both both A3 matrices (3 of each). Note that each row/column/depth either contains all 0s or a {0,1,2}.

Another way to construct a 3D m-ary matrix with m=3 is to radiate one number along every axis from one corner, and then radiate another number along every axis from the opposing corner.

G^{3D}_{3,1}ALT1 = \begin{bmatrix} \begin{bmatrix}
0&0&0 \\
0&1&2\\
0&2&1\end{bmatrix} \begin{bmatrix}
0&1&2 \\
1&2&0\\
2&0&1\end{bmatrix} \begin{bmatrix}
0&2&1 \\
2&0&1\\
1&1&1\end{bmatrix} \end{bmatrix}\\~\\
G^{3D}_{3,1}ALT2 = \begin{bmatrix} \begin{bmatrix}
0&0&0 \\
0&2&1\\
0&1&2\end{bmatrix} \begin{bmatrix}
0&2&1 \\
2&1&0\\
1&0&2\end{bmatrix} \begin{bmatrix}
0&1&2 \\
1&0&2\\
2&2&2\end{bmatrix} \end{bmatrix}\\~\\
G^{3D}_{3,1}ALT3 = \begin{bmatrix} \begin{bmatrix}
1&1&1 \\
1&2&0\\
1&0&2\end{bmatrix} \begin{bmatrix}
1&2&0 \\
2&0&1\\
0&1&2\end{bmatrix} \begin{bmatrix}
1&0&2 \\
0&1&2\\
2&2&2\end{bmatrix} \end{bmatrix}

Some of the faces may not technically be m-ary alphabet codes because they do not contain a row/column of all zeros. Instead they contain a row/column of 1s or 2s. There is nothing special about the zeros though. Higher order matrices can can be constructed using similar rules and will demonstrate similar properties. Notice that all exterior faces of a given cube contain the same A3 matrix. However, the numbers will be substituted. For example in ALT1, the A1 matrix of the front face contains {1,2}, while A1 matrix of the rear face contains {0,2}. Both are the same matrix but 1 is substituted for zero. Note that each row/column/depth either contains all 0s, all 1s, all 2s, or {0,1,2}.

m=4

A 3D m-ary matrix with m=4 can only be created using the alternate method discussed for m=3. There are (m-1)!, A4 matrices, resulting in six matrices which all have zeros radiating from the top left corner of the front face. There are six more by swapping 0s for 1s, 2s, or 3s. In all theses cases, each row/column/depth either contains all 0s, all 1s, all 2s, all 3s, or {0,1,2,3}.

G^{3D}_{4,1}ALT1 = \begin{bmatrix} \begin{bmatrix}
0&0&0&0 \\
0&1&2&3\\
0&2&3&1\\
0&3&1&2\end{bmatrix} \begin{bmatrix}
0&2&1&3 \\
2&0&3&1\\
1&3&2&0\\
3&1&0&2\end{bmatrix} \begin{bmatrix}
0&3&2&1 \\
3&2&1&0\\
2&1&0&3\\
1&0&3&2\end{bmatrix} \begin{bmatrix}
0&1&3&2 \\
1&3&0&2\\
3&0&1&2\\
2&2&2&2\end{bmatrix}\end{bmatrix}\\~\\
G^{3D}_{4,1}ALT2 = \begin{bmatrix} \begin{bmatrix}
0&0&0&0 \\
0&1&3&2\\
0&3&2&1\\
0&2&1&3\end{bmatrix} \begin{bmatrix}
0&3&1&2 \\
3&0&2&1\\
1&2&3&0\\
2&1&0&3\end{bmatrix} \begin{bmatrix}
0&2&3&1 \\
2&3&1&0\\
3&1&0&2\\
1&0&2&3\end{bmatrix} \begin{bmatrix}
0&1&2&3 \\
1&2&0&3\\
2&0&1&3\\
3&3&3&3\end{bmatrix}\end{bmatrix}\\~\\
G^{3D}_{4,1}ALT3 = \begin{bmatrix} \begin{bmatrix}
0&0&0&0 \\
0&2&1&3\\
0&1&3&2\\
0&3&2&1\end{bmatrix} \begin{bmatrix}
0&1&2&3 \\
1&0&3&2\\
2&3&1&0\\
3&2&0&1\end{bmatrix} \begin{bmatrix}
0&3&1&2 \\
3&1&2&0\\
1&2&0&3\\
2&0&3&1\end{bmatrix} \begin{bmatrix}
0&2&3&1 \\
2&3&0&1\\
3&0&2&1\\
1&1&1&1\end{bmatrix}\end{bmatrix}\\~\\
G^{3D}_{4,1}ALT4 = \begin{bmatrix} \begin{bmatrix}
0&0&0&0 \\
0&2&3&1\\
0&3&1&2\\
0&1&2&3\end{bmatrix} \begin{bmatrix}
0&3&2&1 \\
3&0&1&2\\
2&1&3&0\\
1&2&0&3\end{bmatrix} \begin{bmatrix}
0&1&3&2 \\
1&3&2&0\\
3&2&0&1\\
2&0&1&3\end{bmatrix} \begin{bmatrix}
0&2&1&3 \\
2&1&0&3\\
1&0&2&3\\
3&3&3&3\end{bmatrix}\end{bmatrix}\\~\\
G^{3D}_{4,1}ALT5 = \begin{bmatrix} \begin{bmatrix}
0&0&0&0 \\
0&3&1&2\\
0&1&2&3\\
0&2&3&1\end{bmatrix} \begin{bmatrix}
0&1&3&2 \\
1&0&2&3\\
3&2&1&0\\
2&3&0&1\end{bmatrix} \begin{bmatrix}
0&2&1&3 \\
2&1&3&0\\
1&3&0&2\\
3&0&2&1\end{bmatrix} \begin{bmatrix}
0&3&2&1 \\
3&2&0&1\\
2&0&3&1\\
1&1&1&1\end{bmatrix}\end{bmatrix}\\~\\
G^{3D}_{4,1}ALT6 = \begin{bmatrix} \begin{bmatrix}
0&0&0&0 \\
0&3&2&1\\
0&2&1&3\\
0&1&3&2\end{bmatrix} \begin{bmatrix}
0&2&3&1 \\
2&0&1&3\\
3&1&2&0\\
1&3&0&2\end{bmatrix} \begin{bmatrix}
0&1&2&3 \\
1&2&3&0\\
2&3&0&1\\
3&0&1&2\end{bmatrix} \begin{bmatrix}
0&3&1&2 \\
3&1&0&2\\
1&0&3&2\\
2&2&2&2\end{bmatrix}\end{bmatrix}\\~\\
G^{3D}_{4,1}ALT7 = \begin{bmatrix} \begin{bmatrix}
1&1&1&1 \\
1&0&2&3\\
1&2&3&0\\
1&3&0&2\end{bmatrix} \begin{bmatrix}
1&2&0&3 \\
2&1&3&0\\
0&3&2&1\\
3&0&1&2\end{bmatrix} \begin{bmatrix}
1&3&2&0 \\
3&2&0&1\\
2&0&1&3\\
0&1&3&2\end{bmatrix} \begin{bmatrix}
1&0&3&2 \\
0&3&1&2\\
3&1&0&2\\
2&2&2&2\end{bmatrix}\end{bmatrix}\\~\\
G^{3D}_{4,1}ALT8 = \begin{bmatrix} \begin{bmatrix}
1&1&1&1 \\
1&0&3&2\\
1&3&2&0\\
1&2&0&3\end{bmatrix} \begin{bmatrix}
1&3&0&2 \\
3&1&2&0\\
0&2&3&1\\
2&0&1&3\end{bmatrix} \begin{bmatrix}
1&2&3&0 \\
2&3&0&1\\
3&0&1&2\\
0&1&2&3\end{bmatrix} \begin{bmatrix}
1&0&2&3 \\
0&2&1&3\\
2&1&0&3\\
3&3&3&3\end{bmatrix}\end{bmatrix}\\~\\
G^{3D}_{4,1}ALT9 = \begin{bmatrix} \begin{bmatrix}
1&1&1&1 \\
1&2&3&0\\
1&3&0&2\\
1&0&2&3\end{bmatrix} \begin{bmatrix}
1&3&2&0 \\
3&1&0&2\\
2&0&3&1\\
0&2&1&3\end{bmatrix} \begin{bmatrix}
1&0&3&2 \\
0&3&2&1\\
3&2&1&0\\
2&1&0&3\end{bmatrix} \begin{bmatrix}
1&2&0&3 \\
2&0&1&3\\
0&1&2&3\\
3&3&3&3\end{bmatrix}\end{bmatrix}\\~\\
G^{3D}_{4,1}ALT10 = \begin{bmatrix} \begin{bmatrix}
1&1&1&1 \\
1&3&2&0\\
1&2&0&3\\
1&0&3&2\end{bmatrix} \begin{bmatrix}
1&2&3&0 \\
2&1&0&3\\
3&0&2&1\\
0&3&1&2\end{bmatrix} \begin{bmatrix}
1&0&2&3 \\
0&2&3&1\\
2&3&1&0\\
3&1&0&2\end{bmatrix} \begin{bmatrix}
1&3&0&2 \\
3&0&1&2\\
0&1&3&2\\
2&2&2&2\end{bmatrix}\end{bmatrix}\\~\\
G^{3D}_{4,1}ALT11 = \begin{bmatrix} \begin{bmatrix}
2&2&2&2 \\
2&1&3&0\\
2&3&0&1\\
2&0&1&3\end{bmatrix} \begin{bmatrix}
2&3&1&0 \\
3&2&0&1\\
1&0&3&2\\
0&1&2&3\end{bmatrix} \begin{bmatrix}
2&0&3&1 \\
0&3&1&2\\
3&1&2&0\\
1&2&0&3\end{bmatrix} \begin{bmatrix}
2&1&0&3 \\
1&0&2&3\\
0&2&1&3\\
3&3&3&3\end{bmatrix}\end{bmatrix}\\~\\

G^{3D}_{4,1}ALT12 = \begin{bmatrix} \begin{bmatrix}
2&2&2&2 \\
2&0&3&1\\
2&3&1&0\\
2&1&0&3\end{bmatrix} \begin{bmatrix}
2&3&0&1 \\
3&2&1&0\\
0&1&3&2\\
1&0&2&3\end{bmatrix} \begin{bmatrix}
2&1&3&0 \\
1&3&0&2\\
3&0&2&1\\
0&2&1&3\end{bmatrix} \begin{bmatrix}
2&0&1&3 \\
0&1&2&3\\
1&2&0&3\\
3&3&3&3\end{bmatrix}\end{bmatrix}\\~\\

Note that each number can be found radiating from the top/left/front corner or the bottom/right/rear corner in 6 of the 12 cubes.