OR fps taking a dive Oh no, not again...
#16
Posted 01 May 2013 - 05:31 AM
#17
Posted 01 May 2013 - 07:07 AM
But still, i think the best solution for performance problems would be the draw call batching/ or new 3d engine. It's clearly vistible from the examples above, that always the render thread limits the overall performance of the game.
#18
Posted 01 May 2013 - 07:39 AM
disc, on 01 May 2013 - 07:07 AM, said:
Yes, it is one of many options. However, a large portion of Open Rails's rendering time (which you correctly note below is often the limiting factor) is spent in native calls already. Almost all native execution time is spent in the draw calls and related calls in to XNA (which then calls DirectX directly). It's not completely clear how much of the time is spent in interop (the work needed for .NET to call native) and how much is in DirectX and the graphics drivers, but I believe it is actually weighted towards the latter.
It is because of this that I don't believe replacing any part of the rendering pipeline with native versions will, in itself, make a worthwhile difference in performance. However, if anyone has actual data regarding this, I'd certainly be interested in seeing it.
We have, though, been looking at newer versions of XNA (i.e. 4.0) and alternatives (e.g. ANX) as well as non-XNA-like solutions (e.g. SharpDX) to see if the performance of the calls is a factor of the CLR (.NET) version, XNA version, XNA vs. alternatives or intrinsic to DirectX.
disc, on 01 May 2013 - 07:07 AM, said:
Some of the ways the engine appears to work is due to MSTS's poorly thought-out content, i.e. shapes will regularly use a whole swathe of different textures that could have - if anyone had been bothered - been turned in to a single texture atlas (or maybe two, for alpha blended and opaque). Unless we, in OR, dynamically do texture atlasing (which isn't going to be much fun) the way these MSTS shapes are drawn in so many bits is mostly fixed.
Regarding "draw call batching", there's some confusion of what this phrase means, it seems. One definition is just about the order draw calls are done: Open Rails already puts all the draw calls for the same material (texture + state) together and only initialises the shader once, so it satisfies this definition already. On the other hand, if you mean something more like "display lists" (as I think OpenGL calls them) or "command buffers" (as DirectX calls them), where by the application makes only 1 call, that's another story. I am very interested in any ability to do display lists/command buffers. I have not seen anything intrinsic to XNA for doing them, though, but there are things that might be interesting to try, like Parallel Rendering with DirectX Command Buffers.
#19
Posted 01 May 2013 - 10:34 AM
Here are my further findings during experimenting (mostly registry stuff for "unofficial" settings): ShadowAllShapes enabled (I forgot to mention above, that I always have it enabled) I get at First Street Yard, LA, on the Surfliner2...
- ~19 fps, if: ShadowMapBlur 1, ShadowMapCount 4, ShadowMapResolution 1024 (all the default settings)
- ~28 fps, if: ShadowMapBlur 0, ShadowMapCount 2, ShadowMapResolution 1024 (however, this turns out to look "like the southern end of a northbound husky", as Genma Saotome once called an ugly steam engine :) )
- ~ 26fps, if: ShadowMapBlur 0, ShadowMapCount 2, ShadowMapResolution 2048 (looks a bit better)
- ~ 25 fps, if: ShadowMapBlur 0, ShadowMapCount 3, ShadowMapResolution 1024 (about same as above)
- ~ 24 fps, if: ShadowMapBlur 0, ShadowMapCount 3, ShadowMapResolution 2048 (looks again a bit better, is the compromise I now found)
#20
Posted 01 May 2013 - 11:33 AM
James Ross, on 01 May 2013 - 07:39 AM, said:
Of course a lot is depending on the content, but if there are 1000 identical trees in the view for example, and if those could be drawn by a single draw call, that would make a big difference.
About the tests: I thought that ShadowMapCount is controls shadow map "LODs", so if 4 is set and 2048*2048 shadowmapResolution is set, then there will be a 2048x2048 map for the closest objects, 1024x1024 for more distant, 512 even more distant, and 256x256 for the most distant objects. So lowering this would cause performance impact, but the opposite happens. So what is is that ShadowMapCount?
#21
Posted 01 May 2013 - 12:10 PM
disc, on 01 May 2013 - 11:33 AM, said:
I also thought so at first, but then, why not try, and look what it did :) And yes, I would also like to know that (obviously forgot to add it in the post above...)
#22
Posted 02 May 2013 - 11:38 AM
disc, on 01 May 2013 - 11:33 AM, said:
That's not quite how it works; it generates each shadow map at the same resolution (e.g. 1024x1024) but each subsequent one covers a much larger area from the camera. Reducing the number of shadow maps should increase performance, as should lowering their resolution.
#23
Posted 02 May 2013 - 12:06 PM
#24
Posted 02 May 2013 - 01:05 PM
markus1996, on 02 May 2013 - 12:06 PM, said:
The blurring is, I believe (it was a while ago that I implemented this) to soften the edges of the shadows to avoid sharp jaggy edges. I'm not really sure what the difference looks like in the game today though...
#25
Posted 03 May 2013 - 02:18 AM
James Ross, on 02 May 2013 - 01:05 PM, said:
it's still needed for that reason, however it blurs too much. 1024 or above the shadowmaps aren't so jaggy. so blur intensity could be reduced.
#26
Posted 03 May 2013 - 04:41 AM
#27
Posted 15 May 2013 - 07:26 PM
#28
Posted 26 May 2013 - 06:47 AM
:furiousPC:
#29
Posted 27 May 2013 - 09:17 AM
#30
Posted 27 May 2013 - 09:38 AM
Cheers, Markus