Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Anxo · Nov 21, 2011 at 06:33 PM · shaderunlitalpha-blend

iPhone Shader - Unlit, 2 textures (alpha blend), Base needs tint.

Hello Unity Community.

Thank you for taking the time to check out my question. I am trying to put a shader together. I snipped bits and piaces from all over. Including one of Jessy's answers on a blend material.

http://answers.unity3d.com/questions/32386/iphone-blend-two-textures-additive-blending.html

Which is great but I needed was a little closer to the Unity example on Texture blends.

 Shader "Examples/2 Alpha Blended Textures" {
     Properties {
         _MainTex ("Base (RGB)", 2D) = "white" {}
         _BlendTex ("Alpha Blended (RGBA) ", 2D) = "white" {}
     }
     SubShader {
         Pass {
             // Apply base texture
             SetTexture [_MainTex] {
                 combine texture
             }
             // Blend in the alpha texture using the lerp operator
             SetTexture [_BlendTex] {
                 combine texture lerp (texture) previous
             }
         }
     }
 }  

The problem is that it does not allow me to Tint I have been trying to add it from other bits of code but with no luck. The closest thing I found was a Unlit shader with the ability to alter the tint that someone made, Then I added the blend alpha texture part of the shader and it works but parts of it are semi transparent and I am having a hard time figuring out why.

This is the closest shader I was able to snip together to do what I want. How would I remove the semi transparent aspect of it.

 Shader "Unlit/AlphaSelfIllum TexBlend" {
     Properties {
         _Color ("Color Tint", Color) = (1,1,1,1)
         _MainTex ("SelfIllum Color (RGB) ", 2D) = "white"
         _BlendTex ("Alpha Blended (RGBA) ", 2D) = "white" {}
     }
     Category {
        Lighting On
        ZWrite Off
        Cull Back
        Blend SrcAlpha OneMinusSrcAlpha
        Tags {Queue=Transparent}
        SubShader {
             Material {
                Emission [_Color]
             }
             Pass {
                SetTexture [_MainTex] {
                       Combine Texture * Primary, Texture * Primary
                 }
                  // Blend in the alpha texture using the lerp operator
             SetTexture [_BlendTex] {
                 combine texture lerp (texture) previous
             }
             }
         } 
     }
 }
Comment
Add comment · Show 1
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 Anxo · Nov 22, 2011 at 04:44 AM 0
Share

bump.

That is always the problem with more advanced questions. It takes so much longer to get an answer. I can only hope some expert walks into this question by chance.

1 Reply

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

Answer by Jessy · Nov 22, 2011 at 06:56 AM

You haven't said what you want to do with the alpha blend. I'm going to go with the assumption that you want the alpha channel of "Color Tint" to provide a constant value until you say otherwise.

(Lighting, and the Category block, were not useful to you. Just paste this in place of your Category block.)

 SubShader {
     Tags {"Queue"="Transparent"}
     ZWrite Off
     Blend SrcAlpha OneMinusSrcAlpha
     Pass {
         SetTexture[_MainTex] {
             ConstantColor[_Color]
             Combine texture * constant, constant
         }
         SetTexture[_BlendTex] {Combine texture Lerp(texture) previous, previous}
     }
 }
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 Anxo · Nov 22, 2011 at 03:09 PM 0
Share

Thank you Jessy, this works great. I did not know what ZWrite Off actually does or Tag..And its not what I needed but once removed it worked great.

Thank you for your time.

avatar image Anxo · Nov 22, 2011 at 03:14 PM 0
Share

Sorry if I did not explain it correctly. again. Thank you, I spent a lot of time yesterday trying to figure this out.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Eliminate particle flicker 1 Answer

Kindle Fire , shader not working properly 1 Answer

How To Replicate the Untitled Goose Game Art Style? 0 Answers

Merging (alpha) Unlit shader with Cutout shader 3 Answers

Shader Darkening the UI sprite behind it! 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