- Home /
Way to get a material to alpha-fade along the texture?
I have a material with a tiled texture on it (a ground texture) that I need to fade out over a distance. I have absolutely no idea how to do this, but I threw together a little concept image below to show exactly what I'm talking about.
It's not like fading the entire texture by 50% or something, it's having the texture blend to 0% opacity over a distance - it's important that the distance is not tied to the tiling of the texture. Any help?
Thanks!
This is definitely possible in shaders, and it might even be relatively easy. :) But you have to be more explicit with what, exactly, you mean by "distance". Distance from what? The object's center? The origin? The camera position? Where, exactly, do you want the fading to start, and is this a dynamic position, i.e. does it change based on something that happens CPU side so shader parameters must be updated, etc. etc...
Cheers! First, sorry for slow reply - I marked as read and it slipped my $$anonymous$$d ;)
By distance I don't mean distance from a specific point, I just mean "over a distance". In the image example above, the distance is arbitrarily about one and a half of the blue tiles. Ideally I'd be able to adjust the alpha fade so that it can fade out over any length, so I could adjust it so that it fades out over the length of one blue tile, or two, or ten Unity units, or whatever.
It might be handy to have it dynamically changeable, but honestly it would be fine if it were just a static thing, like part of the environment. Think like texture blending on terrain, but on any plane or material. Does that make sense?