Sunday, March 7, 2010

Water!

Challenge: to get good-looking water into my game in one week.

The game I'm working on with my team at DigiPen is called Runeshift. It's a relaxing slide-puzzle computer game. I want to put water in the 2nd level, because I think it would be a pleasing backdrop. However, the semester is already half-way over, so if I can't get it in quickly, it threatens to eat up time better spent on polishing what we've already got.

Therefore, I need a quick and dirty way of rendering water. Actually, I've been researching methods of simulating real-time water on the side now for nearly a year. It's a subject that fascinates me. So, I have an idea of what to do. Kjell Andersson makes an awesome real-time caustics generator that creates animated textures that are both tileable and loopable. The interface has tons of options, like how many frames per animation, what resolution, what background color to use, and then lots of slider bars for adjusting the caustics patterns themselves. (Caustics are the patterns of light created by reflection and refraction with an uneven surface, as in water ripples.) For my first iteration, I simply loaded the bitmap frames of a black and white caustics animation and rendered them blended with a color, so that I could easily adjust the color of the water in my water shader. It worked surprisingly well:

One noticeable problem is that the puzzle blocks don't look like they are sitting in the water but sort of floating above it, because the water isn't transparent:

So, my first mission: transparent water!

No comments:

Post a Comment