Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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
1
Question by SBull · Nov 28, 2016 at 08:13 PM · shaderstransparencyoutlinealpha-channel

How would I add transparency to an outline shader?

I am trying to just add a transparent/alpha effect on the Bumped Outline shader found here: Outline Silhouette Shader

My mesh is an owl and I need a transparent shader for the wings. Here is an example of what it looks like with just the Transparent/Bumped Diffuse shader: alt text

And here is what it looks like with the Outline/Silhouette Bumped shader: alt text

As you can see, the outline shader works great, but the wings should be transparent to avoid having that white filler between the feathers. I have messed with shaders a little, but am still not all that familiar with them so I'm having trouble trying to figure this out. Any help would be appreciated. Thanks.

owl-alpha.jpg (129.1 kB)
owl-outline.jpg (157.1 kB)
Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by cakeslice · Nov 29, 2016 at 08:37 PM

In that case, replace this line (in the first "surf" function):

 o.Albedo = tex2D(_MainTex, IN.uv_MainTex).rgb * _Color;

with this:

 float4 tex = tex2D(_MainTex, IN.uv_MainTex).rgba;
 
 if (tex.a < .1f)
     clip(-1);
 
 o.Albedo = tex * _Color;

What clip does is discard the current pixel if the texture alpha (tex.a) is lower than .1f

You can use another value instead of .1f if you want. This technique is called alpha cutout and doesn't need blending.

Comment
Add comment · 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 SBull · Nov 29, 2016 at 08:55 PM 0
Share

That's perfect! Thank you so much! If you change your comment to an answer I'll mark it as correct.

avatar image cakeslice SBull · Nov 29, 2016 at 09:05 PM 0
Share

You're welcome! Just did.

avatar image
0

Answer by cakeslice · Nov 29, 2016 at 08:16 AM

Hi, I tested that shader and I can change the alpha using the "OutlineColor" property, is that what you're looking for?

Comment
Add comment · Show 1 · 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 SBull · Nov 29, 2016 at 02:02 PM 0
Share

No. That changes the visibility of the outline. However the parts of the mesh that should be transparent will still be fully solid white even if the outline alpha is at zero. I am going to need to alter the shader somehow to let it accommodate transparency. Thanks for the suggestion though.

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.

Follow this Question

Answers Answers and Comments

59 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image 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

Outline Shader with objects inside 0 Answers

Shader Transperency issue 1 Answer

Getting transparency issue on android build 1 Answer

Don't render an Area behind a plane 0 Answers

Combining two Outline Shaders 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