three-geo
three-geo copied to clipboard
How to make generated terrain consistently square?
Hiya! I've been a heavy user of three-geo for a while, and overall love it— I have one thing that I've been battling against for a while and am having trouble wrapping my head around.
I realize three-geo works in tiles. I'm visualizing GPS tracks, which can sometimes cross multiple tiles. When this happens, I usually wind up with a rectangular terrain object, like this:
What I really want is for my generated terrain to ALWAYS be perfectly square. In an ideal world, I would be able to clip the terrain to a size irrespective of tile boundaries. I realize that may be difficult, and would settle for the ability to force additional tiles to download to complete a square.
Any advice? Thank you!
Hi, thanks for sharing this.
What I really want is for my generated terrain to ALWAYS be perfectly square. In an ideal world, I would be able to clip the terrain to a size irrespective of tile boundaries.
After reviewing code, I think, this can be done in a relatively simple way. More specifically, we can clip the generated terrain along bbox
, which is guaranteed to be a square. I would like to try implementing such an algorithm, and add a new example (hopefully during this week or so).
Sweet! I'm delighted to hear that.
I was able to tweak the fetch code to always return more tiles to fill in the square if there were only 2 tiles returned, but that's inefficient and has been resulting in too-large terrain that doesn't focus on my core area of focus.
I think I just don't have the three-js chops to figure out how to do that clipping. Really appreciate it and interested to see what the solution looks like.
With clipTerrainRgb()
, I managed to get geometry correct (I think). However, now I just see that texture mapping is not quite correct... So, still something remains to be done 🤔
live - https://w3reality.github.io/three-geo/examples/clip/index.html code - https://github.com/w3reality/three-geo/blob/master/examples/clip/index.html