Comments (11)
What operating system are you running on?
from urho3d.
I'm on windows 7
from urho3d.
Ok, then it's not the file watcher which has been known to cause framerate problems on OSX.
Your example scene has extreme fillrate consumption and consequently variance in framerate when one moves near all the shadowed pointlights in the center of the scene. A scene such as that can not be expected to run well.
Do you experience the same issue in more "balanced" scenes, like in the examples 07_BillBoards or 12_PhysicsStressTest? Also what happens if you turn on vsync (-v parameter)? If you turn on the profiler display (F2 key in the examples) are there any obvious constant or periodic time hotspots? And just to make it absolutely sure, are you running a release or relwithdebinfo build?
One possible cause is the lack of timestep smoothing. Basically Urho3D uses the elapsed time of previous frame to find out the timestep for the next frame, which leads to uneven motion when there are alternating "fast" and "slow" frames.
from urho3d.
Yes, it's not balanced, It was created just to reproduce the problem, which happens on my game scene (80 fps, 30k triangles, and camera is fixed to moving object, so the snap is even more visible)
I'm building on release.
The 07_BillBoards example runs fine, until frame rate drops down when I go near rotating smoke. Then I have about 45 fps and it is jerky again - about every second there is a snap (I see it looking at moving lights and rotating clouds). I believe that the snap always occurs, but it is more visible when frame rate is lower.
I tried various combinations with vsync and it doesn't have any influence.
I also tried to record the video with fraps but unfortunetaly when I record then it solves the issue :)
So I recorded a video by phone camera. Look closely at moving box and you will be able to see 3 or 4 snaps, one after the other every second(look very, very closely on the cube)
http://www.youtube.com/watch?v=KDKhv5cioOM
from urho3d.
Ok, I just printed timestep every update. here is the output:
https://docs.google.com/spreadsheet/ccc?key=0AuFH5cooowQpdHNlcFNwRTBYOWViNU1ndWgxR2pSZHc&usp=sharing
So, fps was about 86 so it happens every second as you see in this spreadsheet. Like you said, it was due to inconsistent timestep value. There is one longer update and than 3 very fast frames. What are possible fixes for that? Do you think that taking an average form last 10 time steps(or something like that) and sending it as next time step good enough?
And another question is why is that happening?
from urho3d.
Maybe you could use linear interpolation of the movement using a Lerp function:
http://en.wikipedia.org/wiki/Linear_interpolation
I have also found this Curve(newvalue,oldvalue,steps) to be quite useful to smooth irregular movement:
typedef double flt;
flt Curve(flt newvalue, flt oldvalue, flt increments)
{
int sign;
flt slip;
sign=sgn(oldvalue-newvalue);
slip=(oldvalue-newvalue)/increments;
oldvalue-=slip;
if(sign!=sgn(oldvalue-newvalue)) return(newvalue);
return(oldvalue);
}
from urho3d.
Yes, flying close to the smoke billboards is a good way to reproduce the timestep issue.
There are two things interacting here:
- The lack of timestep smoothing
- The buffering of whole graphics frames by Direct3D. It has the ability to buffer all draw commands for up to 3 frames, which makes that frames "complete" very fast even though the GPU has not drawn everything, until the buffer becomes full and the Present() function will stall until drawing is complete.
I'll add at least configurable simple lowpass filter for the timestep. Basically, take some amount of the new timestep and some amount of the old.
I'll also see if a Direct3D query each frame to flush the GPU buffer should be re-introduced (that used to be in the Graphics subsystem.) It will also help to minimize input latency, but can decrease performance a little as the GPU will stay idle some part of the frame, so it can't be on by default.
Finally, I will check if there's a 1 second periodic task occurring in Urho3D, but there shouldn't be any. It could also be some background process on your system, which periodically consumes processing power.
from urho3d.
Thanks Lasse, it works great when I set timeStepSmoothing to 20. When it's 10 then the snap is barely visible. I had also problem with first frames when smoothing was enabled, the first frames were very fast and first half of second after running the program was like fast forward. So, I disabled smoothing until last timesteps vector is full and created pull request if you would like to accept my changes.
from urho3d.
I've merged the pull request, thanks! Still have to investigate whether it's worth it to bring back the GPU flush mechanism.
from urho3d.
Added back Graphics::SetFlushGPU() feature, which may help to smooth constant timestep jitter. As it potentially degrades performance, default off. Now I believe what can be done to fix this issue has been done.
from urho3d.
Nice work! With flushGPU enabled there is no snap visible. However, I will stay only with smoothing timestep, witch gives me about 1 ms performance boost per frame, compared to flushGPU solution. Thanks.
from urho3d.
Related Issues (20)
- Lua Sample 12 coroutine usage HOT 1
- Crash in UI::Update() HOT 3
- ios crash HOT 1
- Dropping 32 bit support HOT 6
- Dropping DirectX 9 support
- Segfault on SetModel in headless mode HOT 4
- Dropping macOS support HOT 4
- DropDownList displayed element is not vertically centered HOT 1
- SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS always 0 when build 32-bit version of the engine on 64-bit Linux Mint HOT 5
- Non-Master AnimatedModel Removing Skeleton
- Dot at the end of a doxygen comment HOT 7
- Error building on Windows + MSYS + MinGW-W64 HOT 1
- Dockerize-web broken HOT 2
- Not building on arch Linux. HOT 3
- Toolset Visual Studio 2022 (v143) поломан HOT 12
- Не работает превью ресурсов в редакторе HOT 13
- Использовать нижний регистр для файлов HOT 2
- Build failes on (Void) Linux with make HOT 6
- -gl2 поломан
- Малая понятность CMake скриптов
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from urho3d.