Jump to content

ribbon mesh ... third version


jerome
 Share

Recommended Posts

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. :D  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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.  :o  I smell you headed into live-update land.  May your horse be with you!

Link to comment
Share on other sites

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)  :D : I'm not a ribbon maniac  :lol:  !!!

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  :P

The fact threejs hasn't got this kind of mesh is quite stimulating too, I have to confess (amen)  :D

Link to comment
Share on other sites

Oh gosh, nobody has answered you, yet?  (about lighting normals)

 

C'mon experts!  Where are you?  :o

 

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...

Link to comment
Share on other sites

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

Link to comment
Share on other sites

@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  :P

 

@ 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.  ;)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...