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
0
Question by keeperkai2 · Mar 14, 2016 at 03:16 AM · unity 5shadershaderlabblendingadditive

Additive Surface Shader in Unity 5

I just upgraded from Unity 4 to Unity 5, and it seems a lot of shaders are behaving differently. It seems that in Unity 5, all my transparent shaders are not blending correctly. I KNOW! I have read the documents and made the following modifications: 1. adding the "alpha" or "alpha:blend" or "alpha:fade" options to the surface shader pragma line 2. write the SurfaceOutput Alpha to my custom lighting model function's output. Basically if Half4 c is the output of my lighting model, then I will assign SurfaceOutput o, c.a = o.a; Yes to some degree this is enough, but if you read the compiled vertex/fragment shader the options above only adds: Blend SrcAlpha OneMinusSrcAlpha to the forward base pass. It completely ignores my Blend SrcAlpha One option in the surface shader...In Unity 4 this would work perfectly, but in Unity 5 it just ignores you. And I went on to read the Unity 5 built-in shaders, and it seems that every time they want to do some custom blending in Unity 5, they simply just write vertex/fragment shaders... For me, writing my own vertex/fragment shaders is NOT an option! I developed a program that can compile "surface shaders" to have a special effect, so currently I have like 700+ shaders in my project, most of them are compiled by my tool and it only works for surface shaders.

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

1 Reply

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

Answer by keeperkai2 · Mar 14, 2016 at 06:38 AM

I figured it out, it seems that even for Transparent shaders, you can use the "keepalpha" option and simply specify the alpha like: Blend SrcAlpha One Just like you did in Unity 4(except it would just work without keepalpha in Unity 4), the documentation made if feel like keepalpha is only used for opaque shaders, this is not the case...

Comment
Add comment · 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

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

76 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 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

BlendOps on mobile not supported? 1 Answer

someone knows how to create an anisotropic shader? HELP!!! 0 Answers

Would learning some GLSL help with Unity Shading? 1 Answer

How to make a part of a texture on an object seamlessly change to another texture? 0 Answers

Particle effects against light backgrounds 2 Answers


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