jerome Posted January 21, 2015 Share Posted January 21, 2015 Hi back guys !! I worked a little to improve my ribbon mesh (still a draft) Now, the call function signature is this one :createRibbon(mesh, [paths], close, offset, scene);easy, isn't it ? mesh : the blank mesh you want to be ribbonized or mumified [paths] : an array populated with paths. What is a path ? it's an array of successive Vector3. It is for example the discrete representation of a math curve ... or anything else you want.close : boolean, if true the first and last ribbon drawn will be joined by an extra faceoffset : not implemented yet, I'll tell you laterscene : the current sceneLet's start with a simple example.I want to create p paths. Each path will be a curve along an exponential function : // my math function var populatePath = function(path, p) { for (var i = 0; i < 40; i++) { path.push( new BABYLON.Vector3(i-20, Math.cos(p / 3) * 3 * Math.exp(-(i-p-8)*(i-p-8) / 60) , p) ); } };Heeuuu, too much maths for me, so don't tell, show please : http://www.babylonjs-playground.com/#1QD8LMEach line is a path along a this exp function, right. Ok, now let's mumify these lines : // mesh var meshExp = new BABYLON.Mesh("meshExp", scene); meshExp.material = mat; createRibbon(meshExp, paths, false, null, scene);what ? just a line of code ?yes, sir : http://www.babylonjs-playground.com/#1QD8LM#1 but, you may prefer to see the full material, nope ?http://www.babylonjs-playground.com/#1QD8LM#2 I hope I can code other examples more impressive than this very simple one.For now the uv is not computed, so applying textures will probably be strange jahow 1 Quote Link to comment Share on other sites More sharing options...
gryff Posted January 21, 2015 Share Posted January 21, 2015 jerome, I'm no scripter or mathematician but I find something fascinating about your creations. I look at every example you post. My favourites are in one of your earlier posts - the helical and Möbius ribbons. Be nice to bend the helical one - make it like a Christmas streamer/decoration. Don't know why I find them fascinating - I'm not sure I will ever use this kind of code, but keep making them cheers, gryff Quote Link to comment Share on other sites More sharing options...
jerome Posted January 21, 2015 Author Share Posted January 21, 2015 thank you very much, gryff I know Blender can produce highly detailed and rich meshes but we sometimes need computed meshes to represent incoming data for example. I really need them because I intend to code monitoring tools (network activity, server business, user activity, etc). So here another simple example with some cubic bezier curves :strange shape here : http://www.babylonjs-playground.com/#1QD8LM#3 then mumified : http://www.babylonjs-playground.com/#1QD8LM#4 hope I could make tubes, helix, moebius (from a lone path, it's my challenge) in the coming days ! jahow and GameMonetize 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.