Jump to content

Cylinder Subdivisions : What For ?


jerome
 Share

Recommended Posts

other question :

does anybody mind if I duplicate the vertices on every subdivision edges ?

This would enable to set different colors and textures per ring (subdivision) as it is now possible for the Box mesh.

Else I will only provide the  textures and colors per face feature (tube, top cap, bottom cap)... and keep wondering what are those subdivisions for then.

Link to comment
Share on other sites

Hi Jerome!

 

    "Duplicate" might not be the perfect word, there.  Maybe "double" or "double-up".  *shrug*  :)

 

What you propose will play havoc with flatShaded, one would think.  We're talking about a potential TON of extra vertices.

 

How much "hassle" would it be to have .convertToFlatShadedMesh... skip those doubled-up vertices when it does its convert?   Thoughts?

 

Otherwise... a flatShaded subdiv "ring" will have 4 vertices at each "point"... two of which are wasted.

 

Why not stack differently-materialed cylinders to accomplish the same goal?  (sorry, as you know, I'm not overly bright)  :)

Link to comment
Share on other sites

Hi,

Could one of this forum oldest member tell me please what the cylinder subdivisions were created for ?

The ability to apply different textures along the cylinder tube with submaterials maybe ?

I'm not an old member, or even a Babylon user, but I'll make some guesses anyway -

1. If you use gouraud shading, the extra tessellation will make lighting more accurate (picture a spot light aimed at the middle of a rod which is side on)

2. Also you could say wobble the cylinder vertices in a vertex shader, say for a rope, which wouldn't work for an untessellated cylinder.

 

"Duplicate" might not be the perfect word, there. Maybe "double" or "double-up". *shrug* :)

"Duplicate" seems to be the term I have always seen for this, I believe it's the correct jargon.
Link to comment
Share on other sites

Not tons of new vertices... only tessellation * nb_subdivisions.

None of them will be wasted, they will hold each a normal, a UV (so we'll be able to set textures per ring) and a color (so colors per ring also).

And I will of course set the normals on all vertices as the mesh weren't flatShaded.

 

BTW, the box mesh has duplicated vertices : each box side has 4 vertices, so 24 for the whole box while only 8 would have been enough.

 

Actually, I'm just wondering what these subdivisions are currently used to. Any ideas ?

Link to comment
Share on other sites

MMh.... nobody ?

 

maybe should I have asked a more positive way ?

 

Would you like to have the per-ring texture and color feature on the cylinder like the one provided with the CreateBox ?

var ringUV = new Array(5);// here set the ringUV valuesvar cyl = BABYLON.Mesh.CreateCylinder("cyl", {subdivisions: 5, faceUV: ringUV});

I'm about to PR the feature (color + texture) per face now : cylinder tube, top cap, bottom cap.

Let me know if you want it per ring... knowing I need just to duplicate the vertices in this case.

Link to comment
Share on other sites

@jerome    tessellation * nb_subdivisions * #clones * #instances + # of other unique cylinders in the scene.

 

For the cylinder, you want to color the end caps, too, yes?  So all cylinders will be double the size they were before... * #clones * #instances + # of other unique cylinders in the scene.  Yes? 

 

Also, is the 8 vertex box... gone?  A 24-vertex box is the ONLY box available with CreateBox?  Is that wise?  Each box takes 3 times longer to render.... than before?  If this is true, I think this should be reconsidered.  We should not make people who DON'T want to color each side of the box... suffer 16 vertex extra load... just to get this feature that they don't need/want... imho.

 

Lastly, maybe think about letting DK get out of bed before getting impatient for answers?  I'm quite sure that he will have your "why subdivs?" answer.

 

Wow, what the hell is happening around here.  :)  Am I going insane?  heh  Have I been insane the whole time?

Link to comment
Share on other sites

Ok, so noone has any objection about the fact to duplicate vertices (if subdivisions used only) to provide the ability to have colors or textures per ring as easily as for faces ?

 

 

why did I ask ...? nobody would have noticed this tsssss

Link to comment
Share on other sites

BTW, when I said 8 vertices are enough to build a box, I mean to build the geometry of a box only.

It really needs 24 vertices to hold 3 different normals per box vertex. There's a difference between the geometry and the constraints of light reflection or/and texturing.

 

This what I hardly try to tell to JohnK with my poor english before he finally understood it by himself : http://www.html5gamedevs.com/topic/17691-texture-on-individual-faces-of-a-polyhedron/?p=100012

He illustrated well the box case in his PG : 8 vertices so 8 normals only... weird light reflection, no way to repeat the texture image on each box side

25 vertices, so 24 normals and correct light reflection and the ability to apply textures per face as wanted

Link to comment
Share on other sites

BTW, I added a new optional parameter to the Cylinder : diameter.

Just in case (quite frequent), you need the same diameterTop and diameterBottom values.

var cyl = BABYLON.Mesh.CreateCylinder("cyl", {diameter: 5}, scene);

already documented : https://github.com/BabylonJS/Documentation/blob/master/content/tutorials/01_Play_Pen/Mesh_CreateXXX_Methods_With_Options_Parameter.md#cylinder-or-cone

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