- Home /
Fade Out over length of object on Material?
I couldn't find a question about this, so I thought I'd ask: I was wondering if there was any way to make it so that a Material fades out as it goes.
So, for example, starting at the left side of a material, as it draws to the right, it increasingly fades out until it reaches an Alpha level of 255, starting at 0 (Or any start/end values you want). Or, perhaps, from the center going outward it does the same effect.
Is there any possible way to do this? There's a lot of Shader Options, however I can't seem to find one that does this. As long as the effect exists in some form I can most likely work with it.
Context: I have it so that the edge of my walls are met with blackness. I want it so that it looks like the walls do not abruptly end, but fade into darkness. I don't really want to edit all of the different textures I may use to create this effect, because it would be a very large amount of extra materials to do it (At least 3x what I have now, because I would have the default, the regular wall, and then the corner wall, which would need its own, and other possible special circumstances), and several annoying computations that I don't really want to perform (so that every wall is facing the correct direction with the correct material on it).
If it's impossible, I'll probably just leave it be, however it would add some decent visual effects if I were able to do this. Thanks in advance for any info.
So I'm looking at ShaderLab, but the Documentation doesn't seem to be fleshed out as much as I would hope.
For example, I figure a way to potentially do this is to have X draws, where it allows larger alpha values the closer it gets to the center. I am trying to see if building Rects would work, but I'm not sure if you can control their size relative to the object. For example, Rect 1 would be Alpha 25 but 100% of the object, while Rect 2 would be Alpha 50 but 90% of the object. Using a concept like this, I could make it so that it slowly gets less transparent as the rectangles get smaller, however I'm not really sure if this is possible.
I noticed that you can create a Rect Property, however I'm not sure what Options are available in it because I cannot find any information in the reference documents.
It just shows: name ("display name", Rect) = "name" { options } Defines a rectangle (non power of 2) texture property.
But what can be in {options}? I cannot find anything that says what that could be. I'm hoping maybe the ability to control the size of the Rect in relation to the object the $$anonymous$$aterial would be attached to.
Anyone have any ideas?
Your answer
![](https://koobas.hobune.stream/wayback/20220613112955im_/https://answers.unity.com/themes/thub/images/avi.jpg)