ElemarJR Posted January 4, 2015 Share Posted January 4, 2015 Hello,Is there an way to create a mesh with an polygon points list? Is there some "triangulator" feature available?Cheers, Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 4, 2015 Share Posted January 4, 2015 Not for now but we are open for suggestions Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 4, 2015 Share Posted January 4, 2015 Sub-classing BABYLON.Mesh & taking some data structure with the points in the constructor is a very clean way to go. Constructor processes data into positions, normals, & indices. Keeps Mesh itself from getting to big. Quote Link to comment Share on other sites More sharing options...
Temechon Posted January 4, 2015 Share Posted January 4, 2015 Check this, it might help : http://www.html5gamedevs.com/topic/3396-create-a-shape-with-more-than-4-vertices/?hl=triangulation (only works for planes) Quote Link to comment Share on other sites More sharing options...
jerome Posted January 4, 2015 Share Posted January 4, 2015 I intend to implement (after seeing the whole video tutorial and I'm only at the end of first chapter, arrg ... great job, guys !) some kind of ribbon mesh :- two arrays A and B of vertices, each being a kind of curve/path points : A1, A2, ... for array A and B1, B2, ... for array B- then creation of adjacent triangles between these two pathes A1-B1-A2, B1-A2-B2, A2-B2-A3 and so on until the first end reached on one of the arrays BABYLON.mesh.createRibbon(arrayA, arrayB) not sure I'm very clear :-PI will try in the playground next weeks I think it could be a light usefool tool to create easily many types of surfaces. By the way, why the name "BABYLON" was chosen ? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 4, 2015 Share Posted January 4, 2015 You can certainly create a Mesh in the playGround. Write a function:function createRibbon(mesh, arrayA, arrayB){ var positions = []; var indices = []; // process Arrays into positions & indices ... var normals = new Array[positions.length]; BABYLON.VertexData.ComputeNormals(positions, indices, normals); mesh.setVerticesData(BABYLON.VertexBuffer.PositionKind, positions, false); mesh.setVerticesData(BABYLON.VertexBuffer.NormalKind, normals, false); mesh.setIndices(indices);}If you think it needs to become part of the repository though, I think it should be a sub-class, in its own file. The body of the function the constructor. Make it possible to exclude for Make your own babylon. Quote Link to comment Share on other sites More sharing options...
jerome Posted January 4, 2015 Share Posted January 4, 2015 thank you for these nice advices :-) Quote Link to comment Share on other sites More sharing options...
ElemarJR Posted January 4, 2015 Author Share Posted January 4, 2015 I would like to implement it. What's the right way to collaborate? NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 4, 2015 Share Posted January 4, 2015 We accept PR on the github repo (please use TypeScript) BABYLON was chosen because I'm a huge fan of Babylon 5 (The TV show ) ElemarJR 1 Quote Link to comment Share on other sites More sharing options...
ElemarJR Posted January 5, 2015 Author Share Posted January 5, 2015 Perfect! I already forked the repository. What's the policy about using external libraries? I was thinking about implement a Constrained Delaunay triangulation algorithm, to support holes, but there are good implementations available (poly2tri in https://github.com/r3mi/poly2tri.js, for example). Could I use it? should I reimplement everything? Should I think about some plugin system to use it? Quote Link to comment Share on other sites More sharing options...
ElemarJR Posted January 5, 2015 Author Share Posted January 5, 2015 I just saw that poly2tri was suggested in the http://www.html5game...l=triangulation (refereced by @temechon) Quote Link to comment Share on other sites More sharing options...
Nikos Posted January 5, 2015 Share Posted January 5, 2015 By the way, why the name "BABYLON" was chosen ?I'm also not to sure about the name, why not call it Athens? btw I'm wanting to create some more primitive meshes , is this of sort of thing we can contribute to the babylon github repo? Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 5, 2015 Share Posted January 5, 2015 By the way, why the name "BABYLON" was chosen ? Here - http://en.wikipedia.org/wiki/Kosh_Naranek ( Just add Delta :-) ) Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 5, 2015 Share Posted January 5, 2015 I'm also not to sure about the name, why not call it Athens? It's a joke ??? At this stage of development, it's a little late to suggest another name. So why a name is better than another ? And Three.js, why not name it Four.js ? Athens? Why is it better than Babylon? Quote Link to comment Share on other sites More sharing options...
Temechon Posted January 5, 2015 Share Posted January 5, 2015 I think it was a joke Quote Link to comment Share on other sites More sharing options...
jerome Posted January 5, 2015 Share Posted January 5, 2015 I'm sure it's a jokeantic cities competition, arf @JCPalmer : thanx again for your help => http://www.html5gamedevs.com/topic/11502-ribbon-mesh-first-attempt/ Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 5, 2015 Share Posted January 5, 2015 What's the policy about using external libraries?We do not allow external dependencies. But we accept optional dependencies (like for physics) Quote Link to comment Share on other sites More sharing options...
ElemarJR Posted January 7, 2015 Author Share Posted January 7, 2015 I did some experiments using Babylon and poly2tri (oss project thtat implements constrained delaunay algorithm). Here is the result: I created a little extension to Babylon. https://github.com/ElemarJR/BABYLON.Triangulation/blob/master/src/babylon.triangulation.ts What do you think? Should I try to put it into BABYLONJS? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 7, 2015 Share Posted January 7, 2015 Definitely! IPoint2 could be replaced by BABYLON.Vector2 Quote Link to comment Share on other sites More sharing options...
ElemarJR Posted January 8, 2015 Author Share Posted January 8, 2015 Hello, The implementation of triangulation with constrained delaunay (support to holes it's not trivial). poly2tri implements the algorithm in a good way and I don't think so that reimplement it is a good idea. To create the mesh of the screenshots I wrote, using my current implementation, something like that:var rectangle = BABYLON.Polygon.rectangle(-15, -15, 15, 15);var ground = new BABYLON.PolygonMeshBuilder("ground", rectangle, this.scene) .addHole(BABYLON.Polygon.bird()) .build();Do you really think that create a "PolygonMesh" class could be simpler to use? I think that is best to verify the reference to poly2tri in the build method. NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
ElemarJR Posted January 8, 2015 Author Share Posted January 8, 2015 I will create a PR to discuss it in github Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 8, 2015 Share Posted January 8, 2015 Excellent. I will integrate it with babylon.js (grunt, etc..) In the meantime do you think you can also integrate an extrusion option? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 8, 2015 Share Posted January 8, 2015 Do you think you can create a wiki page like this one for your feature?https://github.com/BabylonJS/Babylon.js/wiki/Using-the-debug-layer Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 8, 2015 Share Posted January 8, 2015 I will check-in some little fixes but here is your work integrated well done!http://www.babylonjs-playground.com/#10IOII#1 Quote Link to comment Share on other sites More sharing options...
ElemarJR Posted January 9, 2015 Author Share Posted January 9, 2015 wow! that's huge! I'm really happy now. Yes, I will try to write an wiki (I am not sure if my english is good enough to do that, but...) page and to provide extrusion. NasimiAsl and jerome 2 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.