• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by wehrwolf · Mar 08, 2013 at 02:11 AM · shadershaderstransparencyreflection

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.

Comment
Professor Snake
cregox
LukaKotar

People who like this

3 Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image wehrwolf · Mar 09, 2013 at 01:51 AM 0
Share

Hey, great idea! Never thought about using multiple materials. Works nice. Thanks a lot!

avatar image Professor Snake · Mar 09, 2013 at 06:44 AM 0
Share

I converted my comment into an answer. If it solved your issue, you can accepting by clicking on the tick button.

2 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

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.

Comment
wehrwolf
cregox
LukaKotar

People who like this

3 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

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.

alt text


maskedcube.png (312.6 kB)
Comment
Professor Snake

People who like this

1 Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Professor Snake · Oct 19, 2013 at 11:27 PM 0
Share

Which built-in shader did you use? For everyone's convenience i can try editing it to support a reflection map of sorts.

avatar image remistorms · Oct 20, 2013 at 03:16 AM 0
Share

For that example I used the default Reflective/Diffuse shader that comes with unity.

alt text

screen shot 2013-10-19 at 10.12.32 pm.png (177.8 kB)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Disable fresnel in standard shader 2 Answers

Why does the 3D Text shader show specular at certain angles? 2 Answers

Global Transparency for sprite shader 1 Answer

HELP. Transparency Shader can't Apply Metallic and Smoothness,HELP! Transparent Shader Can't apply Metalic and Smoothness. 0 Answers

Blend Cubemaps in reflection probe 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges