Jump to content

Earcut?


Pryme8
 Share

Recommended Posts

https://github.com/mapbox/earcut
Just started reading up during lunch.  Anyone do any implementation of it yet?  I see we support it.  Sounds really cool, kinda was making me think about that LOD Terrain questions everyone has been having.

I was thinking you could have a basic Buffer that has like 2000 points arranged in a standard grid, then you would go over all of the points to a set amount of iterations with a range that if the two points Y coordinate is within so much of each other it would combine the two and average them and repeat this process till it finds no more matching points like that.  Like wise while it was doing that, you could also be scanning for points that are out of a range and have it add a point between the two, with that also flagging the loop to continue till it cant find any.  Then before each loop make sure you re transform the terrain to the height map to reset what ever point values and make up for the new divisions.

if you did it with a 3d noise generating it, and did the clamps to ranges in the 3d value I bet this method could support advanced tunneling and cliff features with undercuts; but then your array buffer would have to be a 3d arrangement.

Once the loop is done pass that to earcut?

Does this make any since?

Link to comment
Share on other sites

@Pryme8 I don't really understand how you want to use earcut with terrain map generation. earcut is a polygon to tri function, you're supposed to provide a contour and a list of holes.

Or maybe we don't mean the same thing when we're talking about LOD Terrain. LOD stands for Level Of Detail, which is a routine that simplify a surface for the sake of performance.

If you want to create a mesh from a list of polygons using data like this: http://www.naturalearthdata.com/downloads/ so yes it's possible thanks to earcut: I did it for a project of mine.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...