marten wrote:Thanks for your quick response. My shader is a custom one which colors the mesh with vertex colors and does some vertex displacing:
- Code: Select all
Shader "City/Vertex colored animated" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Smoothness ("Smoothness", Range(0,1)) = 0.5
_Stretch ("Stretch", Range(-0.5,0.5)) = 0
_Bend ("Bend", Range(-0.5,0.5)) = 0
_SubmeshOffset ("Submesh Offset", Vector) = (0,0,0,0)
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Standard vertex:vert addshadow
#pragma target 3.0
struct Input {
float2 uv_MainTex;
float3 vertexColor; // Vertex color stored here by vert() method
};
float _Stretch;
float _Bend;
float3 _SubmeshOffset;
void vert (inout appdata_full v, out Input o) {
UNITY_INITIALIZE_OUTPUT(Input,o);
// Save the Vertex Color in the Input for the surf() method
o.vertexColor = v.color;
//vertex displacing
float y = v.vertex.y + _SubmeshOffset.y;
float x = v.vertex.x + _SubmeshOffset.x;
v.vertex.y += y * _Stretch - (x * y) * _Bend;
v.vertex.x += (v.vertex.x + _SubmeshOffset.x) * -_Stretch + y * y * _Bend;
v.vertex.z += (v.vertex.z + _SubmeshOffset.z) * -_Stretch;
}
sampler2D _MainTex;
half _Smoothness;
fixed4 _Color;
void surf (Input IN, inout SurfaceOutputStandard o) {
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
// Combine normal color with the vertex color
o.Albedo = c.rgb * IN.vertexColor;
o.Smoothness = _Smoothness;
o.Alpha = c.a;
}
ENDCG
}
}
And here are my current settings for the effect. I have tried to fiddle with the settings but nothing seems to help with the problem.
Hello,
There's a Unity issue that prevents it from working under certain combinations. In this case, it works with all settings, using your shader, except with Forward Rendering when using Camera Per-Pixel Normals. Altering the Normals value in the Amplify Occlusion component should resolve the problem.
Let us know if that is not the case, we would be happy to help if that is not the case. Our apologies for the inconvenience.