Material variable tiles in BSPs & Mesh

Well i got this mat:

this go connected to the texture UV and give me the selected part from the texture (tiles).

Then the problem is that, i got a mesh wall(one mesh) with that material, the idea is give to X a random number from 0 to 3 to select from the near texture.
The idea is get something like this:

and no like this:

If you’re doing 0-3 why are you dividing it by 16 in both x and y?

I think you want (x/4 append y/4) + texture coordinate. Then you need to make sure that X and Y are actually changing in your material instance.

I think you don’t get my question.
That material work fine and i got instances of this changing x and y to get the tile pos.

But for example i got a brick wall tile for examples this is my set of tiles:

0 1
2 3

4 tiles in a 64x64 image 2x2, and 0 is grass and 2 is brick, but 1 is a variation of 0 and 3 is a variation of 3 and i like alternate in the final instance automatic tile and set random 0-1 over the ground, but in the same mesh i don’t know if this is possible.

The frac node outputs decimal values. I don’t think it’s appropriate for what you’re trying to do.

Another way around this is to use a noise map texture for your variation. I made a version that uses this technique, and it works very well.

What is the sizes of the noise image and the textures ?
Is there a example of how implement this in my texture ? because i get the sprites from a large and single image no all variations in one texture

If i use x32 tiles then i need set as x64 to get 4 variations but i looking for how join this.

I have a 4x4 array of tiles in my main tile+normal map textures, and 256 pixels in the noise map. The noise map’s filtering method is set to Nearest Neighbor so it doesn’t blur at the edges. Ideally you would also plug in a mask and a separate textures/normals for the grout: right now it’s hard shifting the texture, and the seams in the grout around each tile are very obvious.

Well i trying to create you material but i got problems what is wrong ?

Edit: Now i see the noise texture is pixel size no ? and is the definition of the pos of each tile but now using a x64 noise texture with my 2x2 tiles have a problem some tiles look move. (The non white tiles of the noise texture)

Someone can help me with this problem ?

The divide node right before the noise texture should divide by the number of pixels in the noise map, not your sprite sheet. Your sprite sheet can be whatever size you want.

And to make sure you have appropriate variation, you need to make sure your noise map uses a full range of values from 0-255, and does not bias itself towards using any values more often than others. It looks like your noise map is very white. Make sure to uncheck sRGB and use a linear grayscale texture to prevent Gamma biasing. You’ll have to change these settings in the texture panel, and then drag the new texture into the material.

On top of that, if your sprite sheet is only 2x2, that only gives you 4 tiles to randomize: you’re going to get repetition no matter what. Try using a 4x4 grid space as your minimum if you really want to get good random variation.

Hey thanks you, now works after change to Linear Color ^.^ now i only need add this to my code.
*The noise map is of the same size of the tiles x64.

Thanks you for you help and your time!

No problem! But one last thing before you go:

It’s much better to have the noise map as a separate texture entirely. It needs to be in linear space, without mipmaps, and without any compression at all. If you’re using color for different RG values, make sure the compression settings are set to VectorDisplacementMap so it remains uncompressed. I prefer to use grayscale because it’s much cheaper.