Home Unreal Engine

Randomizing Tile in modular Pieces

roshankarel
polycounter lvl 5
Offline / Send Message
roshankarel polycounter lvl 5
It might be very easy one but i couldn't be able to crack it I want random tiles on the modular floor piece 
i have kept the floor modular like this but now you can see the problem here the material is following the same pattern
how can i randomize this ??

Replies

  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter
    depends

    if they're instanced static meshes you could pass a primitive ID through to the material and use that to seed a random UV offset

    you could read a value from some worldspace noise (eg at the actor position ) and use that to offset UVs in your material 


  • monodrobe
    Options
    Offline / Send Message
    monodrobe polycounter lvl 9


    This is my random seed function. If ya search around ya can find who came up with the idea first. Basically if you dot sine big enough numbers it falls apart and becomes random.  12.9898,78.233002   for the dot and  43758.546875    for the multiply. But I dont think these matter all too much. But could be wrong , its been years since I made this.



    doing this you get essentailly a basic grid coor, each square is its one float 2 (0,0) (.1,0) etc If I plug this into the random seed function you get



    the input needs to be a float 2.. but if you only have 1 then just make the second something arbitrary. In the case of your tiles if they re indivudal meshes you can use their x y location from world position.

    Possibilites are pretty endless with this. you can subdivide your texture in to cells and use this to randomly select from those or rotate them etc
Sign In or Register to comment.