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 DoctorSp8dles · Jan 03, 2018 at 09:19 AM · shadercutoutunlit transparent

Transparent zones being rendered as black

Hello, I have a custom shader. It is actually just a bunch of textures that scrolls along the mesh and they add their color to other textures when they pass by each other. The problem is all the empty space that isn't being covered by a texture is being rendered as black but should be being rendered as transparent. I have tried clipping the tex2D's .a but I can't get to work... my intention is to transform that black render into any color I'd like or simply transparent. Help! Here's the end of my code:

 v2f vert (appdata v)
             {
                 v2f o;
                 o.vertex = UnityObjectToClipPos(v.vertex);
                 o.uv = TRANSFORM_TEX(v.uv, _Tex1);
                 UNITY_TRANSFER_FOG(o,o.vertex);
                 return o;
             }
             
             fixed4 frag (v2f i) : SV_Target
             {
                 // sample the textures
                 fixed4 tex1 = tex2D(_Tex1, i.uv + float2(((_Time.y) * _SpeedX1), (_Time.y) * _SpeedY1));
                 clip(tex1.a - _CutoutThresh);
 
                 fixed4 tex2 = tex2D(_Tex2, i.uv + float2(((_Time.y) * _SpeedX2), (_Time.y) * _SpeedY2));
                 clip(tex2.a - _CutoutThresh);
 
                 fixed4 tex3 = tex2D(_Tex3, i.uv + float2(((_Time.y) * _SpeedX3), (_Time.y) * _SpeedY3));
                 clip(tex3.a - _CutoutThresh);
 
                 fixed4 tex4 = tex2D(_Tex4, i.uv + float2(((_Time.y) * _SpeedX4), (_Time.y) * _SpeedY4));
                 clip(tex4.a - _CutoutThresh);
 
                 fixed4 tex5 = tex2D(_Tex5, i.uv + float2(((_Time.y) * _SpeedX5), (_Time.y) * _SpeedY5));
                 clip(tex5.a - _CutoutThresh);
 
                 fixed4 tex6 = tex2D(_Tex6, i.uv + float2(((_Time.y) * _SpeedX6), (_Time.y) * _SpeedY6));
                 clip(tex6.a - _CutoutThresh);
 
                 fixed4 tex7 = tex2D(_Tex7, i.uv + float2(((_Time.y) * _SpeedX1), (_Time.y) * _SpeedY7));
                 clip(tex7.a - _CutoutThresh);
 
                 fixed3 finaltex = (tex1 * tex1.a) + (tex2 * tex2.a) + (tex3 * tex3.a) + (tex4 * tex4.a) + (tex5 * tex5.a) + (tex6 * tex6.a) + (tex7 * tex7.a);
 
                 // apply fog
                 UNITY_APPLY_FOG(i.fogCoord, finaltex);
                 return fixed4(finaltex, 1);
             }
             ENDCG
         }
     }
 }

alt text

Thanks!

sem-titulo.png (23.0 kB)
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 DoctorSp8dles · Jan 02, 2018 at 07:01 PM 0
Share

Actually, I've figured out. I've added all the texN. and replaced the value "1" at line 38 by the equation.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by sparkzbarca · Jan 01, 2018 at 07:16 AM

Click on the imported inspector in the unity editor, like the actual png or whatever not it attached to anythign, the raw texture. under import settings in the inspector is a checkbox for

"Alpha is transparent"

probably need to check that box.

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 DoctorSp8dles · Jan 01, 2018 at 08:15 PM 0
Share

No I did that already hahaha. Let me edit the post so people can see better what is happening.

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

116 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

Related Questions

Unlit Transparent Cutout shader that can switch between two textures 0 Answers

Transparent Cutout Shader - max transparency distance? 1 Answer

Transparent/Cutout shader not working on Mac 0 Answers

Shader Depth Mask - Shadows with cutouts 2 Answers

Cutout + Specularmask-shader error: "Material doesn't have a color property" 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