Fixed function T&L in vertex shaders: implemented
Unity roadmap blog post said:
Currently Unity mixes the fixed function pipeline for vertex lit objects and vertex shaders for pixel lit lights. On Direct3D this creates some rendering artifacts on very close or self intersecting surfaces. We want to end this by implementing a full fixed function emulator in vertex shaders. You won’t have to do anything, it will just work!
Well, the good news is that we have done it, and it is definitely coming in Unity 2.6!
It is funny, because the problem seems like a simple one: «there are double-lighting artifacts on close surfaces». The solution, however, is «we need to implement whole fixed function pipeline manually», which involves combining shader assembly fragments, doing register allocations, packing vertex pipeline state into bits and other low level hacking.
In other words, it required quite a bit of thinking and implementation effort, so I decided to write up a technical report on how we solved it. If you’re a graphics programmer or love programmer speak or just have nothing better to do: here’s the report.