Eldemarkki / Marching-Cubes-Terrain

Marching Cubes terrain implementation in Unity using the Job System and the Burst compiler
MIT License
562 stars 80 forks source link

Level of detail #9

Open Eldemarkki opened 4 years ago

Eldemarkki commented 4 years ago

Implement level of detail. One level per chunk.

hongwangg commented 4 years ago

Hi! Do you happen to have any idea on how to implement LOD in marching cubes? (I can't really figure it out myself so yeah)

Eldemarkki commented 4 years ago

Hey, I have not looked into this very much yet, but I think I have one idea of how this could maybe be implemented, but I have no idea if it would work. Here it is:

This representation is only in 2D, but it would work the same in 3D. Every point represents a density point. Every green point is sampled, and every red point is just skipped. Essentially, the green points would just form a new and larger voxel to march. There would be a visible seam between chunks of different LODs, but (I think) that would be a relatively easy fix with some interpolation magic.

Images for different LODs (may cause headache: dense grid/dots) LOD 0: ![lataus (2)](https://user-images.githubusercontent.com/38920928/73566728-3cc6b180-446d-11ea-829a-1c5872c5a26b.png) LOD 1: ![lataus (3)](https://user-images.githubusercontent.com/38920928/73566797-71d30400-446d-11ea-90a8-d522148a5009.png) LOD 2: ![lataus (4)](https://user-images.githubusercontent.com/38920928/73566802-75ff2180-446d-11ea-941b-8b10bfe60a10.png) LOD 3: ![lataus (5)](https://user-images.githubusercontent.com/38920928/73566806-7a2b3f00-446d-11ea-8128-f5716b27b681.png)
Whitebrim commented 4 years ago

Hey, I have not looked into this very much yet, but I think I have one idea of how this could maybe be implemented, but I have no idea if it would work. Here it is:

This representation is only in 2D, but it would work the same in 3D. Every point represents a density point. Every green point is sampled, and every red point is just skipped. Essentially, the green points would just form a new and larger voxel to march. There would be a visible seam between chunks of different LODs, but (I think) that would be a relatively easy fix with some interpolation magic.

Images for different LODs (may cause headache: dense grid/dots)

Octatree fill fit it, I think