Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Areas where there are a lot of caves and tunnels underground harm FPS (improve occlusion culling) #4553

Closed
Megaf opened this issue Sep 27, 2016 · 25 comments
Labels
@ Client / Audiovisuals Not a bug The behaviour is working as intended and won't be changed Performance

Comments

@Megaf
Copy link
Contributor

Megaf commented Sep 27, 2016

Hi everyone. I believe this is a bug know by some people already and I was surprised to see that yet nobody had reported it.

Basically, in areas where we have a complex network of tunnels underground for example, the client will experience a huge framerate drop.

On my own server for instance, at spawn the FPS can get as low as 6 FPS whereas around 100 nodes away from spawn, in areas that don't have underground tunnels but do have buildings, signs and homedecor the FPS can reach 30+ FPS.

I believe this might be caused partially by the way the engine works, making a block full of caves heavier to render than one without. But I don't understand why. I wonder if there is any fix or work around for this issue.

@paramat
Copy link
Contributor

paramat commented Sep 27, 2016

There's a related issue somewhere, the caves are not actually occlusion culled.

@Megaf
Copy link
Contributor Author

Megaf commented Sep 28, 2016

@paramat This? #2307

@paramat
Copy link
Contributor

paramat commented Sep 28, 2016

No it's to do with another issue of how MT does occlusion culling, someone rendered everything as wireframe and saw that caves were still present.
See #4091

@paramat paramat added the Non-trivial A large amount of work is required to address this (sometimes to the point of being infeasible) label Sep 28, 2016
@Fixer-007
Copy link
Contributor

Fixer-007 commented Sep 28, 2016

Those are probably within the same mapblock (16x16x16), culling works on mapblock level iirc.

@Megaf
Copy link
Contributor Author

Megaf commented Sep 29, 2016

 paramat added the Non-trivial label 9 hours ago

Oh no, not that label!
So, could maybe reducing the size of mapblock be a workaround? (On new servers, since we can't change that after the world was created).

@paramat
Copy link
Contributor

paramat commented Sep 29, 2016

We can't change mapblock size, it's so fundamental.
Better to improve how MT does occlusion culling.
Much of this issue may be due to low-power hardware you may be using. Forests have complex meshes too that must have a similar effect, but are not so easy to cull.

@rubenwardy
Copy link
Member

I remember reading an article about how someone decided how to cull caves in a voxel environment, but I forget the link name. It's was posted on the forum ages ago

@Megaf
Copy link
Contributor Author

Megaf commented Oct 1, 2016

@rubenwardy
Copy link
Member

That's it

@Fixer-007
Copy link
Contributor

done by minecraft portable edition developers...

@paramat
Copy link
Contributor

paramat commented Oct 29, 2016

That method may improve culling efficiency, but at what cost? it has to do flood fills for every mapblock.

@Fixer-007
Copy link
Contributor

This may improve the situation: #4724

@lhofhansl
Copy link
Contributor

lhofhansl commented Nov 4, 2016

Oh yeah in caves it should reduce the number of blocks fetched from the server from d^3 = 8r^3 to 4/3pi * r^3 ~ 4.2r^3 (so almost by 2)... Plus the culling improvements.
(I need to validate these number experimentally)

@Megaf
Copy link
Contributor Author

Megaf commented Sep 24, 2017

Folks, any new update on solving this?
@paramat @rubenwardy @est31

@paramat
Copy link
Contributor

paramat commented Sep 24, 2017

@lhofhansl has made culling improvements and is still thinking about further ones, see his PRs and issues.
What's your experience with 0.4.16 or latest code? Perhaps it's possible your low FPS at spawn is partly due to other aspects like signs or whatever.
Try using wireframe mode to see what is not culled.

@paramat paramat added the Request / Suggestion The issue makes a suggestion for something that should be done but isn't a new feature label Sep 24, 2017
@paramat paramat changed the title Areas where there are a lot of caves and tunnels underground harm FPS Areas where there are a lot of caves and tunnels underground harm FPS (improve mapblock culling) Sep 24, 2017
@paramat paramat changed the title Areas where there are a lot of caves and tunnels underground harm FPS (improve mapblock culling) Areas where there are a lot of caves and tunnels underground harm FPS (improve occlusion culling) Sep 24, 2017
@paramat
Copy link
Contributor

paramat commented Sep 24, 2017

I think this issue is out of date because we have had some changes to occlusion culling, please do some new tests, especially with no mods to rule out other effects, and using wireframe mode to check culling.

A vague request for better occlusion culling performance is not really worth an issue, we are always trying to improve it, but if you find something that seems unexpected that is useful as an issue.

@Megaf
Copy link
Contributor Author

Megaf commented Sep 26, 2017

@paramat Just tested .14 vs .16.
Using system GMP and LuaJIT and Irrlicht downloaded from their websites.
Not FPS difference at all at my servers spawn.
20 FPS at spawn. Spikes of 200 FPS elsewhere.

@raymoo
Copy link
Contributor

raymoo commented Sep 26, 2017

@Megaf Have you checked in wireframe mode how many tunnels have been culled? If it's at spawn, the lag could be caused by other things since players will place a lot of things there.

@lhofhansl
Copy link
Contributor

The server side occlusion culling I added would not help with this - it would only reduce the number of blocks that the server needs to send. Before the change the client would occlude these blocks away, now the server does not send them.

Can you look at the output of F6 and report the "blocks in range"? I'd be curious how big that number is on your case.

@lhofhansl
Copy link
Contributor

I had some attempt to improve the accuracy of occlusion culling (which be used both server and client side), but that had cause a bunch of side-effects.

Minecraft uses a version of flood-filling rather than the ray-tracing type approach we're using here. The flood filling can be perfectly accurate, but it needs pretty sophisticated caching or it will be too slow.

@paramat
Copy link
Contributor

paramat commented Sep 26, 2017

Not FPS difference at all at my servers spawn.
20 FPS at spawn. Spikes of 200 FPS elsewhere.

Ok, but as i explained this doesn't mean much, the low FPS could be due to other causes. If there is any bug in occlusion culling you need to test more carefully by disabling all mods to rule out other effects.

Basically, in areas where we have a complex network of tunnels underground for example, the client will experience a huge framerate drop.
I believe this might be caused partially by the way the engine works, making a block full of caves heavier to render than one without. But I don't understand why. I wonder if there is any fix or work around for this issue.

Essentially this is expected, there is no evidence of a bug, and there is no fix or workaround apart from ongoing efforts to improve occlusion culling.

So until there is evidence of a bug, an issue for 'better performance' is somewhat pointless.
Do comment here if something strange does arise and we can reopen it.
Please do continue to discuss, but this doesn't need to be open currently.

@paramat paramat closed this as completed Sep 26, 2017
@paramat paramat added the Not a bug The behaviour is working as intended and won't be changed label Sep 26, 2017
@paramat paramat removed Non-trivial A large amount of work is required to address this (sometimes to the point of being infeasible) Request / Suggestion The issue makes a suggestion for something that should be done but isn't a new feature labels Sep 26, 2017
@HybridDog
Copy link
Contributor

What's the occlusion culling mechanism in Terasology?

@raymoo
Copy link
Contributor

raymoo commented Sep 26, 2017

@HybridDog Maybe it would be better to ask the Terasology community?

@HybridDog
Copy link
Contributor

@raymoo
Copy link
Contributor

raymoo commented Sep 27, 2017

Probably better to use a voxel-specific algorithm such as https://procworld.blogspot.com/2015/08/voxel-occlusion.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@ Client / Audiovisuals Not a bug The behaviour is working as intended and won't be changed Performance
Projects
None yet
Development

No branches or pull requests

8 participants