ROAM terrain rendering, help us make spring much faster! - Page 2

ROAM terrain rendering, help us make spring much faster!

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

Moderator: Moderators

Post Reply
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: ROAM terrain algorithm implemented!

Post by Tobi » 29 Jul 2009, 09:21

Yay, great work so far :-)
0 x

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

Re: ROAM terrain algorithm implemented!

Post by jK » 29 Jul 2009, 09:29

request:
could you give shorelines a higher/full LOD

btw, do you use indexed vbos know?

and yeah, great work :)
0 x

User avatar
clericvash
Posts: 1394
Joined: 05 Oct 2004, 01:05

Re: ROAM terrain algorithm implemented!

Post by clericvash » 29 Jul 2009, 13:13

So can someone put out in layman terms what this code will do? I mean what are the advantages of this?
0 x

imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: ROAM terrain algorithm implemented!

Post by imbaczek » 29 Jul 2009, 13:21

better fps.
0 x

User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6107
Joined: 29 Apr 2005, 01:14

Re: ROAM terrain algorithm implemented!

Post by FLOZi » 29 Jul 2009, 14:17

clericvash wrote:So can someone put out in layman terms what this code will do? I mean what are the advantages of this?
Performance:
DSD whole map is rendered at 150-200 fps, with no loss of terrain fidelity.
DSD front is rendered at 500 fps.
Answers it pretty well
0 x

Umbra
Posts: 46
Joined: 29 Jul 2009, 14:23

Re: ROAM terrain algorithm implemented!

Post by Umbra » 29 Jul 2009, 14:37

What kind of hardware do you have? And how much of an increase in fps do you have? Also, with 1k peewees running around(and/or by playing a resource heavy replay) how much fps do you have before and after you apply this wondrous feature?

And for those who are just too lazy to compile it themselves, where can one find a download link for this? I remember there being a build server somewhere, but I'm also unsure whether that is what I'm looking for.
0 x

User avatar
Beherith
Moderator
Posts: 4934
Joined: 26 Oct 2007, 16:21

Re: ROAM terrain algorithm implemented!

Post by Beherith » 29 Jul 2009, 15:28

I have an 8800GT, and I had about a double increse in frame rate, with a bit better looking map.
Adding 1k peewees wont change much, since its independent of that.

The real benefit here will probably be for those with weaker GPUs, since they get higher terrain detail at the same load, or less load with the same terrain detail they are used to.

Also, the main advantage for me is that cliffs no longer get warped when viewed from a bit of a distance.

Tobi is working on merging it into buildserv, so you can test it for yourself.
0 x

Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: ROAM terrain algorithm implemented!

Post by Tobi » 29 Jul 2009, 16:05

Pushed merge of master + Beherith's roam branch, as 'roam' to Spring account on github, and fixed some tiny bugs to make it compile on BuildServ.

Binaries can now be found on BuildServ, search for 'roam' in the lists of executables/installers.
0 x

User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Re: ROAM terrain algorithm implemented!

Post by Caydr » 29 Jul 2009, 17:24

Will this strictly reduce the GPU load or will it help the CPU somewhat too? And RAM? VRAM? Anything that reduces Spring's CPU torture what I personally am most interested in. In any case, it's good to see the engine making strides to be more efficient.
0 x

User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: ROAM terrain algorithm implemented!

Post by Argh » 29 Jul 2009, 21:36

Tested it.

Shadowmap projections are hosed (not surprising, that code needs to be rewritten anyhow).

Example 1: ViewRadius 64:

Image

Example 2: ViewRadius 8:
Image


Other than that, it does what it says it does.

Very little FPS improvement, on Unpleasantville (my massive city map for P.U.R.E., with hundreds of World Builder objects, but hey, that was asking for a miracle anyhow, as it's mainly CPU-limited), so I tested again on something with a lower load, and FPS is fairly un-changed, at a ViewRadius of 64.

However, I can lower ViewRadius considerably, with the same perceived quality in OTA POV. I went from 64 to 8, just to test it out, and the final appearance was much the same, although the shadowmap became more and more goofy.

I saw some other things that were troublesome, though. It appears that groundscars / groundplates are using a full-resolution version of the heightmap (you can't see it in wiremap) instead of the ROAM'd version. This probably accounts for a lot of the "no change". I think that we're going to have to change the way they operate, and have them get the ROAM'd triangles they intersect with, for full fidelity and a much lower cost.

And for future uses, it is probably necessary to have Lua callouts that can get a set of triangles from any rectangle, x,y, so that future attempts to build things like animated decals, etc., can run at a much-reduced cost.
0 x

User avatar
Beherith
Moderator
Posts: 4934
Joined: 26 Oct 2007, 16:21

Re: ROAM terrain algorithm implemented!

Post by Beherith » 24 Sep 2009, 18:59

With many thanks to Lupus and BrainDamage, we did quite some work on ROAM.
Currently it renders entire DSD at 700 fps, with higher visual quality than old spring.
We made a tesselation algorithm, that splits each 128*128 heightmap block into 2 triangle strips, in linear time, using 2n+2 vertexes per N tris.

So, we can finally see the light shining at the end of the tunnel...
0 x

User avatar
KaiserJ
Community Representative
Posts: 3113
Joined: 08 Sep 2008, 22:59

Re: ROAM terrain algorithm implemented!

Post by KaiserJ » 24 Sep 2009, 19:04

i'm far too stupid to understand what you're doing...

...but im smart enough to understand the magnitude! awesome work.
0 x

User avatar
smoth
Posts: 22298
Joined: 13 Jan 2005, 00:46

Re: ROAM terrain algorithm implemented!

Post by smoth » 24 Sep 2009, 19:04

sounds awesome man!
0 x

User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: ROAM terrain algorithm implemented!

Post by Argh » 24 Sep 2009, 19:05

Great, glad to hear it's made progress, can't wait to test the next versions :-)
0 x

User avatar
Beherith
Moderator
Posts: 4934
Joined: 26 Oct 2007, 16:21

Re: ROAM terrain algorithm implemented!

Post by Beherith » 24 Sep 2009, 23:55

Ok, did more optimizations, now I hit 1k fps with whole map rendered, and 2k with DSD front (totally flat) rendered. This is ofc with shadows, reflections and AA off.

One of the optimizations is that if the camera doesnt move, then it only pushes the pre-generated tri strip to gpu and nothing else. If the camera is moving, then it re generates everything, dropping fps by about 30%. I would like to hook the regeneration into slowupdate anyway.

Also, I would like to enlist your help, if anyone is willing. There is a flickering issue. Its semi-deterministic, but I dont know the engine well enough to pinpoint it.

Right now, everything is statically allocated (sue me) So it uses 50mbytes more memory on dsd than vanilla spring.

github link: http://github.com/Beherith/spring/tree/roam

Drop-in test executable: http://beherith.eat-peet.net/stuff/springroam.exe

EDIT: drop in .exe now fixed, no flickering!
0 x

User avatar
MidKnight
Posts: 2650
Joined: 10 Sep 2008, 03:11

Re: ROAM terrain rendering, help us make spring much faster!

Post by MidKnight » 25 Sep 2009, 04:32

Very nice! I tried it and, at least for me, the flickering seems to be a bumpwater issue, the seizure-inducing effect wasn't present on other water modes.It also seems to become less common on lower viewradii.

Keep up the good work! :-)

PS: my personal tests:
CA, Commanders script, Conquest of Paradise, reflective water, ATi 4870, AA 16x.
18-20 whole map, ROAM
12-15 whole map, normal
0 x

User avatar
Beherith
Moderator
Posts: 4934
Joined: 26 Oct 2007, 16:21

Re: ROAM terrain rendering, help us make spring much faster!

Post by Beherith » 25 Sep 2009, 10:05

MidKnight, that is not a really representative test, because shadows and reflections still use the old rendering algo, and 16x AA can be taxing for the gpu.

We still desperately need help on the flickering issue :(

Edit: Some people seem to have issues with their gpu not obeying glDisable(GL_CULL_FACE)
(it looks like tris missing from the map)
If this error happens for you, please report.
0 x

User avatar
maxymili
Posts: 6
Joined: 01 Jul 2009, 12:00

Re: ROAM terrain algorithm implemented!

Post by maxymili » 25 Sep 2009, 12:38

FLOZi wrote:I think I'm falling for you, Behe.

Image
You are drinking Zobrowka with banana juice? Are you crazy?
Only way its Apple juice to drink with with Zobrowka!!!

I must tell you now:
[ZXC] Zobrowka Xtra Club 8)
0 x

User avatar
Beherith
Moderator
Posts: 4934
Joined: 26 Oct 2007, 16:21

Re: ROAM terrain algorithm implemented!

Post by Beherith » 25 Sep 2009, 12:48

maxymili wrote:
FLOZi wrote:I think I'm falling for you, Behe.

Image
You are drinking Zobrowka with banana juice? Are you crazy?
Only way its Apple juice to drink with with Zobrowka!!!

I must tell you now:
[ZXC] Zobrowka Xtra Club 8)
Have you ever tried to juice a banana? Its not really possible...
And thats apple cider on the picture, apple juice with pulp.

On topic:
I pushed rudimentary shadow rendering, It draws the shadow map with the same resolution as it draws terrain, resulting in a heavy (almost half) fps drop.

On the flickering bug: Its very strange, I find that the bug doesnt appear when I force retessellation on every frame... You can set that by forcing
framchanged var to true in inline void CBFGroundDrawer::AdvDraw(int bty)
0 x

Kloot
Spring Developer
Posts: 1865
Joined: 08 Oct 2006, 16:58

Re: ROAM terrain rendering, help us make spring much faster!

Post by Kloot » 25 Sep 2009, 13:50

Triangle windings seem to be messed up (they need to be alternated when creating strips), and there are holes in the mesh:
Could you describe your stripping algorithm in high-level terms?
0 x

Post Reply

Return to “Engine”