Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - snowy2

Pages: [1]
1
Graphics / PostFX motion blur code snippets/tutorial
« on: June 04, 2010, 04:56:40 pm »
Hmmm motion blur occurs only in debug build. In release, the blur effect is not visible at all. However, if I temporarily hard code the sfx file by multiplying the blurred texture component with 1, the effect is seen albeit with full opacity. Any ideas? Maybe I'm clearing and copying the image in the wrong orders? Frame rate related?

Code: [Select]

sf::PostFX Effect;
if (!Effect.LoadFromFile("blur.sfx"))
return EXIT_SUCCESS;

// Setup the effect parameters
Effect.SetTexture("framebuffer", NULL);


// image for postfx motion blur blending
sf::Image image;
 
// Start game loop
while (App.IsOpened())
    {
// Game logic, moving stuff
...

        // First clear screen
App.Clear();

// Draw postfx motion blur first
App.Draw(Effect);

// Draw game stuff
...

// Copy window contents as image, set the texture and apply blurriness
image.CopyScreen(App);
Effect.SetTexture("blurred", &image);

// Draw hud overlays
...

      // Finally display window contents on screen
        App.Display();
}



blur.sfx
texture framebuffer
texture blurred

effect
{
vec4 c0 = framebuffer(_in);

_out = (c0 * 0.5f) + (blurred(_in) * 0.5f);
}

2
Graphics / PostFX motion blur code snippets/tutorial
« on: May 29, 2010, 06:16:42 pm »
I'm trying to implement pixel motion blur. Does anyone have any code snippets or links to resources that demonstrate how to do this via PostFX? Any help much appreciated.

Just to clarify... I'm trying to do the quick and dirty 2d motion blur by saving the last frame's buffer, reducing the alpha and blending it with the current frame.

update:
Ah, found out a quick way to do it. I simply CopyScreen() the window contents and SetTexture() just before clearing the screen.  The fragment shader code just blends the two textures (framebuffer and last frame) together. Then Draw() the effect as usual.

Pages: [1]
anything