- Home /
Reflection shader with alpha channel
Hello, I'm new to Unity and need to ask a simple question.
I have a 3D mesh with a texture applied to it. Small parts of the texture should be reflective, while the rest should stay non-reflective.
When I however setup a Reflective Bumped Diffuse shader, the entire texture becomes reflective.
Is there any humane way to apply an alpha matte to the reflection in order to specify what parts of the texture it should be applied to? Alternatively, do you know of any custom made shader that could do this?
Any help would be much appreciated.
Hey, great idea! Never thought about using multiple materials. Works nice. Thanks a lot!
I converted my comment into an answer. If it solved your issue, you can accepting by clicking on the tick button.
Answer by Professor Snake · Mar 08, 2013 at 04:55 AM
You are able to use multiple materials in one mesh, but that would require some extra work with getting their textures right. A shader based solution however would indeed be lovely.
Answer by remistorms · Oct 19, 2013 at 10:57 PM
Hi there,
I hope this works for you. The reflective shaders inside unity have the option to be masked with and alpha. The only trick is to embed this alpha mask into the diffuse.
I tried to get the effect a couple of times but I only made it work when I saved my textures as TGA with 32 bit. Check the images below with the same cube and material but the masked and unmasked texture.
Let me know if if works, if you are still confused I could send you a more detailed description or a quick video of what I did.
Cheers.
Which built-in shader did you use? For everyone's convenience i can try editing it to support a reflection map of sorts.
For that example I used the default Reflective/Diffuse shader that comes with unity.