1

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.

Overlapping lines

Treslav
  • 61
  • 4
  • 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. – Markus von Broady May 12 '21 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: https://i.imgur.com/pKPZQUR then tried that: https://imgur.com/mgTntpv even alternating to which axis the border between cardinal sides snaps: https://imgur.com/rPqciZb all ugly. You can put tiles radially, but then you have to figure how to do the top: https://i.imgur.com/Cy1oNZ7 I think the problem comes down to tiling a ball with squares https://i.imgur.com/EJegL15 – Markus von Broady May 12 '21 at 23:17
  • I agree, this solution works better with UV-mapping in this situation. – Treslav May 13 '21 at 04:43

2 Answers2

2

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.

Markus von Broady
  • 36,563
  • 3
  • 30
  • 99
1

why don't you use it like this?

enter image description here

result: enter image description here

with 0.02:

enter image description here

Chris
  • 59,454
  • 6
  • 30
  • 84