Finally got round to learning how to do post-processing today. I've decided that the increase in minimum spec is worth it. The above water effect is the first thing I've done with this.
It's all hacked together at the moment, but eventually any level can have a given water level, that can be moved up and down. This can either be for Tomb Raider style raising and lowering water levels to solve puzzles, or have Squishy have limited breath and water level that chases him up a level or anything really.
It's a pretty simple shader (edited with Drillian's excellent suggestion below):
sampler tex : register(s0);
float2 coord : TEXCOORD;
vector color : COLOR;
OUTPUT main(INPUT input)
As I want to keep using multi-sampling, I'm having to render to the back buffer, then StretchRect this onto a fixed size render target texture (currently 1024x1024 but I might make this configurable), then render the texture back to the back buffer with the shader enabled.
All good stuff. Probably be some more updates to this post later (as usual) as I'm thinking that once I've integrated this into the game properly, it might be worth looking at making stuff float.
Hmm. Floating is hard to get right. I've got some acceptable underwater behaviour for Squishy but getting debris to float is more tricky. For now, debris sinks but a bit slower than just falling through the air.
You can now trigger the water to raise and lower via the script, so attaching a button to a script gate that calls the appropriate procedure means you can move the water to different levels, also specifying the speed it moves at, which is pretty cool. A lot of the groundwork I've already done, particularly the logic gates and scripting system, is really starting to pay off now.
Going to have to get a demo out soon, see what you lot think.
Oh, I found out today I didn't get that job I went for last week. Never mind. Pinning all my hopes on the interview next Wednesday now.