How can I make my procedural brick texture map correctly to both a cube and cylinder?
I think one issue with your original solution was due to lack of 'absolute' on your tests on the Normal - it's allowing for &gt; 0.5 but not for `&lt; -0.5'. Also, 'mixing' the individual channels before combining could be causing a problem. Try a material similar to the following :



This can produce the following effect :





EDIT - Here's another alternative for more rounded meshes - to use a radial gradient for one coordinate so as to wrap the texture around in one direction. This results in only a single join. You can adjust the Multiply nodes (marked in Cyan) to adjust the scaling to adjust the 'join' - or you could implement a 'smoothed' transition as in the image in your comment for an even better blend between the edges.

For the top and bottom faces, this is implemented as a rotated implementation of the same mapping and the 'Y' coordinate of the first texture space (in this case the object Z coordinate) is used to transition between the two textures - this way you can ensure it transitions at the edge of a whole row of bricks (see the Greater Than nodes marked in Cyan - one for the upper transition, one for the lower).