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 Zeronev · Dec 11, 2015 at 10:46 PM · unity 5shadermeshtransparent

Shader making mesh dissappear or greyed out after Unity Update

Hello!

The shader I was using for my game was working correctly in the previous version of Unity (5.2), When I updated it, now I can no longer see it, nor working as intended. Thr shader is a Hologram shader.

(Yes, it's a bit large, If you don't want to read it, then any advice or anything I could look up to would be great)

Thanks in advance!! Here is the shader code:

 Properties {
         _Color ("Main Color", Color) = (30,70,80,0)
            _ColorNoise ("Noise Color", Color) = (30,70,80,0)
            _ImageTex ("Main Image", 2D) = "white" {}
            _MainTex ("Scanlines", 2D) = "white" {}
         _NoiseTex ("Displacement Map", 2D) = "white" {}
         _SecondaryTex ("Noise Map", 2D) = "white" {}
         _TimeScale ("Motion Speed",  Range (0, 10)) = 4
         _Displacement("Motion Displacement",  Range (0, 1)) = 0.3
         _Cutoff("Image Alpha Cutoff",  Range (0, 1)) = 0.3
         _XScrollSpeed ("X Scanline Speed",  Range (-5, 5) ) = 0
         _YScrollSpeed ("Y Scanline Speed", Range (-10, 10) ) = 1
     }
     
     SubShader {
 
 
     Cull Off
          // Now render front faces
 
                  Tags{ "RenderType"="Transparent"}
 
          CGPROGRAM
          #pragma surface surf Lambert alpha
          
          float4 _ColorNoise;
          sampler2D _SecondaryTex;
 
 
         float _XScrollSpeed;
         float _YScrollSpeed;
         float _Cutoff;
 
         float2 uv_MainTex;
                 sampler2D _ImageTex;
 
 
      
  
          struct Input {
          float2 uv_SecondaryTex;
           float2 uv_ImageTex;
 
          };
  
              // Green front faces
              void surf (Input IN, inout SurfaceOutput o) {
 
 
             fixed2 scrollUV = IN.uv_SecondaryTex ;
             float timeFrac = _Time*24;
             fixed xScrollValue = timeFrac * 22;
             fixed yScrollValue = timeFrac * 22;
             scrollUV += fixed2( xScrollValue, yScrollValue );
 
                 half4 c = tex2D(_SecondaryTex, IN.uv_SecondaryTex) * _ColorNoise;
              o.Albedo =  tex2D(_SecondaryTex , scrollUV ).rgba * _ColorNoise.rgba * tex2D(_ImageTex, IN.uv_ImageTex).rgb;
              o.Alpha = 0;
              clip(tex2D(_ImageTex, IN.uv_ImageTex).a - _Cutoff - o.Albedo);
 
              c.a = _ColorNoise.a;
 
          }
 
                   ENDCG
 
 
 
     Cull Off
 
         Tags{ "RenderType"="Transparent"}
             
         CGPROGRAM
         #pragma surface surf Lambert vertex:vert alpha
         #pragma target 3.0
 
         #include "UnityCG.cginc"
 
 
         sampler2D _MainTex;
         sampler2D _NoiseTex;
                 sampler2D _ImageTex;
 
 
         float _XScrollSpeed;
         float _YScrollSpeed;
      
         float4 _Color;
         float _Displacement;
         float _TimeScale;
         float _Cutoff;
 
 
         struct Input {
             float2 uv_MainTex;
                         float2 uv_ImageTex;
 
             INTERNAL_DATA
         };
 
             
         void vert(inout appdata_full v)
         {
             #if !defined(SHADER_API_OPENGL)
             float timeFrac = frac(_Time*_TimeScale);
             float2 texCoord = float2(v.texcoord.x  + -timeFrac , v.texcoord.y + -timeFrac );
             float2 texCoord2 = float2(v.texcoord.x  + -timeFrac , v.texcoord.y + -timeFrac );
             // average the noise out.  This essetially allows any texture to be used as noise.
             float4 noise = tex2Dlod(_NoiseTex, float4(texCoord,0,0)).rgba;
             float displacement = (((noise.x + noise.z + noise.y)/4 - 0.3) * _Displacement);
             v.vertex.xyz = v.vertex.xyz + (normalize(v.normal.xyz) * displacement );
 
             #endif
         }
           
         void surf(Input IN, inout SurfaceOutput o) 
         {
 
             fixed2 scrollUV = IN.uv_MainTex ;
             float timeFrac = _Time;
             fixed xScrollValue = timeFrac * _XScrollSpeed;
             fixed yScrollValue = timeFrac * _YScrollSpeed;
             scrollUV += fixed2( xScrollValue, yScrollValue );
 
                half4 c = tex2D( _MainTex, scrollUV)  * _Color;
             o.Albedo =  tex2D(_MainTex , scrollUV ).rgb * _Color.rgba * tex2D(_ImageTex, IN.uv_ImageTex).rgb;
             o.Alpha = 0;
             clip(tex2D(_ImageTex, IN.uv_ImageTex).a - _Cutoff - o.Albedo);
             c.a = _Color.a;
 
         }
         ENDCG
     }
     Fallback "Diffuse"
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 m0guz · Dec 12, 2015 at 01:50 AM 0
Share

Assets > Reimport All option sometimes help.

0 Replies

· Add your reply
  • Sort: 

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

44 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

Related Questions

Transparent object VS itself 1 Answer

Patch on a sphere of varying size 0 Answers

Circle Cutout Shader is working in one eye and not in another eye in HoloLens 2 Device 0 Answers

Will Semi Transparent mesh with several folds of geometry sort correctly? 1 Answer

How to combine several Materials into one? 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