Let there be LIGHT!

Wouldn't you know, after I complained about lack of coding motivation in my last post, I started hacking at my Java platformer engine the very same evening! I finished the Inkscape SVG importer, now I can create the levels in Inkscape using polygons, rectangles and circles.

Last couple of days I've been implementing a lighting system to the engine (and preliminary scripting support before that). The lighting system is based on very simple ideas and was quite easy to implement. No troubles whatsoever, I was actually surprised. First I was contemplating on doing it using pixel shaders, but that would've required much more work (still learning the shader stuff) and I'm not sure if I could have pulled it off anyway. I still need to incorporate some shader support to the engine if I want to have a bloom effect later on.. Pixel shader lighting would have allowed to have normal maps for the textures though, now that would have looked very nice if done properly! Oh well.

Instead I went for texture based approach using a single FBO (Frame-Buffer-Object) where the lights get rendered to (additive blending naturally). Then with help of some stencil buffer magic, the light map is rendered over the scene using multiply blending. Stencil buffer is needed because it makes no sense to render the lights/shadows over the background (i.e. sky in my platformer). That would be very unrealistic (you can't really cast shadows on the sky, now can you?) not to mention ugly. For top-down games no stencil buffer would be needed, unless the area that gets lit must be restricted somehow.

This technique allows completely dynamic lights of any shape (like flashlight cones) using one render-to-texture (FBO in my case). The light map doesn't even need to be large, since (at least with soft lights) it's hard to see the difference between 256×256 or 512×512. I'm using 256×256 currently, but even 128×128 looks fine. The system works nicely and I've yet to optimize anything about it: for starters I'm currently rendering each light, no matter if they're actually visible or not!

Overall it suits my purposes perfectly – carefully arranged lighting can make a tremendous difference in the feeling and apprearance of the game. 🙂

Here's a few sample screenshots. Please ignore all the graphics etc., as the level is just random polygons and lights are literally randomly generated. And the background is lifted off Jewels. 😛

Long Time No See

So what's going on for me in these days? Well, that depends.

Not much coding, unfortunately (or is it unfortunate, don't know really.. 😛). The fact is, while the Qt Jambi patch is now out and indeed fixed the problem I was having, I haven't found out the motivation to work on the editor. That doesn't mean I've abandoned the project, not at all. I have these periods when I just don't feel like doing much hobby coding, if any. But no worries, some day I find myself hacking at it like no tomorrow! 😉

Guess what has been draining my free time recently? PS3. No kidding. PS3, that black monolith, a product of pure genious (not unlike the monolith in 2001: A Space Odyssey!). That's mostly what's going on here! Oblivion (GOTY edition), GTA IV, Uncharted.. Oh, and the wondrous Blu-ray capabilities!

Speaking of movies (well, technically at least), I finally updated the movie list with latest additions. Unfortunately I had forgotten most of their purchase dates and prices, so I couldn't add those.. Note to self: enter new movies to the "database" in much shorter time span from the purchase than this. I'm also celebrating my first Blu-ray movie, I Am Legend. It was a nice flick and the picture looked awesome even on my 32″ HD-ready TV. Looking forward to having more BRs. ^^ (damn they're expensive, though!)

In other news, I'm still working on my Bacherlor's thesis.. Hopefully I'll get it finished in few weeks tops. That is all for now.

A quick update..

I haven't been coding much, but instead writing my Bachelor's thesis. There's still plenty of work to do before it's finished. Well, serves me right for not starting it earlier in the Summer like I intended to.. 😉

School starts in September again, yawn. The Qt Jambi update I'm waiting for might also happen in Sept.

Oh, I went to see The Dark Knight again – it was even better this time, like I thought it would. 5/5 it is.. 🙂

Why so serious?

Saw The Dark Knight today. Awesome movie! I'm still digesting it, but it feels like a solid *****/***** for me. Now, just waiting for the dvd release.. 🙂

Somewhere Back In Time 2008

Just a short post, for a change: Went to see Iron Maiden yesterday, it was great! \m/ Above is a photo I took – one of the few that actually turned out alright..

In addition, I managed to wash my cell phone in 40 degrees Celcius two days ago. It doesn't work any more. 🙁

Oh, and PolyAnim now has some Java Web Start demos up at http://code.google.com/p/polyanim/wiki/WebStartDemos..