• 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
Question by msiller1 · Jun 28, 2013 at 05:11 PM · shaderlightingtransparencyex2d

ex2D shader fix

Hi!

Im very new to shader programming, hope you guys could give me some clue with this problem.

Im working with ex2D and looks very good, I have an animated/transparent material. (it's a ninja running)

but if I put a Directional Light, this material is not affected by the light.

How can I get this material affected by directional lighting?

here is the source code of the ex2D shader.

 Shader "ex2D/Alpha Blended" {
     Properties {
         _MainTex ("Atlas Texture", 2D) = "white" {}
        _Color ("Main Color", Color) = (1,1,1,0)
        _Emissive ("Emmisive Color", Color) = (0,0,0,0)
         
         
     }
 
     SubShader {
         Tags { 
             "Queue"="Transparent" 
             "IgnoreProjector"="True" 
             "RenderType"="Transparent" 
         }
         Cull Off 
         Lighting Off
         ZWrite Off 
         Fog { Color (0,0,0,0) }
         Blend SrcAlpha OneMinusSrcAlpha
         
 
         BindChannels {
             Bind "Color", color
             Bind "Vertex", vertex
             Bind "TexCoord", texcoord
         }
 
         
         Pass {
             SetTexture [_MainTex] {
                 combine texture * primary    
             }
         }
     }
 }
 


Have a good one!

Comment

People who like this

0 Show 0
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

  • Sort: 
avatar image

Answer by Julien-Lynge · Jun 28, 2013 at 05:12 PM

The line "Lighting Off" might have something to do with it.

I'd suggest reading the documentation on Unity's ShaderLab - everything here is covered rather extensively in the documentation.

Comment
create3dgames

People who like this

1 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 msiller1 · Jun 28, 2013 at 05:31 PM 0
Share

Thanks for your answer! but when I turn that line to On, the character is painted in black, I can see the animated black siluete :)

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

16 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

Related Questions

GrabPass and Transparent geometry 0 Answers

Toon Lighted Alpha 1 Answer

How to make my shader have a variable transparency 1 Answer

Receiving Shadows On a Tranparent Shader 1 Answer

Transparency from light shader 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