• 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 /
This question was closed Oct 25, 2017 at 12:10 AM by ChrisX930.
avatar image
0
Question by ChrisX930 · Oct 17, 2017 at 06:25 PM · unity 5shaderalpha

Adding Alpha to a Shader?

Hey Guys, I want to add Alpha to this shader but I don't know how :/ Could you edit this shader to add alpha to it?

 Shader "N3DS/DoubleSided/VertexLitCullOff" 
 {
 Properties
  {
     _MainTex ("Base (RGB)", 2D) = "white" {}
 }
 
 SubShader 
 {
     Tags { "RenderType"="Opaque" }
     Cull Off
     LOD 80
     
     // Non-lightmapped
     Pass {
         Tags { "LightMode" = "Vertex" }
         
         Material 
         {
             Diffuse (1,1,1,1)
             Ambient (1,1,1,1)
         } 
         Lighting On
         SetTexture [_MainTex] {
             constantColor (1,1,1,1)
             Combine texture * primary DOUBLE, constant // UNITY_OPAQUE_ALPHA_FFP
         } 
     }
     
     // Lightmapped, encoded as dLDR
     Pass
      {
         Tags { "LightMode" = "VertexLM" }
         Cull Off
 
         BindChannels {
             Bind "Vertex", vertex
             Bind "normal", normal
             Bind "texcoord1", texcoord0 // lightmap uses 2nd uv
             Bind "texcoord", texcoord1 // main uses 1st uv
         }
         
         SetTexture [unity_Lightmap] {
             matrix [unity_LightmapMatrix]
             combine texture
         }
         SetTexture [_MainTex] {
             constantColor (1,1,1,1)
             combine texture * previous DOUBLE, constant // UNITY_OPAQUE_ALPHA_FFP
         }
     }
     
     // Lightmapped, encoded as RGBM
     Pass 
     {
         Tags { "LightMode" = "VertexLMRGBM" }
         Cull Off
 
         BindChannels {
             Bind "Vertex", vertex
             Bind "normal", normal
             Bind "texcoord1", texcoord0 // lightmap uses 2nd uv
             Bind "texcoord", texcoord1 // main uses 1st uv
         }
         
         SetTexture [unity_Lightmap] {
             matrix [unity_LightmapMatrix]
             combine texture * texture alpha DOUBLE
         }
         SetTexture [_MainTex] {
             constantColor (1,1,1,1)
             combine texture * previous QUAD, constant // UNITY_OPAQUE_ALPHA_FFP
         }
     }    
     
     // Pass to render object as a shadow caster
     Pass 
     {
         Name "ShadowCaster"
         Tags { "LightMode" = "ShadowCaster" }
         Cull Off
         ZWrite On ZTest LEqual Cull Off
 
         CGPROGRAM
         #pragma vertex vert
         #pragma fragment frag
         #pragma multi_compile_shadowcaster
         #include "UnityCG.cginc"
 
         struct v2f { 
             V2F_SHADOW_CASTER;
         };
 
         v2f vert( appdata_base v )
         {
             v2f o;
             TRANSFER_SHADOW_CASTER_NORMALOFFSET(o)
             return o;
         }
 
         float4 frag( v2f i ) : SV_Target
         {
             SHADOW_CASTER_FRAGMENT(i)
         }
         ENDCG
     }    
 }
 }
 

normally it should look like this: alt text

but it looks like this: alt text

thank you!

EDIT: I tried to use Alpha Cutout for that but it is not supported by the Hardware I use. Is there another way to add alpha to this shader?

img1.png (342.2 kB)
img2.png (97.3 kB)
Comment
Add comment · Show 6
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 dan_wipf · Oct 18, 2017 at 06:32 AM 0
Share

Have you tried to adjust Rendering $$anonymous$$ode? from Opaque to Cutout?

avatar image ChrisX930 dan_wipf · Oct 18, 2017 at 08:52 AM 0
Share

I tried. But Cutout isn't supported on N3DS unfortunatelly~

avatar image dan_wipf ChrisX930 · Oct 18, 2017 at 07:53 PM 0
Share

maybe this can help you?

http://answers.unity3d.com/questions/244837/shader-help-adding-transparency-to-a-shader.html

Show more comments
avatar image ChrisX930 · Oct 22, 2017 at 09:12 PM 0
Share

/push

Really need help with that.

avatar image ChrisX930 · Oct 23, 2017 at 11:17 AM 0
Share

/push Still need help with that

1 Reply

  • Sort: 
avatar image
0

Answer by ChrisX930 · Oct 17, 2017 at 09:25 PM

I tried to use Alpha Cutout for that but it is not supported by the Hardware I use. Is there another way to add alpha to this shader?

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

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

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

Cant get Alpha Channel to Work with Custom Shader 1 Answer

Unity 5 trees have white dots... 4 Answers

Depth mask with alpha / adding alpha to frag grabpass shader 0 Answers

Shader with "alpha" parameter no longer writes to Z-Buffer 2 Answers

How to make a 2d shader with edge waves 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