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 /
  • Help Room /
avatar image
0
Question by Verpous · Sep 02, 2019 at 05:25 PM · shadershadersmaterialsshader programmingcustom shader

Unity Particle Pack's Dissolve shader isn't working

I imported Unity's particle pack into my project because it has a cool dissolve shader which I was hoping to use in my game. In their example scene they use a material which is just a color, but the shader has fields for textures like any standard shader. The problem is when I place my textures into these fields nothing changes, no matter which texture I try. I don't know a thing about shader programming so I'm stumped. Here is the shader's code:

 // Upgrade NOTE: upgraded instancing buffer 'Props' to new syntax.
  
 Shader "Custom/Dissolve" {
     Properties {
         _Color ("Color", Color) = (1,1,1,1)
         [HDR]_Emission ("Emission", Color) = (0,0,0,0)
         _MainTex ("Albedo", 2D) = "white" {}
         _Normal ("Normal", 2D) = "bump" {}
         _MetallicSmooth ("Metallic (RGB) Smooth (A)", 2D) = "white" {}
         _AO ("AO", 2D) = "white" {}
         [HDR]_EdgeColor1 ("Edge Color", Color) = (1,1,1,1)
         _Noise ("Noise", 2D) = "white" {}
         [Toggle] _Use_Gradient ("Use Gradient?", Float) = 1
         _Gradient ("Gradient", 2D) = "white" {}
         _Glossiness ("Smoothness", Range(0,1)) = 0.5
         _Metallic ("Metallic", Range(0,1)) = 0.0
         [PerRendererData]_Cutoff ("Cutoff", Range(0,1)) = 0.0
         _EdgeSize ("EdgeSize", Range(0,1)) = 0.2
         _NoiseStrength ("Noise Strength", Range(0,1)) = 0.4
         _DisplaceAmount ("Displace Amount", Float) = 1.5
         _cutoff ("cutoff", Range(0,1)) = 0.0
  
        
     }
     SubShader {
         Tags { "Queue"="AlphaTest" "RenderType"="TransparentCutout" "IgnoreProjector"="True" }
         Cull Off
  
         LOD 200
        
         CGPROGRAM
  
         // Physically based Standard lighting model, and enable shadows on all light types
         #pragma surface surf Standard fullforwardshadows vertex:vert addshadow
  
         // Use shader model 3.0 target, to get nicer looking lighting
         #pragma target 3.0
         #pragma multi_compile __ _USE_GRADIENT_ON
  
         sampler2D _MainTex;
         sampler2D _Noise;
         sampler2D _Gradient;
         sampler2D _Normal;
         sampler2D _MetallicSmooth;
         sampler2D _AO;
  
         struct Input {
             float2 uv_Noise;
             float2 uv_MainTex;
             fixed4 color : COLOR0;
             float3 worldPos;
         };
  
  
         half _Glossiness, _Metallic, _Cutoff, _EdgeSize, _NoiseStrength, _DisplaceAmount;
         half _cutoff;
         half4 _Color, _EdgeColor1, _Emission;
  
  
         void vert (inout appdata_full v, out Input o) {
             UNITY_INITIALIZE_OUTPUT(Input,o);
             float3 pos = mul((float3x3)unity_ObjectToWorld, v.vertex.xyz);
             //pos.x += _cutoff*5;
             float4 tex = tex2Dlod(_Noise, float4(pos, 0)*0.5);
    
  
  
             float4 Gradient = tex2Dlod (_Gradient, float4(v.texcoord.xy,0,0));
             float mask = smoothstep(_Cutoff, _Cutoff - 0.3, 1-Gradient);
  
  
             float displacementAmount = lerp(0, _DisplaceAmount, _cutoff);
             //v.vertex.xyz += mul((float3x3)unity_WorldToObject, float3(0, vertexOffset, 0));
             //v.vertex.xyz = lerp(v.vertex.xyz , float3(0,0,0), clamp(_cutoff * (tex.r+0.1) * displacementAmount, 0, 1));
           }
  
         // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
         // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
         // #pragma instancing_options assumeuniformscaling
         UNITY_INSTANCING_BUFFER_START(Props)
             // put more per-instance properties here
         UNITY_INSTANCING_BUFFER_END(Props)
  
         void surf (Input IN, inout SurfaceOutputStandard o) {
             half3 Noise = tex2D (_Noise, IN.uv_Noise);
             Noise.r = lerp(0, 1, Noise.r);
             half4 MetallicSmooth = tex2D (_MetallicSmooth, IN.uv_MainTex);
             _cutoff  = lerp(0, _cutoff + _EdgeSize, _cutoff);
  
             #if _USE_GRADIENT_ON
             half3 Gradient = tex2D (_Gradient, IN.uv_MainTex);
             half Edge = smoothstep(_Cutoff, _Cutoff - _EdgeSize, 1-(Gradient + Noise.r*(1-Gradient)*_NoiseStrength));
             #else
             half Edge = smoothstep(_cutoff + _EdgeSize, _cutoff, clamp(Noise.r, _EdgeSize, 1));
             #endif
  
             fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
             fixed3 EmissiveCol = c.a * _Emission;
  
             o.Albedo = _Color;
             o.Occlusion = tex2D (_AO, IN.uv_MainTex);
             o.Emission = EmissiveCol + _EdgeColor1 * Edge;
             o.Normal = UnpackNormal (tex2D (_Normal, IN.uv_MainTex));
             o.Metallic = MetallicSmooth.r * _Metallic;
             o.Smoothness = MetallicSmooth.a * _Glossiness;
             clip(Noise - _cutoff);
         }
         ENDCG
     }
     FallBack "Diffuse"
 }
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

Answer by Vincent1236 · Feb 02, 2020 at 08:19 AM

Just ran into the same issue, also don't know too much about shader programming, but the below fixes the main texture not being used:

Find the line that says o.Albedo = _Color; and change that to o.Albedo = c;.

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

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

i wanna draw inside like outside. shader.... 1 Answer

Combine 2 Shaders,Combine 2 shaders 0 Answers

When or how are we going to get Custom Functions on Shader Graph now 0 Answers

How do i get a shader to affect every object with the same material? 0 Answers

Very basic shader problem 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