L3DT development blog
Large 3D terrain generator

Faster shadow casting

Hi Everyone,

With the final release version of L3DT v2.7 now 'in the bag' and awaiting imminent release*, I've turned my mind towards the vexed problem of shadow mapping. Put simply, L3DT's shadow mapper is painfully slow, and I want to fix that for the next release. My ultimate goal here is to parallelize the shadow-mapping calculation so that it can take advantage of multi-core processors, as I've done with the texture, light and normals map calculations already.

However, before I could start with multi-threading, I thought I'd re-write the raycast routine to remove some of the cruft. I had, apparently, written the current shadow mapping algorithm in some haste, and had included code that was obviously unoptimised. For example, in each ray step I was performing two double-precision divisions by a constant value. How embarrassing! Anyway, I replacing these divisions with multiplications by a pre-calculated inverse value (outside of the inner loop), thereby saving two rather costly division operations. Similar optimisations were found elsewhere in the raycast routine.

Anyway, the up-shot is that I've managed to speed-up the shadow-casting routine by a factor of ~10 times (9.7x in my test, but YMMV). Note this is before I get to the multi-threading! You can expect to see this optimisation in the first developmental build following L3DT release 2.7.

Cheerio, Aaron.

* It's currently in final QA and on its way to upload.

 
l3dt/2009/feb/24.txt · Last modified: 2017/08/31 04:23 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported
L3DT Development Blog RSS Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki