Thursday, May 6, 2010

Worldspace shadow-map / virtual texture - another random idea

Just a new random, not even a nearly completely thought out idea of mine.
Which I blame on only having time to dream up these things, but not actually try them $@#!
Yes, I am frustrated ;)


Suppose we perform our lighting within our virtual texture cache (aka surface caching), which I've blogged about often, and we store our texel world-space coordinates in the cache, wouldn't we also be able to use this information to do shadow mapping?

The (HUGE) downside is that we'd need a place to store the texel coordinates even for pages that aren't visible (being able to analytically cull pages and lights would definitely help here... page bounding boxes? bounding volume hierarchies?)
Would lower resolution mips be enough for lighting? (sometimes?)
I suppose some sort of preprocessing could help here.. I can imagine that a lot of the geometry that uses a specific page would essentially be flat.

The upside is that we'd only have to render geometry exactly once per frame (or less, with caching), and perhaps we could be rendering the lighting directly into the cache..
In which case having the knowledge of all the transparent pages between your texel and the light-source would be interesting! (Probably slow as hell though, even IF you manage to get this to work somehow)

What about texel world coordinate mip maps?
Would we need to store min/max coordinates instead of 'just' coordinates?
Could that be used in a sort of hierarchical z-buffer type of setup somehow?
For (rough) culling on the CPU side perhaps?
For both the shadow map and camera?
That would require us to have the texel coordinates on the CPU side though.. (static geometry only?)
Preprocessed and stored with the pages? (geometry images?)
But bandwidth is already an issue...
Then again, it would probably be very compressible, most of the time.
At least, for the higher resolution mips..

Argh, too many angles, too many ideas!
Most of them look extremely impractical to begin with, but it's a lot of fun to think about ;)

Besides all that, this idea popped in my head:
If every texel coordinate is unique with virtual texturing, wouldn't we be able to use this, somehow, to eliminate shadow acne? (Assuming you're not using cascaded shadow maps already & this would really be complicated by page mip maps)

No comments:

Post a Comment