 Shadowing part III |
Posted - 6/6/2007 11:15:31 AM | No, I haven't been inactive in the past weeks. On the contrary: I've just been so busy that I didn't find the time to post a new journal :)
Minas Tirith v12
... has finally been fixed and released:
http://www.minastirithproject.com/MinasTirith12.rar
For more infos, have a look at the website or the cgtalk thread:
http://forums.cgsociety.org/showthread.php?f=73&t=153431&page=158&pp=15
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 ).
New computer
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:
http://fl-tw.com/InfinityForums/viewtopic.php?t=3587&start=0&postdays=0&postorder=asc&highlight=
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:

With LiSPSM

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.



| |
|
| S | M | T | W | T | F | S | | | | | | 1 | 2 | 3 | 4 | 5 | | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | | | | | | | |
OPTIONS
Track this Journal
ARCHIVES
October, 2009
August, 2009
July, 2009
May, 2009
April, 2009
March, 2009
February, 2009
January, 2009
November, 2008
October, 2008
July, 2008
June, 2008
May, 2008
April, 2008
March, 2008
January, 2008
December, 2007
November, 2007
October, 2007
September, 2007
August, 2007
July, 2007
June, 2007
May, 2007
April, 2007
March, 2007
February, 2007
January, 2007
December, 2006
November, 2006
October, 2006
September, 2006
August, 2006
July, 2006
June, 2006
May, 2006
April, 2006
March, 2006
February, 2006
January, 2006
December, 2005
November, 2005
October, 2005
September, 2005
August, 2005
July, 2005
June, 2005
May, 2005
April, 2005
March, 2005
February, 2005
January, 2005
December, 2004
October, 2004
September, 2004
August, 2004
|