- Home /
Lighting induced seams
I have created a terrain that is made up of several tiles and I am currently trying to add lighting to this. I have run into a problem that could be with my shader but is causing the tiles, whose vertices and normals should agree at the edges, to have seams and lighting artifacts. Here are two examples: With my shader
With default diffuse lit
This is what I am using to calculate the normal direction
float3 normalDirection = normalize(float3(
mul(float4(input.normal, 0.0), modelMatrixInverse)));
And here is how I get light direction:
float3 lightDirection = normalize(
float3(_WorldSpaceLightPos0));
And calculating the diffuse reflection with this bit:
float3 diffuseReflection =
float3(_LightColor0) * float3(_Color)
* max(0.0, dot(normalDirection, lightDirection));
The only thing that I think would cause this is the normals not being calculated correctly. The surface in these images is seamless as the vertices at the edges have the same world position.
EDIT: In the editor I have highlighted the 4 planes pictured here, as you can see their edge vertices match up with each other.
Your answer
Follow this Question
Related Questions
[SOLVED]Procedural generated side by side cubes without 'seams'? 2 Answers
How to write unlit surface shader? 6 Answers
Seams between Primitive Cubes 1 Answer
Importing from Blender causes tangent/normal errors 0 Answers
Inconsistent Lighting Options 1 Answer