Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
1 capture
14 Jun 22 - 14 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 /
  • Help Room /
avatar image
0
Question by comitatensis · 20 hours ago · shadersshader programming

Multi layer texture transparent when not supposed to

Hi, I am kinda new when it comes to shaders, so I am trying to make a few things in order to learn.

One the things i am trying to do is a flage made of four textures in differents layers, each layer with its own color. The thing is, it is almost ok, but th parts that i need not being transparent are a little see through alt text

here's my shader:

 Shader "Custom/CustomLayers"
 {
     Properties
     {
         _FirstTex("Texture", 2D) = "white" {}
         _FirstColor("Color", Color) = (1,1,1,1)
         _SecondTex("Texture", 2D) = "white" {}
         _SecondColor("Color", Color) = (1,1,1,1)
         _ThirdTex("Texture", 2D) = "white" {}
         _ThirdColor("Color", Color) = (1,1,1,1)
         _FourthTex("Texture", 2D) = "white" {}
         _FourthColor("Color", Color) = (1,1,1,1)
     }
         SubShader
         {
             Tags { "Queue" = "Transparent" "RenderType" = "Transparent" }
             LOD 200
 
         CGPROGRAM
         // Physically based Standard lighting model, and enable shadows on all light types
         #pragma surface surf Standard fullforwardshadows alpha
 
         // Use shader model 3.0 target, to get nicer looking lighting
         #pragma target 3.0
 
         sampler2D _FirstTex;
         sampler2D _SecondTex;
         sampler2D _ThirdTex;
         sampler2D _FourthTex;
 
         struct Input
         {
             float2 uv_FirstTex;
             float2 uv_SecondTex;
             float2 uv_ThirdTex;
             float2 uv_FourthTex;
         };
 
         fixed4 _FirstColor;
         fixed4 _SecondColor;
         fixed4 _ThirdColor;
         fixed4 _FourthColor;
 
         UNITY_INSTANCING_BUFFER_START(Props)
             // put more per-instance properties here
         UNITY_INSTANCING_BUFFER_END(Props)
 
 
         void surf (Input IN, inout SurfaceOutputStandard o)
         {
             // Albedo comes from a texture tinted by color
             fixed4 c0 = tex2D(_FirstTex, IN.uv_FirstTex) * _FirstColor;
             fixed4 c1 = tex2D(_SecondTex, IN.uv_SecondTex) * _SecondColor;
             fixed4 c2 = tex2D(_ThirdTex, IN.uv_ThirdTex) * _ThirdColor;
             fixed4 c3 = tex2D(_FourthTex, IN.uv_FourthTex) * _FourthColor;
 
             fixed4 tt = c0 + c1 + c2 + c3;
 
             tt.rgb = lerp(c0.rgb, c1.rgb, c1.a);
             tt.rgb = lerp(tt.rgb, c2.rgb, c2.a);
             tt.rgb = lerp(tt.rgb, c3.rgb, c3.a);
 
             o.Albedo = tt.rgb;
             o.Alpha = tt.a;
         }
         ENDCG
     }
     FallBack "Diffuse"
 }
 

Anyone can light my candle?

see-through-flag.jpg (61.5 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 dcmrobin · 17 hours ago 0
Share

I think it isn't transparent, it's just that unity's grid is shown through anything. If you can find a picture that shows an object showing through that material, then I'm wrong. But maybe the grid is supposed to be seen through your material :)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by comitatensis · 13 hours ago

@dcmrobin It is actually that transparent ingame, look : alt text


see-through-flag-2.jpg (138.6 kB)
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

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

216 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image 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

Among Us Masking (RGB) Question 0 Answers

Standard Cutout Double Sided? 0 Answers

A Blend Shader That Uses Vertex Information 0 Answers

Shader - SV_Target 1 Answer

why outline is drawed only on front side of skinned mesh render 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