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

Author Topic: Moving camera around, everything is getting a motion blur effect, how to remove?  (Read 6682 times)

0 Members and 3 Guests are viewing this topic.

BaneTrapper

  • Full Member
  • ***
  • Posts: 213
  • Do you even see this, i dont need it.
    • View Profile
    • Email
Hello, unsure if this is correct place to post this because i am unsure is this hardware or sfml related.
So to explain my issue the best i will first describe when it occurred.

I have a screen filled with map(as walkable terrain, grass), on this map there are sprites like barrel, houses and other stuff related.

The issue starts when i move camera, everything gets motion blur or like 60-75% transparency and is drawn again where it used to be before this loop, tried to get screenshot so many times but i failed every single time.

I do not understand what is the issue here, its like the old buffer got drawn again but with 60-75% transparency this time.
I do only have one display() call to render window and i am hoping you got some idea what i can do to turn it off.

What IMO i need to modify is GL states, turning off AntiAliasing and other shader effects, but i am no expect and i may be mistaken massively.
« Last Edit: October 06, 2013, 09:34:11 pm by BaneTrapper »
BaneTrapperDev@hotmail.com Programing, Coding
Projects: Not in development(unfinished/playable):
http://en.sfml-dev.org/forums/index.php?topic=11073.msg76266#msg76266
UP and in Development: The Wanderer - Lost in time
http://en.sfml-dev.org/forums/index.php?topic=14563.0

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Could you show us a complete and minimal code example?

Also I don't believe antialiasing is a shader effect.  You can set a maximum AA level using the optional ContextSettings parameter when creating your window.  Though it probably isn't the problem.

BaneTrapper

  • Full Member
  • ***
  • Posts: 213
  • Do you even see this, i dont need it.
    • View Profile
    • Email
The effect occurs on anything being drawn.
Drawn a single rectangleShape on a black background and i got the same behavior.
I also
Code: [Select]
sf::ContextSettings constSetting = sf::ContextSettings();
constSetting.antialiasingLevel = 0;
constSetting.depthBits = 32;
constSetting.majorVersion = 0;
constSetting.minorVersion = 0;
constSetting.stencilBits = 0;
renWin.create(vidMod, string, style, constSetting);
Same issue.
BaneTrapperDev@hotmail.com Programing, Coding
Projects: Not in development(unfinished/playable):
http://en.sfml-dev.org/forums/index.php?topic=11073.msg76266#msg76266
UP and in Development: The Wanderer - Lost in time
http://en.sfml-dev.org/forums/index.php?topic=14563.0

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Try to activate v-sync.
Laurent Gomila - SFML developer

BaneTrapper

  • Full Member
  • ***
  • Posts: 213
  • Do you even see this, i dont need it.
    • View Profile
    • Email
With VSync it is still there, my GPU has VSync set to "Controled by application"
Withot VSync its still there unchanged, but allot of screen tearing occurs.

On my GPU i set all setting off or to lowest possible and the issue was still there.
I also tryed setting GPU to application control and all to maximum the issue is still there.

I will post minimal code soon.

EDIT::
It is getting so complicated about code, i am unable to reproduce the issue with sfml shapes.
I have complex way of holding/rendering.
Still working on it.
« Last Edit: October 07, 2013, 11:29:28 pm by BaneTrapper »
BaneTrapperDev@hotmail.com Programing, Coding
Projects: Not in development(unfinished/playable):
http://en.sfml-dev.org/forums/index.php?topic=11073.msg76266#msg76266
UP and in Development: The Wanderer - Lost in time
http://en.sfml-dev.org/forums/index.php?topic=14563.0

BaneTrapper

  • Full Member
  • ***
  • Posts: 213
  • Do you even see this, i dont need it.
    • View Profile
    • Email
I tried getting a screen shot, tried recording it, researched and have not accomplished what i wanted.
I am unable to provide you with input of what i am experiencing, i will provide with .exe file, that is the only thing i can think off.


Pretty please can you help me, i need you to test if in game moving around produces the same effect of (leaving a veig trail of itself with 75% transprency) because i am feeling missurable right now.

I got media file upload link Pretty please test it out for me:
http://www.mediafire.com/download/q2f8k4i2xumgf9c/Test.zip

1:When you start application its gonna prompt a intro that ends in about 1-2 sec.
2:Press new game.
3:Navigate right down(intro open area) using W,S,A,D keys.
4:Pressing left mouse button add dozen "sheep".
5:Now MOVE! see if the sheep leave that pesky blurry effect behind them, if they do! press E or Space to destroy them, and bring me your report.

Protip: Its best visible when moving diagonally.
« Last Edit: October 08, 2013, 12:47:35 am by BaneTrapper »
BaneTrapperDev@hotmail.com Programing, Coding
Projects: Not in development(unfinished/playable):
http://en.sfml-dev.org/forums/index.php?topic=11073.msg76266#msg76266
UP and in Development: The Wanderer - Lost in time
http://en.sfml-dev.org/forums/index.php?topic=14563.0

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
I am seeing a small blur, but I think it is coming from an optical illusion, not from anything your code is doing. Consider it motion blur  ;)
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
I'm also seeing a little blur on the sheep, but like zsbzsb I'm not convinced it's a real problem.

I'd be far more worried about the extremely obvious screen tearing you see whenever the character moves left or right.  The lines between terrain tiles can be torn up to a dozen pixels.

Also when I type in my browser with your program running in the background, it randomly flickers every second or two, sometimes showing me an extremely huge sheep for some reason.  It's like it's trying to jumpscare me.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
I'd be far more worried about the extremely obvious screen tearing you see whenever the character moves left or right.  The lines between terrain tiles can be torn up to a dozen pixels.

Also when I type in my browser with your program running in the background, it randomly flickers every second or two, sometimes showing me an extremely huge sheep for some reason.  It's like it's trying to jumpscare me.

Weird, I got no screen tearing. But I can explain the huge sheep randomly jumping out at you. Whenever you press the space bar it will zoom in the view (expected). The problem is that BaneTrapper is using real-time input and that means even when the game doesn't have focus it is still detecting the space is pressed.
« Last Edit: October 08, 2013, 01:29:08 pm by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

BaneTrapper

  • Full Member
  • ***
  • Posts: 213
  • Do you even see this, i dont need it.
    • View Profile
    • Email
The blur does not seem like an issue thanks  :)

Space(zoom) is currently ongoing a testing phase that's why its real time event.

Its poking me because, Units are moving and they are not creating it.
View is moving and everything gets that blur.
BaneTrapperDev@hotmail.com Programing, Coding
Projects: Not in development(unfinished/playable):
http://en.sfml-dev.org/forums/index.php?topic=11073.msg76266#msg76266
UP and in Development: The Wanderer - Lost in time
http://en.sfml-dev.org/forums/index.php?topic=14563.0

Sub

  • Full Member
  • ***
  • Posts: 159
    • View Profile
Weird, I got no screen tearing.

I actually got extremely bad screen tearing.  It looked like there was a drastic FPS drop, but the fps was apparently a constant 60, so I'm not sure what that's about.

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
@BaneTrapper: I'd kinda like to see the source code to that and fiddle around with it, since I'd really like to know what on Earth was causing the tearing.

BaneTrapper

  • Full Member
  • ***
  • Posts: 213
  • Do you even see this, i dont need it.
    • View Profile
    • Email
Weird, I got no screen tearing.

I actually got extremely bad screen tearing.  It looked like there was a drastic FPS drop, but the fps was apparently a constant 60, so I'm not sure what that's about.
Ive noticed that at set "Screen resolution" and VerticalSync set on, on some systems the screen tearing occurs.
What i have noticed is that "Screen resolution" is not valid for their system (but it shouldn't mother since its not fullscreen) well one case i had one person help me test it.
I have made code so that it checks if the screen resolution is valid.
If valid apply the default one.
Else check witch screen resolution that is the least bigger is valid and apply that and there would be black borders.
And with that the tearing was gone, so if i add that i fixed the error.

About the code request:
I save each build i make. Each build is made each time i finish/start programing so there is allot of builds.
The issue is that i do not know witch build this error was occurring at, and i messed with the renderWindow and openGL states before and after so the code may be incorrect.

I suggest open a new thread for this issue, (The windows saves witch date/time the file was modified) by that i can check when first post was made and i will get you the code very close to the time of the post.

CODE
Code: [Select]
//"Control.h"
const bool WINDOW_FPS_CAP = false;
const int WINDOW_FPS_CAP_AMOUNT = 60;
const bool WINDOW_VSYNC = true;
const int WINDOW_WIDTH = 800;
const int WINDOW_HEIGHT = 600;
const int WINDOW_BPP = 32;

//"time.h"
#include <SFML/System.hpp>
class Time
{
public:
Time();

void UpdateLoopTime();

int timePerLoop;
int dt;
private:
sf::Clock mainClock;
};
//"time.cpp"
Time::Time()
{
timePerLoop = 0;
dt = 0;
}

void Time::UpdateLoopTime()
{
dt = mainClock.getElapsedTime().asMilliseconds();
if(dt < 0)
dt = 1;
else if(dt > 50)
dt = 50;
timePerLoop = mainClock.restart().asMilliseconds();
}

//"FPS.h"
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>

class FPS
{
public:
FPS(sf::Font & font);

void Update();
void Display(sf::RenderWindow & renWin);

private:
sf::Clock clock;
sf::Text txt;
int loopAmount;
int totalAmount;
};
//"FPS.cpp"
FPS::FPS(sf::Font & font)
{
loopAmount = 0;
totalAmount = 0;
txt.setFont(font);
txt.setCharacterSize(12);
txt.setColor(sf::Color::White);
txt.setPosition(0, 0);
txt.setString("FPS:0");
}

void FPS::Update()
{
loopAmount ++;
if(clock.getElapsedTime().asMilliseconds() > 1000)
{
clock.restart();
totalAmount = loopAmount;
loopAmount = 0;
txt.setString("FPS:" + std::to_string(totalAmount));
}
}

void FPS::Display(sf::RenderWindow & renWin)
{
renWin.draw(txt);
}

//"Window.h"
class Window
{
public:
Window(int Width, int Height, int BPP, std::string string = "", int style = sf::Style::Default);

sf::VideoMode vidMod;
sf::RenderWindow renWin;

private:
void CreateWindow(std::string string, int style);
};
//"Window.cpp"
Window::Window(int Width, int Height, int BPP, std::string string, int style)
{
vidMod.width = Width;
vidMod.height = Height;
vidMod.bitsPerPixel = BPP;

CreateWindow(string, style);
}

void Window::CreateWindow(std::string string, int style)
{
sf::ContextSettings constSetting = sf::ContextSettings();
constSetting.antialiasingLevel = 0;
constSetting.depthBits = 32;
constSetting.majorVersion = 0;
constSetting.minorVersion = 0;
constSetting.stencilBits = 0;
renWin.create(vidMod, string, style, constSetting);

//If cap fps then cap fps
//else if VSync true then VSync on
if(WINDOW_FPS_CAP == true)
{
renWin.setFramerateLimit(WINDOW_FPS_CAP_AMOUNT);
}
else if(WINDOW_VSYNC == true)
{
renWin.setVerticalSyncEnabled(true);
}
}

//"main.cpp"
int main()
{
//Creation of objects
Window objWindow( WINDOW_WIDTH, WINDOW_HEIGHT, 32, "YoFat^^", sf::Style::Default);
Camera objCam(objWindow.renWin);
Time objTime;
FPS objFPS(objFon.arial);
...
//Main loop
{
objTime.UpdateLoopTime();//Delta time
objFPS.Update();
//Logic, drawing...
objCam.SetViewDefault();
objFPS.Display(objWindow.renWin);//Fps draw
objWindow.renWin.display();
objWindow.renWin.clear();
}

If you want to contact me send me a message...
« Last Edit: October 11, 2013, 12:26:54 pm by BaneTrapper »
BaneTrapperDev@hotmail.com Programing, Coding
Projects: Not in development(unfinished/playable):
http://en.sfml-dev.org/forums/index.php?topic=11073.msg76266#msg76266
UP and in Development: The Wanderer - Lost in time
http://en.sfml-dev.org/forums/index.php?topic=14563.0

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
If you've already fixed it then don't worry about it.  Not worth digging through outdated code just to satisfy my curiosity.