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 Bentoon · Aug 30, 2018 at 04:40 AM · shaderalpha-channeldouble-sided

double sided transparent shader

Hi All, I have a shader I have been using a lot last year / that is all of a sudden giving me the error:


'vert': output parameter 'o' not completely initialized Compiling Vertex program with DIRECTIONAL Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR


I dont understand...

Here is the shader:

 Shader "PaperDolls/DoubleSidedAlphaClip"
 {
     Properties 
     {
 _MainTex("Base (RGB) Gloss (A)", 2D) = "white" {}
 _Clipping("_Clipping", Range(0,1) ) = 0.5
 
     }
     
     SubShader 
     {
         Tags
         {
 "Queue"="Geometry"
 "IgnoreProjector"="False"
 "RenderType"="Opaque"
 
         }
 
         
 Cull Off
 ZWrite On
 ZTest LEqual
 ColorMask RGBA
 Fog{
 }
 
 
         CGPROGRAM
 #pragma surface surf BlinnPhongEditor  vertex:vert
 #pragma target 2.0
 
 
 sampler2D _MainTex;
 float _Clipping;
 
             struct EditorSurfaceOutput {
                 half3 Albedo;
                 half3 Normal;
                 half3 Emission;
                 half3 Gloss;
                 half Specular;
                 half Alpha;
                 half4 Custom;
             };
             
             inline half4 LightingBlinnPhongEditor_PrePass (EditorSurfaceOutput s, half4 light)
             {
 half3 spec = light.a * s.Gloss;
 half4 c;
 c.rgb = (s.Albedo * light.rgb + light.rgb * spec);
 c.a = s.Alpha;
 return c;
 
             }
 
             inline half4 LightingBlinnPhongEditor (EditorSurfaceOutput s, half3 lightDir, half3 viewDir, half atten)
             {
                 half3 h = normalize (lightDir + viewDir);
                 
                 half diff = max (0, dot ( lightDir, s.Normal ));
                 
                 float nh = max (0, dot (s.Normal, h));
                 float spec = pow (nh, s.Specular*128.0);
                 
                 half4 res;
                 res.rgb = _LightColor0.rgb * diff;
                 res.w = spec * Luminance (_LightColor0.rgb);
                 res *= atten * 2.0;
 
                 return LightingBlinnPhongEditor_PrePass( s, res );
             }
             
             struct Input {
                 float2 uv_MainTex;
 
             };
 
             void vert (inout appdata_full v, out Input o) {
 float4 VertexOutputMaster0_0_NoInput = float4(0,0,0,0);
 float4 VertexOutputMaster0_1_NoInput = float4(0,0,0,0);
 float4 VertexOutputMaster0_2_NoInput = float4(0,0,0,0);
 float4 VertexOutputMaster0_3_NoInput = float4(0,0,0,0);
 
 
             }
             
 
             void surf (Input IN, inout EditorSurfaceOutput o) {
                 o.Normal = float3(0.0,0.0,1.0);
                 o.Alpha = 1.0;
                 o.Albedo = 0.0;
                 o.Emission = 0.0;
                 o.Gloss = 0.0;
                 o.Specular = 0.0;
                 o.Custom = 0.0;
                 
 float4 Tex2D0=tex2D(_MainTex,(IN.uv_MainTex.xyxy).xy);
 float4 Subtract0=Tex2D0.aaaa - _Clipping.xxxx;
 float4 Master0_1_NoInput = float4(0,0,1,1);
 float4 Master0_2_NoInput = float4(0,0,0,0);
 float4 Master0_3_NoInput = float4(0,0,0,0);
 float4 Master0_4_NoInput = float4(0,0,0,0);
 float4 Master0_5_NoInput = float4(1,1,1,1);
 float4 Master0_7_NoInput = float4(0,0,0,0);
 clip( Subtract0 );
 o.Albedo = Tex2D0;
 
                 o.Normal = normalize(o.Normal);
             }
         ENDCG
     }
     Fallback "Diffuse"
 }

THANKS!!

~Be

Comment
Add comment
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

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Piyush_Pandey · Aug 30, 2018 at 05:33 AM

You have the out variable uninitialised. All you have to do is initialise in the vertex function. Just replace the vertex function with

 void vert (inout appdata_full v, out Input o)
 {
         UNITY_INITIALIZE_OUTPUT(Input, o);
         float4 VertexOutputMaster0_0_NoInput = float4(0,0,0,0);
         float4 VertexOutputMaster0_1_NoInput = float4(0,0,0,0);
         float4 VertexOutputMaster0_2_NoInput = float4(0,0,0,0);
         float4 VertexOutputMaster0_3_NoInput = float4(0,0,0,0);  
  }


You can see that i just added the line UNITY_INITIALIZE_OUTPUT(Input, o); only. I have tested it in Unity 2017.2 and it works

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 Bentoon · Aug 31, 2018 at 03:57 PM 0
Share

Thank You !! @Piyush_Pandey You made my day !

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

141 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

Related Questions

Shader to render RenderTexture plus alpha? 1 Answer

Problems with two sided textured shader 3 Answers

Self-Illuminated Normal mapped Specular Shader questions 1 Answer

Shader that draws alpha independent of transparency? 2 Answers

Forcing the Standard Shader to use 0 specular 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