are features expensive now? - Page 2

are features expensive now?

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: are features expensive now?

Post by jK »

what should that tell us?
zerver
Spring Developer
Posts: 1358
Joined: 16 Dec 2006, 20:59

Re: are features expensive now?

Post by zerver »

Thanks behe. Zooming in renders less features, so feature fading is likely not related to this. Anyway I mantised it.

http://springrts.com/mantis/view.php?id=3061
User avatar
Das Bruce
Posts: 3544
Joined: 23 Nov 2005, 06:16

Re: are features expensive now?

Post by Das Bruce »

FSAA is the same as SSAA?
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: are features expensive now?

Post by Kloot »

yes (FSAA and SSAA are synonyms), and no (Spring uses MSAA)
Beherith wrote:Look at Altored divide remake:

26 fps:
Image
Did you know that:

1) on this screenshot (and this better one), there are 126 features visible?
2) of those 126 features, 63 have 3840 vertices and the remaining 63 have 1472?
3) each of these is being rendered at least twice per frame, both times with textures bound (for the alpha-masked shadows) so your 4xAA is effectively 8xAA?
4) even with MSAA, depth values are still super-sampled (like regular fragments in FSAA/SSAA)?
Last edited by Kloot on 13 Apr 2012, 16:25, edited 1 time in total.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: are features expensive now?

Post by smoth »

Kloot, any ides on WHY it is so slow now? I though that 3x cost jk was talking about was fixed?
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: are features expensive now?

Post by Kloot »

I get the same framerate in 82.7 (~90 to within a variance of ~10, double the amount after /advmodelshading 0) for that viewpoint using the same springrc settings despite all the code changes between 82.7 and 88.0, so I don't understand where this "feature drawing is slow now" sentiment is coming from. As for why that specific situation on Altored is slow, my previous post contains two big hints.
I though that 3x cost jk was talking about was fixed?
No, when and where did you get that idea? He only mentioned it two days ago and the "3x" part refers to some code which only becomes active when zoomed out, so that is not relevant anyway.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: are features expensive now?

Post by jK »

Kloot explained why it is slow and I gave the reason why it is such damn slow. And no it isn't fixed, also zerver's last post gives me the impression my way of solving it would cause again much hate, neither do I see zerver fixing his code ...
Kloot wrote:the "3x" part refers to some code which only becomes active when zoomed out, so that is not relevant anyway.
current code calls glAlphaFunc() for each invisible+fading feature returned by getquad() (means it matters when zoomed in, too!), it is a no-go function for per-instance drawing. glAlphaFunc() causes a lot restructure in the GPU and takes a damn lot of time. Neither are the current glMaterialfv() calls ideal, they change _uniform_ vars. On Nvidia GPUs uniforms are a lot slower (on change) than attributes (glColor, texcoords, ...) and should be avoided on per instance drawing, too.
Kloot wrote:I get the same framerate in 82.7
You would need to compare it with pre-fading-features which where added iirc with 78-79, but there the features won't show I assume (maps are incompatible with such engine builds).
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: are features expensive now?

Post by smoth »

kloot:
"Zoomed out", behe's shots are "zoomed in" to me. It is new because ever since I saw the fps drop, I assumed it was my code. This has been the case for well over a year. I usually tested on the map gunmetal harbor. which heavily uses features. but because I didn't think features were the cause, I just assumed I fixed the bug when I moved to testing gundam on gantelope. I had NO idea that it was because gante has no features. then I came back to gunmetal, saw the fps plummet and started looking outside of gundam. I don't know when or what changed. when I played gundam back in 2010 I was playing with several people in map wide survival matches. Now just running gunmetal with NOTHING going on is at 45fps? that is a bit strange.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: are features expensive now?

Post by Kloot »

glAlphaFunc might not be a big problem when zoomed in because the test-value passed to it is 0.5 and the shadow pass uses the same value --> a smart driver will probably avoid the state change if nothing else calls it.
jK wrote:You would need to compare it with pre-fading-features which where added iirc with 78-79, but there the features won't show I assume (maps are incompatible with such engine builds).
That's true, fading features were committed for http://springrts.com/mantis/view.php?id=1335 / 0.78.2.1 (with https://github.com/spring/spring/commit ... c4b76ce368) but note that the code then neither performed alpha-testing nor material updates and smoth's use of "now" suggested a more recent problem. I also placed a 'return' at the top of FeatureDrawer::DrawFadeFeatures and still had the same performance as without it (when zoomed in).

smoth: what framerates did you usually get on Gunmetal? Would you be willing to verify that with this old (0.77b5) installer?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: are features expensive now?

Post by jK »

Kloot wrote:glAlphaFunc might not be a big problem when zoomed in because the test-value passed to it is 0.5 and the shadow pass uses the same value --> a smart driver will probably avoid the state change if nothing else calls it.
Not that AlphaFunc I mean the one in CFeatureDrawer::DrawFadeFeaturesSet with glAlphaFunc(GL_GREATER, fi->second / 2.0f);
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: are features expensive now?

Post by smoth »

Kloot wrote:smoth: what framerates did you usually get on Gunmetal?
IIRC they were pretty solid, I ran in vsync most of the time back then so mostly it was 59-60fps. In a really large battle, with lots of stuff happening(this was 3-4 players vs 1 spawner) I had bottom 10-35fps.
Kloot wrote:Would you be willing to verify that with this old (0.77b5) installer?
Sure I can try when I get home tonight.

*Edit*
I should also note 2010 I had a dual 3.4 ghz and 8 gigs of ram. Not sure if it relevant
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: are features expensive now?

Post by jK »

Kloot wrote:That's true, fading features were committed for http://springrts.com/mantis/view.php?id=1335 / 0.78.2.1 (with https://github.com/spring/spring/commit ... c4b76ce368) but note that the code then neither performed alpha-testing nor material updates and smoth's use of "now" suggested a more recent problem. I also placed a 'return' at the top of FeatureDrawer::DrawFadeFeatures and still had the same performance as without it (when zoomed in).
Tested it today again, too. Now it doesn't give an significant improvement either :/
Just a few weeks ago Seth2 gave me <40fps with it (and >140fps w/o it), possibly it was related to some system/driver change.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: are features expensive now?

Post by smoth »

settings could not be setup.
Couldn't run the same gundam in old spring.

not able to use that version, sorry kloot.
zerver
Spring Developer
Posts: 1358
Joined: 16 Dec 2006, 20:59

Re: are features expensive now?

Post by zerver »

Kloot wrote:2) of those 126 features, 63 have 3840 vertices and the remaining 63 have 1472?
I did not verify Kloots' numbers, but if they are correct, I would say that this map simply has very advanced features.

An armflash has about 50 vertices so just a single of these trees can equal something like 100 armflash. 10 trees = 1000 armflash etc. Try to spawn 1000 armflash and look at the FPS.

Also, with the alpha masked textures of these features, almost all of the vertices have to be rendered since virtually none are occluded. Even more so when you zoom in.

Terrain only: 220 fps

20 of the worst trees zoomed in: 40 fps
Same trees without alpha masks: 110 fps
Same trees without alpha masks and without depth test: 40 fps

It is apparent that the lowest two figures come from the fact that the system has to render all vertices due to transparency and in my last test due to the disabled depth test.

For comparison
500 armflash, without depth test: 110 fps
1000 armflash, without depth test: 70 fps

Fading features also has a performance hit, but not as big as the one caused by zoom in. The fps drops to about half on my system. The fading will also force the system to render all vertices due to transparency.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: are features expensive now?

Post by smoth »

I was able to play with higher fps years ago on an LESSER machine. Now it is really low. Do you really think the fade is hurting it that much? is there a way to turn it off to test?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: are features expensive now?

Post by FLOZi »

smoth wrote:I was able to play with higher fps years ago on an LESSER machine. Now it is really low. Do you really think the fade is hurting it that much? is there a way to turn it off to test?
On the same map?
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: are features expensive now?

Post by PicassoCT »

i remember when spring was all free - and the moddevs didnt have to pay extra for every feature.
zerver
Spring Developer
Posts: 1358
Joined: 16 Dec 2006, 20:59

Re: are features expensive now?

Post by zerver »

FLOZi wrote:
smoth wrote:I was able to play with higher fps years ago on an LESSER machine. Now it is really low. Do you really think the fade is hurting it that much? is there a way to turn it off to test?
On the same map?
Forget about this specific map and other maps that use the same trees. Are there any other maps with problems?

Fading has zero impact when zoomed in, but I will try to make it configurable anyway.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: are features expensive now?

Post by Beherith »

Its the alpha masking that makes it sooo expensive. Spring can render 500 BAR jammer towers (2k tri's each) at 30 fps. With shadows and AA on.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: are features expensive now?

Post by smoth »

FLOZi wrote:
smoth wrote:I was able to play with higher fps years ago on an LESSER machine. Now it is really low. Do you really think the fade is hurting it that much? is there a way to turn it off to test?
On the same map?
I don't know if I can find that version of gunmetal
Post Reply

Return to “Engine”