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 narcissuspark · Aug 21, 2015 at 11:02 AM · shaderalphablend

In Shader, "Blend Off" means there is no alpha blending operation while rendering?

In shader, does "Blend Off" means there is no alpha blending operation while rendering? I know alpha blending is very slow because alpha blend object have to do some other things like alpha sorting, color operation by each pixel, and so on. I wonder How can unity decide if this object need to be render with alpha blending operation. In unity standard shader, there is strange code:

 ... 
 [HideInInspector] _SrcBlend ("__src", Float) = 1.0
 [HideInInspector] _DstBlend ("__dst", Float) = 0.0
 ...
 
 Blend [_SrcBlend] [_DstBlend]
 ...

According that code, all object that used for standard shader is rendered with alpha blending operation because there is no Blend Off tag. What I want to ask is how can I notify to unity that I want to render object without alpha blending operation? If I tag "Blend One Zero", does unity render without alpha blending operation automatically?

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
0

Answer by Owen-Reynolds · Aug 21, 2015 at 03:11 PM

Take a look at the info page for the Unity Standard Shader.

I think this line in the 2nd paragraph answers your Q: "[...] its features are enabled or disabled by simply using or not using the various texture slots and parameters in the material editor." But it seems like you may as well read the entire thing.

The older version of Unity shaders (the ones mentions in the Standard Shader man page) has places to explicitly turn blending on/off and hand-set whether it was sorted. I assume there is still a way to get to the "old" custom frag/vert shaders, where you still do that.

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

Answer by narcissuspark · Aug 24, 2015 at 02:26 PM

Thank you for a reply, and I take a look at the Unity Standard Shader page but still don't understand. In "Standard.shader" and "StandardShaderGUI.cs", there are codes like below.

"StandardShaderGUI.cs"

  public static void SetupMaterialWithBlendMode(Material material, BlendMode blendMode)
         {
             switch (blendMode)
             {
                 case BlendMode.Opaque:
                     material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
                     material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
     ...
                     break;
     ...

So if I select BlendMode.Opaque, I think shader code will be complie below.

"Standard.shader"

  Blend One Zero

In my opinion, this will be looked opaque but alpha blending calculation(pixel adding: SrcFactor*1 + DstFactor*0) wil be calculated when it's rendering because there is no "Blend Off" option. So, since Standard Shader has no "Blend Off" option in its code, does it calculate alpha blend calculation per pixel whend it's rendering? How can I know this will be rendered with or without alpha blend calculation?

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Blended Edges on Tree Creator Leaves 0 Answers

Transparent shader with alpha 1. Still a performance hit? 2 Answers

Fixed Shader with multiple AlphaBlended Layers ? 0 Answers

Textured object appears transparent in a textured sphere with front culling 1 Answer

How to force the compilation of a shader in Unity? 5 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