Whoa - Out of the Shadows, literally...
self-shadows opengl glsl rendering
Whoa indeed - I can't believe it's been this long since my last Journal here... I seem to get no time to update anything beyond my own blog these days. Every single minute is spent 'dev-ing'...
Anyway - I thought I'd drop by and throw in my attempts at self-shadowing so far in Dominium. This is actually progress from two weeks ago, I'm having fun trying to capture the latest (and much better) results with FRAPS as I think I've managed to banjax it's interception of the frame buffer - ah well!
I've opted for the shadow-map approach, which I'm sure you're all familiar with - this is all relatively old-hat these days - but for anyone who's not... this viewer renders the ship from the point of view of the light source, and captures just the depth buffer information into a texture. It then makes that depth texture available to the 'proper in-game' shader when it renders the model, and works out whether each pixel in the final image is in shadow or not, by comparing the depth value against the one in the depth texture. If it's greater than the depth-texture, the pixel is lit, and vice versa.
Feel free to take a nose on Dominium's Youtube Channel
You get into a whole world of fun with z-fighting, and of course 'jaggies'... oddly, in this video it's using a 256x256 depth texture and the jaggies don't actually look too bad with a tiny bit of in-shader linear filtering.
Anyway, the current system is hitting a 2048x2048 depth texture (for testing) and using PCF as well. It looks great at a near-distance, but starts looking a little rough when closing in.
I've yet to get this in-game, the logic has been put in - but I'm not getting any depth texture output so I've clearly broken something somewhere... sigh. I just have to track it down!
Another update soon-ish-maybe-later