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

How to make generated terrain consistently square? #62

Closed
izzymiller opened this issue Apr 30, 2024 · 3 comments · Fixed by #63
Closed

How to make generated terrain consistently square? #62

izzymiller opened this issue Apr 30, 2024 · 3 comments · Fixed by #63

Comments

@izzymiller
Copy link

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:
image

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.

image

Any advice? Thank you!

@j-devel
Copy link
Contributor

j-devel commented May 7, 2024

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).

@izzymiller
Copy link
Author

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.

@j-devel
Copy link
Contributor

j-devel commented May 11, 2024

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

@j-devel j-devel added the help wanted Extra attention is needed label Jul 26, 2024
@j-devel j-devel removed the help wanted Extra attention is needed label Sep 23, 2024
@j-devel j-devel pinned this issue Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants