Ninja Camp III: Direct3D 11
Over the NinjaCamp III week I (it’s-a me, Aras!) worked on implementing a Direct3D 11 renderer in Unity. At the beginning of the week I had a standalone player that creates a window, clears it to the correct camera background color and could draw a cube in magenta color. All in full glory of Direct3D 11, how cool is that?
This is our Bootcamp demo, running in D3D11. So lots of the stuff is working: meshes, textures, shaders, shadows, deferred lighting, Image Effects, particles, skinned meshes, terrain and so on. For the reference, Bootcamp running on DX9:
As you can see, some of the stuff is not working on D3D11 yet. Fog is not working; there’s some lighting difference on grass. Some other things are not working, like fixed function shaders (VertexLit ones or any shaders that use SetTexture) but you can’t see much of those in Bootcamp.
Awesome? Yes and no.
For basically a week of work, I’d like to think this is very good progress.
Is our D3D11 renderer teh awsum yet? No. Currently it’s running slower than D3D9, and does not implement all the features of D3D9 one either (fog, fixed function etc.). And I haven’t even started exposing D3D11 specific things like Compute Shaders, Shader Model 4/5, Tessellation etc. And there are some unsolved workflow issues, for example: when someone is making a game on a Mac, how would we compile shaders for D3D11 renderer? With D3D9 we can do it because NVIDIA’s Cg compiler works both on Windows and Mac, but no such luck with D3D11 shader compiler…
So this is not shipping quite yet. Performance is not great at the moment – which is to be expected. D3D11 potentially can be faster than D3D9, but the path of getting there is not an easy one. We also need to actually expose compute shaders, tessellation and other goodies. And then think about how/if equivalent features would work on other platforms like Macs (DirectCompute on Windows, OpenCL on Mac? etc.).
But, so far it’s promising! Stay tuned, maybe someday we’ll ship this ;)