Interpolating vertex normals

I’m running Unity 5.6.5 on an old Atom Netbook (Shader Model 2.0) and the surface normals aren’t being properly calculated:

How can I manually calculate the normals to get smooth per-pixel lighting?

There are a few reasons your lights might not appear per-pixel:

  • In Quality settings, make sure your pixel light count is not zero
  • In PlayerSettings-Other Settings, make sure your vertex path is not Legacy-VertexLit
  • If you made that model in another program, it may not have smooth normals. You can have Unity automatically smooth the normals if you enable “recalculate normals” in the model import settings

That’s all I can think of - Good luck!

1 Like

Thanks for the reply.

  1. It’s set to 4 per pixel lights.
  2. It’s set to Forward mode.
  3. The model is the basic Plane that comes with Unity.

If I change the shader to VertexLit I get this which is as expected:
3465731--275051--normalsBadVertex.png

I believe what you’re seeing is an optimization that Unity uses on the lowest quality per pixel lighting. There are no settings to disable this optimization. The only solution is to write your own shaders.

What I believe you’re seeing is what happens when you use a per vertex normalized light direction instead of a per pixel normalized light direction. For directional lights and point / spot lights not close to flat surfaces the artifacts this causes are minor, but a point light next to a flat surface is the worst case scenario for it.

1 Like

If your art style allows detailed textures, you can texture the surface - which should reduce this look somewhat.
You could also try to add more vertices per square-unit per surface.
If none of the above is an option or yields pleasing results, the solution is in the post of bgolus.

1 Like

Indeed, when using a standard surface shader the problem disappears. Thanks for the info.

3466699--275214--image.png