Finally after converting from XNA4 (DirectX9) to SharpDX (DirectX11) its all back together again. Is it faster ? Because I limit my rendering to 60fps I dont see any difference, but I can believe there is a lot more power available to me than previously. Ultimately the task was to get off the dead technology onto something more useful.
If you are ever thinking about doing this it will probably take you about 2 months. If you have extensively used the XNA (or SlimDX) Game library, it will take longer than that.
My next step will be either to implement Shadows or use a Geometry Shader to generate my grass, which is currently generated from a repeated vertex buffer patch. Shadows seems to be the better “return on investment” because, although its more efficient to use a GS for grass, my grass does actually work – inefficiently.
The problem with Shadows is that there is not perfect implementation. There are plenty of guides (including the ever reliable Rastertek) and the basic approach is simple; to repeat –
- Render your whole scene (or at least those objects who might cast a shadow) from the viewpoint of the light source. Record the depth of each pixel into a texture.
- Send the texture from (1) as a texture parameter to (2).
- Render your whole scene (everything this time) and test every pixel’s depth – if it is more than the equivalent depth recorded in (1) then this pixel is in shadow.
Simple enough but pretty problematic in execution, espcially the need to render the whole scene twice. You can get away with this by only rendering a shadow texture for the nearer objects but then distant woodlands etc. cast no shadows and dont get the “gloom” effect that real woods do. This is compounded by the fact that distant woods are only Imposters so rendering them as geometry to calculate their shadows would be prohibitively expensive.
Add in the complexity of the fact that a Depth Buffer doesn’t have an infinite range of values for each pixel, which needs you to implement Cascaded Shadow Maps and it all seems too “contrived” to me. There seems no getting away from the need to build all this infrastructure. Time to get my thinking cap on.