Does anyone know how to show the cut parts? I used a modulo operation with random coordinates and rotation for each cell, but when I try to randomly move them I get some parts of the texture getting cut, but I would prefer them to overlap.
The idea is to work at a given scale, so that the pattern will repeat and using a random (noise) at this scale (each cell will correspond to a random color).
Now imagine the result as a grid, the idea is:
- For each cell we want to draw
- We take all the 8 cells around it
- And have a look if we need to draw something from these 8 cells inside the cell we want to draw (the one at the center of the 8 others)
What is done for each of these 8+1 cells is to offset and rotate the pattern with the random values, transfer the result in the central cell and look if it's inside the central cell surface.
Globally, this is some kind of 3x3 convolution and in consequence, the node setting is the repetition of 9 same figures:
If we go into more details:
The inputs are:
- Texture coordinates
- The scale at which we want to repeat the pattern
- A tuning for the random offset
- A tuning for the rotation
The final position is calculated by two node groups which multiply the input coordinates by the scale, then take the modulo 1 of it, so that the final result is between 0 and 1 (as the texture coordinates are between 0 and 1).
On the other part, we have 9 node groups on the left, which are here to calculate the randomness. It takes into account the input parameters and incorporate a noise texture.
Also, there is X and Y inputs: each of the 9 nodes has X, Y inside the pairs (-1,-1), (-1,0), (-1,1), (0,-1), (0,0), (0,1), (1,-1), (1,0), (1,1), to go through all the 9 cells we talked about at the beginning.
The goal of this node group is to result in the wanted random value, offset(ed) by the coordinate of the (X, Y) pairs in input.
Inside of it:
- We take X and Y at the scale (X/scale and Y/scale)
- Add the input coordinates as X/scale and Y/scale is the delta we want
- Input that in NoiseDiscretize which is a noise mosaic at the given scale
- Then add this random to the input: X and Y are offset(ed) and Z will be considered as the random rotation
The NoiseDiscretize goal is to ouput random value at the scale we want. The result is centered (we want output between -1 and 1).
Back at top level, we now have the random deltas we want + the cell to draw in at the good scale. We now mix that to get the color for each cell from the center cell point of view. PickColor node group does that:
Inside of it, we have:
- The calculation of the rotation of the input vector, taking Z from the random input.
- Then we input that in the pattern texture
- But we'll keep a default color if the resulting coordinates are not between 0 and 1 (as if not this cell must not be drawn in the central cell).
Important: the pattern texture node interpolation is set to closest (if not border lines may appear).
Finally, the nine results are mixed by a mix rgb node using the darken operation at 100%.
Note: I feel this kind of setting painful. But the bad is really that we need to duplicate the input pattern texture, as there is no way to have it as a parameter. And so the setting can not be reused easily.
But maybe another answer will solve this problem?