Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 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 /
avatar image
0
Question by gonee5001 · Mar 07 at 04:01 PM · color

I can't change the main color of my meterial

alt text

This is my shader

plz help............

 Shader "Exploration/Hair Soft Edge Surface" {
     Properties {
         _MainTex ("Diffuse (RGB) Alpha (A)", 2D) = "white" {}
         _Color ("Main Color", Color) = (1,1,1,1)        
         _SpecularTex ("Specular (R) Gloss (G) Null (B)", 2D) = "gray" {}
         _BumpMap ("Normal (Normal)", 2D) = "bump" {}
         _AnisoDirection ("Anisotropic Direction (RGB) Anisotropic Mask (A)", 2D) = "bump" {}
         _AnisoOffset ("Anisotropic Highlight Offset", Range(-0.5,0.5)) = -0.2
         _Cutoff ("Alpha Cut-Off Threshold", Range(0,1)) = 0.5
         _Fresnel ("Fresnel Value", Float) = 0.028
     }
  
     SubShader {
         Tags { "RenderType" = "TransparentCutout" "Queue" = "Geometry+1"  "RequireOption" = "SoftVegetation"}
 
     cull off
  
         CGPROGRAM
             #pragma surface surf ExplorationSoftHair fullforwardshadows exclude_path:prepass nolightmap nodirlightmap
             #pragma target 3.0
  
             struct SurfaceOutputHair {
                 fixed3 Albedo;
                 fixed Alpha;
                 fixed3 AnisoDir;
                 fixed3 Normal;
                 fixed2 Specular;
                 fixed3 Emission;
             };
  
             struct Input
             {
                 float2 uv_MainTex;
             };
            
             sampler2D _MainTex, _SpecularTex, _BumpMap, _AnisoDirection;
             float _Cutoff, _AnisoOffset, _Fresnel;
                
             void surf (Input IN, inout SurfaceOutputHair o)
             {
                 float4 albedo = tex2D(_MainTex, IN.uv_MainTex);
                 clip(albedo.a - _Cutoff);
                
                 o.Albedo = albedo.rgb;
                 o.Alpha = albedo.a;
                 o.AnisoDir = tex2D(_AnisoDirection, IN.uv_MainTex).rgb * 2 - 1;
                 o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_MainTex));
                 o.Specular = tex2D(_SpecularTex, IN.uv_MainTex).rg;
                
                 // Stop DX11 complaining.
                 o.Emission = fixed3(0.0,0.0,0.0);
             }
  
             inline fixed4 LightingExplorationSoftHair (SurfaceOutputHair s, fixed3 lightDir, fixed3 viewDir, fixed atten)
             {
                 viewDir = normalize(viewDir);
                 lightDir = normalize(lightDir);
                 s.Normal = normalize(s.Normal);
                 float NdotL = dot(s.Normal, lightDir);
                 float3 h = normalize(lightDir + viewDir);
                 float VdotH = dot( viewDir, h );
  
                 float fresnel = pow( 1.0 - VdotH, 5.0 );
                 fresnel += _Fresnel * ( 1.0 - fresnel );
                 float aniso = max(0, sin(radians( (dot(normalize(s.Normal + s.AnisoDir), h) + _AnisoOffset) * 180 ) ));
                 float spec = pow( aniso, s.Specular.g * 128 ) * s.Specular.r * fresnel;
                
                 fixed4 c;
                 c.rgb = (s.Albedo * saturate(NdotL) * atten * _LightColor0.rgb + (spec * atten * _LightColor0.rgb) ) * 2;
                 c.a = s.Alpha;
                
                 return c;
             }
         ENDCG
  
         ZWrite Off
  
         CGPROGRAM
             #pragma surface surf ExplorationSoftHair fullforwardshadows exclude_path:prepass nolightmap nodirlightmap decal:blend
             #pragma target 3.0
  
             struct SurfaceOutputHair {
                 fixed3 Albedo;
                 fixed Alpha;
                 fixed3 AnisoDir;
                 fixed3 Normal;
                 fixed2 Specular;
                 fixed3 Emission;
             };
  
             struct Input
             {
                 float2 uv_MainTex;
             };
            
             sampler2D _MainTex, _SpecularTex, _BumpMap, _AnisoDirection;
             float _Cutoff, _AnisoOffset, _Fresnel;
                
             void surf (Input IN, inout SurfaceOutputHair o)
             {
                 float4 albedo = tex2D(_MainTex, IN.uv_MainTex);
                 clip(-(albedo.a - _Cutoff));
                
                 o.Albedo = albedo.rgb;
                 o.Alpha = albedo.a;
                 o.AnisoDir = tex2D(_AnisoDirection, IN.uv_MainTex).rgb * 2 - 1;
                 o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_MainTex));
                 o.Specular = tex2D(_SpecularTex, IN.uv_MainTex).rg;
                
                 // Stop DX11 complaining.
                 o.Emission = fixed3(0.0,0.0,0.0);
             }
  
             inline fixed4 LightingExplorationSoftHair (SurfaceOutputHair s, fixed3 lightDir, fixed3 viewDir, fixed atten)
             {
                 viewDir = normalize(viewDir);
                 lightDir = normalize(lightDir);
                 s.Normal = normalize(s.Normal);
                 float NdotL = dot(s.Normal, lightDir);
                 float3 h = normalize(lightDir + viewDir);
                 float VdotH = dot( viewDir, h );
  
                 float fresnel = pow( 1.0 - VdotH, 5.0 );
                 fresnel += _Fresnel * ( 1.0 - fresnel );
                 float aniso = max(0, sin(radians( (dot(normalize(s.Normal + s.AnisoDir), h) + _AnisoOffset) * 180 ) ));
                 float spec = pow( aniso, s.Specular.g * 128 ) * s.Specular.r * fresnel;
                
                 fixed4 c;
                 c.rgb = (s.Albedo * saturate(NdotL) * atten * _LightColor0.rgb + (spec * atten * _LightColor0.rgb) ) * 2;
                 c.a = s.Alpha;
                
                 return c;
 }
         ENDCG
     }
     FallBack "Transparent/Cutout/VertexLit"
 }
fak.png (260.7 kB)
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 sacredgeometry · Mar 08 at 08:28 AM

It doesnt look like you are ever using _Color

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

134 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

Related Questions

Material doesn't have a color property '_Color' 4 Answers

Changing two different objects renderer colour 1 Answer

new Color() not working properly? 1 Answer

Trail faded at start - All colors are full alpha 1 Answer

How to make colored voxels?!? 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