# Shading - How do I remove overlapping seams in X- and Y-direction while using vectors?

While trying to create a pixelated effect, I noticed that using vectors causes overlapping lines in x- and y-direction. As far as I can see, there is no good solution to create pixelated faces...

Has anyone got good solution for this kind of problem?

The origin is in the bottom of the object.

• I'd call these "overlapping lines" just seams. The problem is not trivial and is caused pixels on opposite side of the seam to be snapped to different values. In other words, those seams mark the snapping edge on some axis (I bet you could put planes, one on each of the seams that they would align with them perfectly). So your snapping will only work if the geometry is made of aligned voxels. Also, if each of the dimensions of 6 sides (NSWE, top, bottom) expressed in tiles isn't an integer - you must get a seam on an edge of that side. May 12 at 23:04
• You can consider UV unwrapping and then putting a low-res texture on your geometry (which is very standard approach), or detecting which side you're on and only snap to 2 axes different than its normal. I reproduced your issue: i.imgur.com/pKPZQUR then tried that: imgur.com/mgTntpv even alternating to which axis the border between cardinal sides snaps: imgur.com/rPqciZb all ugly. You can put tiles radially, but then you have to figure how to do the top: i.imgur.com/Cy1oNZ7 I think the problem comes down to tiling a ball with squares i.imgur.com/EJegL15 May 12 at 23:17
• I agree, this solution works better with UV-mapping in this situation. May 13 at 4:43

As I wrote in the comments, some seams are inevitable. Even on a cube, if a side is 1.1 m long, and a tile is 0.2 m long, then 5 tiles will fit completely and half of a tile will be cut off in middle (giving an impression of a seam). What if you don't have a cube? Any non-vertical face will be visible from side as a diagonal line, which will not be compatible with squares that you look at en face.

Another way to look at it is this: if you were able to procedurally draw squares on an arbitrary figure without seams, it would mean you tessellate that figure with squares, which I think is fair to say is impossible - spheres in Blender are made either from triangles or from heavily stretched quads (and some triangles on top and bottom if you don't cast a subdivided cube into a sphere).

So while some seams (on the left) seem to be unavoidable, the seams inside NSWE, top, bottom sides can be avoided (on the right):

I came up with a basic setup like this:

By increasing Epsilons, you remove the inner seams by removing the normal-aligned axis information from the vector:

You will still get seams on areas between those "flattened" areas.

You could improve that node setup, or maybe instead create a black texture and use R/G/B information, and draw on that texture:

Best to draw in Add mode to add flattening (use the color of an axis visible on the gizmo: X:red, Y:green, Z:blue), and Subtract mode to remove flattening. I'd recommend falloff set to constant.

Perhaps a better idea is to make that information only offset the coordinates, so you're not forced to draw on an entire side of the object, and can just draw on a part of a square on one side of a seam.

• Possibly useful: blender.stackexchange.com/questions/21001/… May 13 at 10:42
• Let's simplify the problem. The original form is cube that has been subdivided in every direction once and vertices offset a little bit. Simplified rock picture We have 24 faces to project the pixelated noise on to. May 13 at 11:01
• @Treslav I think in this case you can decide which axis to ignore based on the face normal. May 13 at 11:08
• What node should be used to define the face normal? @Broadysmile May 13 at 11:21
• @Treslav Texture Coordinate > Normal. The biggest component will be the axis you want to ignore (multiply by 0) May 13 at 11:31

why don't you use it like this?

result:

with 0.02:

• His geometry is not so regular and that's the cause of his problem. I think your solution will result in the same problem on his geometry. May 12 at 20:41
• @MarkusvonBroady: aaaaah yes, you are right!!! May 13 at 4:21
• Is it not possible to use the object origin as the start point and point the vectors towards face normals? May 13 at 4:36