Zylann / godot_voxel

Voxel module for Godot Engine
MIT License
2.69k stars 251 forks source link

Cave culling algorithm #19

Open Zylann opened 6 years ago

Zylann commented 6 years ago

I would like to implement a BFS cave-culling algorithm, as explained here https://tomcc.github.io/2014/08/31/visibility-1.html

Doing it should be relatively simple and extremely efficient for this kind of voxel terrain, however part of its efficiency relies on having control over frustrum culling. Two alternatives:

1)

If I don't do any of these, the only thing I can do is to turn visibility of blocks on/off constantly in process, while still having classic frustrum culling crunching hundreds of blocks for no reason (and being slow at this). On top of that, in Godot invisible meshes are also taken to frustrum culling anyways...

I have no idea yet how that can be done without having to fork the entire engine in addition to developping a module, that sounds quite impractical. I'll probably give it a go later and see what the concrete requirements happen to be.

Zylann commented 6 years ago

Update: discussed this a little with Reduz, and he plans to implement another general technique that could give good results as well (see https://github.com/godotengine/godot/issues/22048#issuecomment-421475081). The benefits will need to be profiled to see if the BFS cave culling technique is still better.

blockspacer commented 4 years ago

Now when a block is not visible, it is removed from world https://github.com/Zylann/godot_voxel/commit/badf3876c38485d2cdb7be9bbbc538f49062dbc1

Whats the current state of that issue?

Zylann commented 4 years ago

@blockspacer it's still relevant, until we see results of future culling system. Removing from world was a workaround to only get rid of another source of overhead.