0
$\begingroup$

I am working on my flat project.

I want to create a material that could take texture images of tiles and value input of their real-world size, resulting in covering meshes with an exact number of tiles. This would need to work with square or rectangle-shaped tiles. Additionally, it would need to use "generated" or "object" texture coordinates, with no UV Mapping.

For instance, the room floor is 3,17m x 1,97m in Blender, and the exemplary tile real-world size is 0.298m x 0.298m. Considering those two: Example of tiling on the floor

This is my current simple material. In those value input nodes I would need to paste dimensions and spacing between them if needed: simple material

I experimented with texture spacing in object properties and it gives the result(after doing my math on paper...) but I would like to input everything inside the material graph, so I could quickly swap between tiles and just input their measurements. And I don't know how to do it. :(

texture spacing

Any help is much appreciated.

$\endgroup$
3

1 Answer 1

1
$\begingroup$

//EDIT: At the bottom you will find a file with a reworked version, using a brick texture, adding some settings to play with including the use of rectangular tiles and two different textures if needed, also random rotation in 90° steps. Still quite complex setup, so I'll just leave it quite undocumented.

To get the tiles real world size is actually quite simple. If your floor has its scale applied and you use the Object output of the Texture coordinate node, you can simply set the Scale with a Mapping node to 1/(tile size). If you want the size to be including spacing, then it is 1/(tile size + spacing).

Problematic it will be if your tile texture only contains the tile design without spacing and you want to be changing the spacing as well. Then all gets a bit complicated and I actually don't know where to start explaining because I've worked a while on it with a lot of trial and error. So first of all I will maybe just present my node tree:

variable tiles

Prominently showing in blue are the main features: there you can enter the tile size of (square) tiles and the spacing between them. The other blue frame is the Image Texture node where you can load your tile image.

The most complicated part (for me at least) was getting the texture coordinates to be scaled to the size of tile + spacing, while I wanted the tile image to be scaled to just the tile size, so that nothing gets cut off by the spacing part. Therefore the Map Range node converts the coordinates at From Min 0 + spacing/2 (relative to scale) and From Max 1 - spacing/2 (relative to scale) unto To Min 0 and To Max 1.

To have the tiles not only in the top right area of the floor I needed a Modulo to make the negative part positive. Then the X and Y values are converted into a black and white grid to separate tile texture from spacing, which I use in a Mix Color node where I give a color to the spacing.

Then I took a Brick Texture node and used some of the coordinate settings there as well to create some bump to make the floor not looking so completely flat. A bit noise in the Color inputs to give some bump on the tiles so they are not fully smooth and the Mortar is black. I also used the Brick Texture so I can smoothen the transition from mortar to tile a bit. And I used some masking for the roughness.

Another thing: the origin of the object determines where the bottom left corner of the tile is (or actually the bottom left of half the mortar) when the Mapping node is set to Location 0/0/0. If you want the origin to be where the center of the tile is, you can set the Location to 0.5/0.5/0 (the Z does not matter really).

I know this is quite incomprehensible but I wanted to present at least something to you, at the end of this answer there will be the file to have a closer look. Now some examples, I can easily choose now for example one tile with a size of 120 mm or 0.12 m and a spacing of 15 mm:

tile example 1

Then I switch the image texture to a different tile and make it 200 mm with a spacing of 10 mm (and change the mortar color):

tile example 2

And a quick third example, new tile, new sizes 150 mm with 6 mm spacing and another mortar color (but by the way, the slightly yellowish tint on all tiles comes from the HDRI which I used for the environment):

tile example 3

The old setup:

New version: In the section "Tile Setup", apart from being able to set the size for X and Y (no matter if they are square, "portrait" or "landscape") you can also shift the X and Y position in case you need to move them on the floor and also give them a random orientation by rotating randomly in 90° steps. Since the shader nodegroups have no checkbox input you have to set 0 to disable rotation or values > 0 to have rotation.

The "Tile Textures" part is simply two Image Texture nodes where you can upload two images as tiles if you want a checkerboard tiliing. Of course you can simply use only one of them in the following "Texture1" and "Texture2" inputs, or leave one empty or both empty to use colors instead.

The "Tile Compositor" is where it all comes together. There the setup is combined with the textures to create the floor tiles. Apart from using two textures you could as mention before simply use one for both or one or two colors. You can also set the Roughness for tiles and mortar and Bump strength. There is an option to have some noise bump for the tiles as well to make them not too perfectly flat and smooth.

nodetree setup

And here is the new file:

$\endgroup$
4
  • $\begingroup$ Thank you very much! The second option is waaaaay too complicated for me to understand at this point. So the first way without the spacing is something that I need. But how do you combine two different dimensions for rectangle-shaped tiles? $\endgroup$ Feb 8 at 8:48
  • $\begingroup$ Ok, I've divided both width and height (1/tile size in meters) and used Combine XYZ->mapping vector scale. Seems to work. Is there a way to place texture images into a brick texture? It would solve lots of problems. $\endgroup$ Feb 8 at 9:50
  • $\begingroup$ @randomCoder1 Well, yes of course you can and it makes it simpler, my bad. However it will still need some maths and converting values if you want to avoid the mortar clipping the tile texture. But if you want I can edit the slightly simpler method in. $\endgroup$ Feb 8 at 10:33
  • $\begingroup$ @randomCoder1 I've reworked the setup completely. Still complex, but I've created some custom groups to reduce the amount of confusing nodes. Maybe you want to look in the edit, download the file and see for yourself how it works. $\endgroup$ Feb 8 at 16:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .