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"
}
Your answer
Follow this Question
Related Questions
How to correctly apply direction to reflection from unity_SpecCube0 0 Answers
How to add color (with opacity) on the whole screen at the beginning of every frame (2d) 0 Answers
LWRP - Proper way to set up LWRP Standard and Simple lighting shaders? 0 Answers
Looking at a Chunk from Straight Down will not Render Blocks, but Looking at it from the Side does? 1 Answer
Get real colors like white or black 1 Answer