Minas Tirith v12
... has finally been fixed and released:
For more infos, have a look at the website or the cgtalk thread:
Note that you'll need 2 GB of RAM and a strong video card, as well as the latest video card drivers. It supposedly shows real-time cascaded shadow maps, but I'm not happy with their performance ( that will be the topic of this new dev journal ).
My new computer has arrived: Intel Quad-core Q6600, 2 GB of ram, Nvidia 8800 GTX and Windows Vista. I also added a new flat screen, meaning that I'm now able to work in a dual screen environment. As you can imagine, it was not cheap, but overall I'm happy with that "investment".
Vista is a nice surprise. I was a bit scared to install it, but when you're a software developer you better have as many test environments as possible. Nvidia vs ATI, Intel vs AMD, Win 2K vs Win XP vs Win Vista, etc.. I'm impressed by Aero, all goes pretty smooth and it's responsive. The only real problem I had was to find drivers for my USB modem, an Asus, until I realized that they abandonned the USB drivers for modems in Vista. So I lost a few hours and had to buy a new Ethernet modem.
No real problem with Nvidia OpenGL drivers under Vista so far. The ICP runs fine, too.
Light-space perspective shadow maps
The real fun starts here. This update is a continuation of what I explained here:
Overall I was not happy with cascaded shadow maps. Reasons:
- I thought I could save some performance by updating the shadow maps every N frames ( ie. caching the shadow maps between frames ). Bad idea: the camera could move quickly, and as soon as an object moves or rotates, it ends up with wrong shadows.
- Performance: 4 shadow maps to update per frame, each shadow map is 1024^2. That means 4 rendering passes, and rendering the scene 4 times. It's especially bad in a model such as Minas Tirith with complex meshes.
- Range: if you increase by a factor of 2 the range covered by each cascaded shadow map, if you start with the first shadow map covering an area of 100m, that means your final range is 800m. At this point you have 2 choices:
A. Increase the starting range, and you'll quickly loose quality on closer objects ( shadow get blurry when seen up close ).
B. Increase the growing factor ( values over 2 ), meaning that the seams between shadow maps get more and more noticeable.
So for all of those reasons, I decided to abandon cascaded shadow maps.
I started to experiment light-space shadow mapping. Let me tell you one thing: even for a pretty advanced graphics programmer like me, it's mind boggling. The theory is relatively simple, but the combination of weird projection matrices, deformations and shaders that don't want to work, plus lots of artifacts and degenerated scenarii to handle, are a real pain to make it work.
The idea behing light-space shadow mapping is to create a light space inside which the view frustum is (quickly summarized) a pyramid whose apex is located at the middle-bottom of the shadow map. If you were using an orthographic projection from the point of view of the light, you'd get standard shadow maps, focused on the view point. Light-space shadow maps add another idea: the bottom area of the shadow map will get stretched horizontally, while the top area of the shadow map remains intact. This stretching effect gives more shadow map resolution to areas near the camera, meaning higher quality where it's needed.
It still does no miracle, and the quality of the shadow map becomes viewpoint dependent. If you are looking at 90? compared to the light direction, the quality is better. If you are looking straight in the light direction (or opposite), you can get a bad quality ( similar to standard shadow maps ). I don't like the idea that shadow mapping quality is view dependant ( cascaded shadow maps was not ), but at this point, it seems like it's the best trade-off.
I spent a lot of time to fix "deformations" ( shadows were "physically" moving when the camera was turning around ), until I realized the projection matrix made the shadow mapping tesselation dependant, if done in the vertex shader. Since tesselating the meshes is out of question, I shifted the matrix maths to the pixel shader ( it's only 6 or 7 instructions ) and the deformations disappeared.
The good points:
- one 2048x2048 is enough to get an okay quality on close ranges, and a good quality and further ranges. Max range with one 2048x2048 is around 2 Km ( compare that to the 4 cascaded shadow maps at 800m ).
- performance is good: around 200 fps on a 7800 GTX, for a scene with 60K triangles. More than 300 fps on my new Quad-core machine.
A range of 2 Km is good but not sufficient yet. The next step ( other than continuying to improve the implementation ) is to experiment trapezoidal shadow maps, or to combine 2 LiSPSM together, one for range up to 2 Km, and a second one with a range up to tens of Km.
Here are a couple of screenshots (diffuse textures and shadowing only, no effects or bump/specular):
And now to compare:
Without LiSPSM ( standard shadow maps only )
Ships design doc
... is soon available. We have finally settled on the hangar and garage (ex-alcoves) system.
Dimensions are as follows:
- Small garage: 12.000 x 15.000 x 8.000
- Medium garage: 32.000 x 30.000 x 12.000
- Large garage: 38.000 x 50.000 x 20.000
Dimensions for larger garages ( for hunters, frigates, etc.. ) haven't been specified yet.