Sholand Posted November 7, 2017 Share Posted November 7, 2017 Hi, I am trying to extrude a polygon using ExtrudeShapeCustom. I need to use this because I need to access the scale function. It seems that a polygon with concave shapes messes it up. code: var c = BABYLON.Mesh.ExtrudeShapeCustom("name", polygon, path, Scale, Rotation, false, true, 3, scene); When creating the same with below polygonMeshBuilder it works. var c = new BABYLON.PolygonMeshBuilder("name", polygon, scene).build(1,depth); My issue is that I need to scale down so the polygon gets smaller as it extrudes. Is there a fix for this? I have attached screenshots of the polygonMeshBuilder (which looks ok but without any scaling) and the ExtrudeCustomShape (which is messed up) Quote Link to comment Share on other sites More sharing options...
jerome Posted November 8, 2017 Share Posted November 8, 2017 PG please ? Quote Link to comment Share on other sites More sharing options...
Sholand Posted November 8, 2017 Author Share Posted November 8, 2017 Hi Jerome, Here are the two playgrounds This is the one with the extrudeshapecustom. I think it is a cap problem. http://www.babylonjs-playground.com/#KCFUE2#1 Here is the one that works - (but no scaling function available) http://www.babylonjs-playground.com/#HVQS9P#1 Quote Link to comment Share on other sites More sharing options...
jerome Posted November 8, 2017 Share Posted November 8, 2017 yes, the capping process is quite simple and based on the computation of the barycenter only (not a real triangulation algo) ... something that could be improved actually. For now, if you need a better cap, you could build a polygon from the shape that you extrude (with http://doc.babylonjs.com/how_to/polygonmeshbuilder) or that you use JohnK's polygonExtruder Quote Link to comment Share on other sites More sharing options...
JohnK Posted November 8, 2017 Share Posted November 8, 2017 Here is link for extruding polygon http://doc.babylonjs.com/how_to/parametric_shapes#extruded-non-regular-polygon jerome 1 Quote Link to comment Share on other sites More sharing options...
Sholand Posted November 8, 2017 Author Share Posted November 8, 2017 Thanks for the help... Until the cap can be improved, can you think of anyway to replicate the scaling function of extrudeshapecustom where the polygon gets smaller (with a proper cap)? See how the sides taper down? Quote Link to comment Share on other sites More sharing options...
Sholand Posted December 4, 2017 Author Share Posted December 4, 2017 Hi Jerome and JohnK, Is there anyway I can request the improvement of the capping algorithm for extrudecustomshape? or pay someone to do it? I really need to be able to run the scaling function to taper down the sides. I appreciate your help and feedback. Thanks! Quote Link to comment Share on other sites More sharing options...
JohnK Posted December 4, 2017 Share Posted December 4, 2017 As an alternative extrude without caps use createPolygon or PolygonMeshBuilder to make the caps and merge the meshes. Quote Link to comment Share on other sites More sharing options...
Sholand Posted December 4, 2017 Author Share Posted December 4, 2017 Thanks JohnK! Not exactly sure how to do this but I will give it a try... Quote Link to comment Share on other sites More sharing options...
Sholand Posted December 5, 2017 Author Share Posted December 5, 2017 It seems that extrudecustomshape and polygonmeshbuilder come out on different planes. Can't figure out how to line them up... http://www.babylonjs-playground.com/#KCFUE2#2 Quote Link to comment Share on other sites More sharing options...
JohnK Posted December 5, 2017 Share Posted December 5, 2017 Bit trickier than I thought but here it is https://www.babylonjs-playground.com/#KCFUE2#3 but I may have got it upside down so https://www.babylonjs-playground.com/#KCFUE2#4 Note that because your poly data is all positive and scaling is set at the origin the shape is skewed see better with bigger chamfer https://www.babylonjs-playground.com/#KCFUE2#5 If you want to the base centres in alignment then you need to adjust your data to have the origin at the centre https://www.babylonjs-playground.com/#KCFUE2#6 Arte and jerome 2 Quote Link to comment Share on other sites More sharing options...
Sholand Posted December 5, 2017 Author Share Posted December 5, 2017 JohnK, that is amazing! Thank you for your help. The last one https://www.babylonjs-playground.com/#KCFUE2#6 looks the best. How would I go about reversing it so that the bigger surface is on top? so that it tapers smaller down instead of up? Quote Link to comment Share on other sites More sharing options...
JohnK Posted December 5, 2017 Share Posted December 5, 2017 Easiest way is to do what I did in #4 reverse lower/upper (top/Bottom) values https://www.babylonjs-playground.com/#KCFUE2#7 Quote Link to comment Share on other sites More sharing options...
Sholand Posted December 5, 2017 Author Share Posted December 5, 2017 Thanks! I will try and integrate into my application. Quote Link to comment Share on other sites More sharing options...
Sholand Posted December 13, 2017 Author Share Posted December 13, 2017 JohnK - it worked perfectly. Thank you so much for all of your help! 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.