jerome Posted January 30, 2015 Share Posted January 30, 2015 Hi folks, My ribbon mesh is quite ready ... still in javascript. I added at least the UV computation. And that wasn't as easy as I expected, because a ribbon mesh, as it is defined by user custom paths, has no pre-defined shape, whereas we know the expected shape of cylinders, spheres, cubes or other basic constructors before computing UVs. So I had to make choices about the way to unwrap an unknow 3D shape onto a texture surface.I chose the criterium of vector (between two consecutive points of each path) lengths for U and vector (between points i of two consecutive paths) lengths for V. This means the UV are quite good if all the paths (in your ribbon parameter : array of paths) have the same number of points. This is usually the case when we design complex math computed shapes. It shoud then adjust to most of the ribbonized objects .Using paths each having different number of points will probably cause strange texturing effects. Didn't test. Don't tell, show please : http://www.babylonjs-playground.com/#1Q5J6R Feel free to play with texture uScale and vScale of course iiceman and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
jerome Posted January 30, 2015 Author Share Posted January 30, 2015 inside the tube : http://www.babylonjs-playground.com/#1Q5J6R#1 grrrr, don't get my spotLight light it up Quote Link to comment Share on other sites More sharing options...
jerome Posted January 30, 2015 Author Share Posted January 30, 2015 better lightning here : http://www.babylonjs-playground.com/#1Q5J6R#2 Quote Link to comment Share on other sites More sharing options...
jerome Posted January 30, 2015 Author Share Posted January 30, 2015 really inside : http://www.babylonjs-playground.com/#1Q5J6R#3zzzoooooooofffff jahow 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted January 30, 2015 Share Posted January 30, 2015 Lookin' good, Captain J! You know, when I was at the doctor's office, they used a camera and a light to... umm, nevermind. Totally tubular, Jerome! I think it means excellent, a term invented by surfers who enjoy being inside "the tube" of a wave. I don't know if they yell "zzzoooooooofffff" while they are inside it, but maybe. I'm thinkin' Jerome needs a new nickname. I propose "Ribs"... short for "The Ribbonmeister". The ribbonator. He's filled with ribbonity. hehe jerome 1 Quote Link to comment Share on other sites More sharing options...
jahow Posted January 30, 2015 Share Posted January 30, 2015 Yep, I agree with Wingnut: it looks great! Quote Link to comment Share on other sites More sharing options...
Wingnut Posted January 30, 2015 Share Posted January 30, 2015 Ok, so you have your lighting normals cooperating for both lighting INSIDE and OUTSIDE the tube, right? And your UV mapping looks pretty tolerable (perfect) and nicely animated. And, I saw you asking about updating vertexData. So, why not try to animate vertex colors, to give (another type-of) appearance of movement through the tube? (just a suggestion). It would be a nice way to try-out live updating, right? Worst case scenario, you end up with various tooty frooty messes... always good for a laugh. Can you make colored rings pass along the tube? Can you do candy-cane stripes? Linear stripes? Can you allow a user array of colors? Can you make/borrow a color interpolator? And once you make a few live-updating color-per-vertex toys, you will be ready to live-update positions. I smell you headed into live-update land. May your horse be with you! Quote Link to comment Share on other sites More sharing options...
jerome Posted January 30, 2015 Author Share Posted January 30, 2015 didn't know there were normals for inside (backfaces ?) !!! how can I set them ?I just set positions, indices, uvs and computed normals with the embbeded function to get ...well, the normals. Yep, I know it would be so cool (am I "surfer" enough with "cool" ? ) to set the colors in the many ways you described. I already have an idea of something more general I would talk to both Daves, maybe in french because I'm afraid my poor english won't be enough (maybe my french neither) About your former post ("ribbonator" and doctor examen) : I'm not a ribbon maniac !!!I just like using very basic and easy shapes with much extensibility (versatility ?). I hope other basic shapes will be added some day in BJS or maybe the existing basic shapes (cube, sphere, torus, etc) will be just a bit modified to get this extensibility, you know the thing I want to tell to DK about. Back to the ribbon.. it's almost finished (don't even know if it's worth implementing the only-one-path-ribbon).Then, high jump for me, I will have to port it to typescript and enter the unknown world of "intregation in an existing framework" and other PR git stuff The fact threejs hasn't got this kind of mesh is quite stimulating too, I have to confess (amen) Quote Link to comment Share on other sites More sharing options...
Wingnut Posted January 30, 2015 Share Posted January 30, 2015 Oh gosh, nobody has answered you, yet? (about lighting normals) C'mon experts! Where are you? To the best of my knowledge (none), there is only one normal per vertex. (Unless the mesh is .convertToFlatShaded, where it has 3 per vertex, I hear.) There's an easy way to be sure. Grab your spotlight and camera, and put yourself inside a basic shape, with backfaceCulling false, and see if you can light-up the inside walls. Bet ya can't. But I don't think I have ever tried it. I tried to light the back side of a plane, once. Burned up 4 spotlights before I figured it out. SO, would that mean that a tube would need to be created with normals one way for inside-tube lighting, and a different way for outside-tube lighting? And the experts say... jerome 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 30, 2015 Share Posted January 30, 2015 Sorry guys, it is difficult to be able to respond to all questions BTW, there is always only one normal per mesh. (For flat shaded meshes I add more vertices) Hence there is no inside normals The only way would be to add more faces and more vertices to also cover inside part of a mesh Wingnut and jerome 2 Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 30, 2015 Share Posted January 30, 2015 Just a question - if you are already using a normal map as a texture, why not use it as a bumpTexture and give it a bit more "depth" ? http://www.babylonjs-playground.com/#1Q5J6R#5BTW - I really like this uv-coordinates hack of making it look like it is moving :-) awesome... jerome 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted January 30, 2015 Share Posted January 30, 2015 Sorry dk. I know you are busy. I guess I was scared of saying something incorrect. Thanks again. Quote Link to comment Share on other sites More sharing options...
jerome Posted January 31, 2015 Author Share Posted January 31, 2015 @DK : thank you, I guessed we had to cover to inside face of the tube with another layer... inverted. Was just wonderind if there was another way @ RaananW : yeeahh very nice with bumped texture I didn't test it, it's worth it. I was just focused on the way to unwrap this $%@# ribbon unknow shape onto a texture surface and debug it Feel free guys to stress the ribbon texturing on my various shape. I hope it is adaptative enough. Quote Link to comment Share on other sites More sharing options...
jerome Posted February 1, 2015 Author Share Posted February 1, 2015 http://www.babylonjs-playground.com/#1Q5J6R#7 so, I simpliest way to have normals inside the tube, so it will be enlighted in, is to wrap it the other direction, from 2* PI to zero, instead of from zero to 2*PI 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.