Pryme8 Posted August 26, 2016 Share Posted August 26, 2016 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? Quote Link to comment Share on other sites More sharing options...
jerome Posted August 27, 2016 Share Posted August 27, 2016 Actually earcut is already embbeded in BJS : https://github.com/BabylonJS/Babylon.js/blob/55201dec0110e261e758902477dfe23120bc29bd/src/Tools/babylon.earcut.js Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 27, 2016 Author Share Posted August 27, 2016 yeah that is what I was saying, I was asking if anyone has implemented it and used it? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 29, 2016 Share Posted August 29, 2016 @Nockawa did it! Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 29, 2016 Share Posted August 29, 2016 hehe. I think Pryme8 is asking if someone has a scene that USES it. P8... I found only one playground series... that calls it. http://www.babylonjs-playground.com/#UFYJM#1 I know nothing else, and maybe even less than that. Pryme8 1 Quote Link to comment Share on other sites More sharing options...
Nockawa Posted August 31, 2016 Share Posted August 31, 2016 @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. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 31, 2016 Author Share Posted August 31, 2016 Yeah, I want to use that idea to optimize terrain and where LOD comes in is the amount of passes I want the process to take depending on distance from camera so yeah levels of detail. Quote Link to comment Share on other sites More sharing options...
Nockawa Posted August 31, 2016 Share Posted August 31, 2016 I did LOD before and I'm not sure of how earcut could be used to achieve what you want efficiently. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 31, 2016 Author Share Posted August 31, 2016 also can I just pass and cloud of points to something and have process that into a clean mesh? Quote Link to comment Share on other sites More sharing options...
Nockawa Posted September 1, 2016 Share Posted September 1, 2016 No you can't, earcut takes a contour + hole list, not a cloud of point. For such data you have to go for algorithm like Delauney Triangulation if I remember correctly. Pryme8 1 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted September 1, 2016 Author Share Posted September 1, 2016 I found this https://people.eecs.berkeley.edu/~jrs/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.