• 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
4
Question by 3dDude · May 26, 2010 at 11:07 AM · custom-shader

unlit transparent shader?

hi i dont know how to write shaders at all. but i wanted a shader that doesn't have lighting and its transparent, and i tried a particle shader but i don't want it to be additive ether. could someone post some code up please?

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

3 Replies

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

Answer by Mike 3 · May 26, 2010 at 11:35 AM

http://www.unifycommunity.com/wiki/index.php?title=UnlitAlpha

or you could try this (which should be blended)

Shader "Unlit/AlphaSelfIllum" {
    Properties {
        _Color ("Color Tint", Color) = (1,1,1,1)
        _MainTex ("SelfIllum Color (RGB) Alpha (A)", 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
                }
            }
        } 
    }
}
Comment
Add comment · Show 5 · 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 Mike 3 · May 26, 2010 at 12:50 PM 0
Share

modified the answer to include a blended shader

avatar image tylo · Jan 01, 2012 at 06:59 PM 0
Share

I'm not sure if you intended this material to fade out when the Alpha slider is 0, but it isn't doing that for me.

avatar image irontiger · Dec 03, 2012 at 03:24 PM -2
Share

hello I'm a beginner at unity. I want your help for something. It's shader matter. I will insert transparency effect my shader code. But I didn't it so.

avatar image tylo irontiger · Dec 03, 2012 at 03:49 PM 0
Share

Try posting on the Unity forums. This is purely a question and answer site. Or create a new question.

avatar image Akusan · Nov 09, 2014 at 10:29 PM 0
Share

By the way, this link is dead: http://www.unifycommunity.com/wiki/index.php?title=UnlitAlpha

avatar image
3

Answer by jonas-echterhoff · May 26, 2010 at 12:05 PM

Either what Mike said, or you might try the built-in Particles/Alpha Blend shader.

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 3dDude · May 26, 2010 at 12:06 PM 0
Share

i tried the alpha blended but it has some additive in i think.

avatar image
3

Answer by IanT · Nov 09, 2012 at 09:35 PM

In case someone (like me) is looking for the most basic unlit transparent shader, without texture, lighting, only alpha blending, here is what I've eventually made and that works:

 Shader "Custom/TranspUnlit" {
     Properties {
         _Color("Color & Transparency", Color) = (0, 0, 0, 0.5)
     }
     SubShader {
         Lighting Off
         ZWrite Off
         Cull Back
         Blend SrcAlpha OneMinusSrcAlpha
         Tags {"Queue" = "Transparent"}
         Color[_Color]
         Pass {
         }
     } 
     FallBack "Unlit/Transparent"
 }
 

("Fallback" command is here in case one would export for a very wierd hardware that would not support this shader.)

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 CoalCzar · Jul 20, 2013 at 04:10 PM 0
Share

This worked perfectly - thanks!

avatar image Pawl · Aug 29, 2014 at 12:43 AM 0
Share

+1, This is the perfect transparent-colored shader.

Great for debug shapes, and can be passed in to a new material because it's not a surface shader, ie:

new $$anonymous$$aterial(@"[shader code here]");

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

6 People are following this question.

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

Related Questions

Get access to previous pass from CG 2 Answers

Day / Night Planetary Shader 2 Answers

Custom shader remove shine 2 Answers

ShaderLab on Unity3d Indie 2 Answers

Shader LOD wont work on custom grass shader 0 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