• 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
Question by AnderSystems · Jul 23, 2018 at 03:11 PM · shaderrenderingreflectionsurface shader

Reflection Reflections Probe is spinning with color

I've created a shader to set the color of the car, everything is working fine. But the reflections spin as the color saturation changes. Any way to solve this problem?

Shader "Veículos/CarPaint" { Properties { _Color ("Pintura", Color) = (1,1,1,1 _MainTex ("Textura (RGB)", 2D) = "white" {} _Glossiness ("Smoothness", Range(0,1)) = 0.5 _Metallic ("Metallic", Range(0,1)) = 0.0

     _Raindrops("Gotas de Chuva", 2D) = "white" {}
     _RainNoise("Gotas de Chuva2", 2D) = "white" {}
     _RainScale("Profundidade das Gotas", Range(-1,1)) = 0

     _Dust("Poeira", 2D) = "white" {}
     _Dust2("Terra", 2D) = "white" {}
     _DustColor ("DustColor", Color) = (1,1,1,1)
     _DustAlpha ("Sujeira", Range(0,1)) = 1

 }

 CGINCLUDE
     //@TODO: should this be pulled into a shader_feature, to be able to turn it off?
     #define _GLOSSYENV 1
     #define UNITY_SETUP_BRDF_INPUT SpecularSetup
 ENDCG
 

 SubShader {
     Tags { "RenderType"="Opaque" }
     LOD 200
         CGPROGRAM
         // Physically based Standard lighting model, and enable shadows on all light types
         #pragma target 3.0
         #include "UnityPBSLighting.cginc"
         #pragma surface surf Standard

         // Use shader model 3.0 target, to get nicer looking lighting
         #pragma target 3.0

         sampler2D _MainTex;
         sampler2D _Dust;
         sampler2D _Dust2;
         sampler2D _RainNoise;
         sampler2D _Raindrops;

         struct Input {
             float2 uv_MainTex;
             float2 uv_Dust;
             float2 uv_Dust2;
             float2 uv_RainNoise;
             float2 uv_Raindrops;
         };

         half _Glossiness;
         half _Metallic;
         half _DustAlpha;
         half _RainScale;
         fixed4 _Color;
         fixed4 _DustColor;


         // 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) {
             //Dust
             fixed4 t = tex2D (_Dust, IN.uv_Dust) * _DustColor;
             fixed4 d = tex2D (_Dust2, IN.uv_Dust2) * (_DustColor);

             // Albedo comes from a texture tinted by color

             fixed4 e = tex2D (_Dust, IN.uv_Dust);

             fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;

             o.Albedo = (c.rgb * (1 - (e.rgb) * (_DustAlpha)) + t.rgb * _DustAlpha);

             //Rain
             fixed4 n = tex2D (_Raindrops, IN.uv_Raindrops);
             fixed4 m = tex2D (_RainNoise, IN.uv_RainNoise);
             o.Normal = c.rgb + ((n.rgb - (m.rgb)) * _RainScale);

             // Metallic and smoothness come from slider variables
             o.Metallic = _Metallic -((_DustAlpha * ((d.rgb * 10) * (t.rgb * 10)) * _DustAlpha) - (n.rgb * (_RainScale * 10)));
             o.Smoothness = _Glossiness -((_DustAlpha * ((d.rgb * 10) * (t.rgb * 10)) * _DustAlpha) - (n.rgb * (_RainScale * 10)));
             o.Alpha = c.a;
         }
         ENDCG
 }
 FallBack "Diffuse"

}

Comment

People who like this

0 Show 0
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

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

204 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

Related Questions

How to correctly apply direction to reflection from unity_SpecCube0 0 Answers

Reflection Probe Box Projection in URP Not Working on Oculus Quest 0 Answers

Tweening 50 circles 0 Answers

How to continue material between sprites. 1 Answer

How do I make a shader that will work with Unity 2D Lights? 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