Zylann / godot_voxel

Voxel module for Godot Engine
MIT License
2.61k stars 245 forks source link

Setting VoxelLodTerrain stream causes slowdown due to LOD override #231

Open 16millionoctopodes opened 3 years ago

16millionoctopodes commented 3 years ago

https://github.com/Zylann/godot_voxel/issues/223#issuecomment-774512244 16millionoctopodes:

For VoxelLodTerrain - VoxelNode, whenever I set the Stream property (for example, a New VoxelStreamRegionFiles), I'm getting incredibly slow editor performance to the point of unusability. Deactivating "Run Stream In Editor" doesn't help. I assume this is due to the changes being made here to VoxelStream, and will clear up once they're completed?

https://github.com/Zylann/godot_voxel/issues/223#issuecomment-774517109 Zylann:

Please open another issue for this, it's not related to instancing.

I found a design issue with this recently, and the reason is, when you set a stream, it will override LOD count back to 1, which means the whole terrain will start requesting voxels at super-high resolution over a massive range. This problem can be worked around by commenting out these lines:

https://github.com/Zylann/godot_voxel/blob/0b4363135a29460c4df588b1bdf8e365a244898e/terrain/voxel_lod_terrain.cpp#L265-L266

In some cases it makes sense to override node settings if the assigned stream has specific format constraints, but in other cases settings must come from the node instead. I need to work out a proper design.

Zylann commented 3 years ago

I pushed e9be76caa434c239255d116ab0438d16c1d8ba42 to workaround this for now. A better fix might be designed in the future.