I love the motion blur effect in Penumbra: Overture, but I felt like it lowered the FPS more than it should, so I got to poking around in the resources in the demo and found the shader in redist\core\programs\PostEffect_Motion_fp.cg, and after a little tweaking I came up with this:
void main(float4 inPos : WPOS, //in projection space
  float4 inVtxPos :TEX0,
  float4 inPrevVtxPos :TEX1,
             Â
  out float4 oColor : COLOR,
         Â
  uniform samplerRECT screenTex : TEXUNIT0,
  uniform float2 halfScreenSize)
{
float2 wpos = inPos.xy;
float2 p1 = inVtxPos.xy / inVtxPos.w;
float2 p2 = inPrevVtxPos.xy / inPrevVtxPos.w;
float2 velocity = (p2 - p1) * halfScreenSize;
//Sample into scene texture along motion vector
const float samples = min( max( 1, ceil( max( abs( velocity.x ), abs( velocity.y ) ) / 2 ) ), 16 );
const fixed w = 1.0 / samples;Â Â // weight
const float2 s = velocity / samples; // step
fixed4 a = 0;
for(float i=0; i<samples; i+=1)
{
a += texRECT(screenTex, wpos) * w;
wpos += s;
}
oColor = a;
}
Just open PostEffect_Motion_fp.cg in Notepad and replace its contents with the above (
back up your original first, just in case).I didn't do any real testing, but the framerate
feels smoother with this shader anyway, and the end result is exactly the same. Basically I just removed a division and multiplication from the for loop, and made the number of blur samples dynamic based on the amount of motion at the current fragment.
I also like a little stronger blur effect, so I turned up the MotionBlurAmount value in the settings.cfg file some too.
I hope the devs don't mind me posting this - I just found it smoothed out my experience, and thought other P:O fans might like it too.
I'm looking forward to buying and playing Penumbra: Overture tomorrow!