Hello All, Wondering if anyone can give me a hand.
I’m currently making a tile based game, and I have a material set up for the tiles that change the colour based on the meshes height in the world (set-up below). It achieves the look i’m going for, however I’ve run into several issues. The texture sample is just a 1 pixel wide strip of colour that i’ve used to determine colour that gets scaled up across the world space.
For starters, not all of the meshes its used on are of the same height, and so when it comes to scaling the material upwards on the Z co-ordinate across the world, it’d be different for each of them. At the moment, i’ve got the ‘HeightOffset’ variable which just moves the material, up or down a bit which fixes this issue but its a pain to adjust constantly for every different mesh its applied on. I also want to use the same material/set-up on a grass material so that the grass colour will always match the colour of the tile its on, but that obviously won’t work with my current setup because again, the height of the grass mesh won’t be the same as the tile meshes i’m using and the scaling won’t match up.
What I’d like is for there to be a way to stretch the texture sample across the world space once, starting and stopping at a particular height, so that I can use that same material in multiple meshes and they all line up to each other regardless of the height of the mesh and the scaling of the material. In short, all three of the Hexes above should be the same colour without me having to go in and adjust the ‘HeightOffset’ Parameter.
I hope that makes it clear.