Random Tile Placement and Rotation in Cycles Material

Hey I have been searching the the answer forever, but as far as I can tell none exists yet:

I have a single floor tile image “tile1.png”, I want to randomize the rotation of the floor tile in my cycles materials so when the tile repeats, the rotation is random and does not look “cookie cutter” and always the same.

I feel like this is an essential tool that maybe hasn’t been included yet.

Can anyone help me with this?

1 Like

http://www.pasteall.org/pic/show.php?id=87994

Thanks for this! - I know this option is available and I have been using this as a temporary fix- is there anyway to do it only within the mapping for the material?

For example

The random rotation in this node setup requires there to be multiple different objects in order for it to work. Which is very good, but if you need to render a huge floor with random tiles, it begins to slow down your scene considerably.

I’m trying to do it without hundreds of object— and use it on a single UV mapped flat plane.

Two ways you could achieve that:
a) Add Driver for the Mapping node’s Rotation values. Add Noise Modifier and/or math function/python code to the driver value.
b) Use Separate/CombineXYZ and Math nodes instead of Mapping; this would allow to use ObjectInfo - Random value as a source for rotation randomization.
Check CGC tutorial on how to implement rotation nodes.

Probably there are some more ways to do that…

Edit: You could have had stated all your limitations/constraints beforehand…
Based on what you say now - imho not possible if you do not do this on pixel level using python. I might be wrong.

You can also use the brick texture instead of object info > random. It will generate blocks of random brightness when set up right (high contrast between color 1 and color 2, keep mortar size small or 0.)

1 Like

This is a kind of a hacky way of getting what you want.

The using Separate XYZ nodes, you can do mathematical operations directly on the UV map. At normal scale, the edge of the UV map runs from 0 to 1; I’ve multiplied it by 10 so that it runs 0 to 10. By default the image repeats when the values go over 1, but since we want to control each tile separately, I then blocked off each integer value using round nodes (so now each edge goes 0-1 ten times). The image will look the same at this point.

You can now rotate the UV map using the formula x’ = xcosθ 0 ysinθ / y’ = xsinθ + ycosθ - this is what the UV mapping node does behind the scenes anyway, but with a little fiddling around with the math you can make the rotation centre the centre of the tile. Now we can plug in a rotation value (which are apparently in radians, but definitely not degrees), and every tile moves around it’s individual centre rather than the centre of the UV map.

Incidentally, before running your UV data into the image node, I ran it through a Mix Color node with the factor set to zero (so no change) and “clamp” on - this is the simplest way I’ve found to limit the UV map to one repeat, and stops neighbouring images bleeding in at the corners.

Next you want to assign a random value to them, which is trickier than it sounds. Since you only get one random value from the object node, if you want to get a different random number for each cell and not have it end up not looking at all random, you need to do some fiddling with the math - what I did was to input for the column number (1, 2, 3, 4) multiply it by some irrational number (read: picked random decimal points), then divide it by, say, ten, take the remainder, multiply by ten, and you should have a random number which isn’t scaled obviously in proportion to the input. I haven’t actually worked this out particularly well, and you may need to fiddle with some of the values to make it work for your object. Then it’s just a case of multiplying the random number by the angle, and adjusting the angle until you have the desired effect.

Attachments

tile rotate.blend (588 KB)


2 Likes

J_the_ninja has a much better way of assigning random values to the cells. You might need to do a little math to make sure it map exactly to the UV cells in my method, but that would be a much better system than mine!

nice tip from ninja, update:

http://www.pasteall.org/pic/show.php?id=88023

@anopheles you are a genius. Yes, you solved it. you are batman.
Genius.

Here are some examples of what I have been using for quite a while:


random_tile_rotation.blend (275 KB)

Contains both examples of just rotation as well as rotation around 0.5 (center) of image texture. Using object location so I scaled z to 0 for round vector. Not required if you are using UV coordinates, though UVs may require scaling to get the desired size.

This does not use the random output from the object info node for per object randomness, but you could multiply a large value by it and then add it as an offset to the input space used.

2 Likes

I know this is VERY old, but does anybody have an idea how to expand this to use multiple texture inputs?
(preferrably based off the UV space, not the object vector, would be best)
I tried fiddling around, but my attempts wherent so “professional” and didnt work right… :frowning:

I got a bunch of textures of individual bricks and would like to randomly stack them together to get a non tiling facade…

great idea, it worked really well. fast and effective, thanks!

Do you know how to made this in Blender 3.X?

Just download the Random Tile Rotation Blend file… 3 replies up…
works fine in 3.1…so should be fine for newer versions…