jerome Posted October 8, 2015 Share Posted October 8, 2015 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 ? Jaskar 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted October 8, 2015 Author Share Posted October 8, 2015 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. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted October 8, 2015 Share Posted October 8, 2015 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) Quote Link to comment Share on other sites More sharing options...
chg Posted October 8, 2015 Share Posted October 8, 2015 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. Quote Link to comment Share on other sites More sharing options...
jerome Posted October 8, 2015 Author Share Posted October 8, 2015 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 ? Quote Link to comment Share on other sites More sharing options...
jerome Posted October 8, 2015 Author Share Posted October 8, 2015 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. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted October 8, 2015 Share Posted October 8, 2015 @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? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 8, 2015 Share Posted October 8, 2015 Subdivisions were used to produced mesh where you can apply submaterials easily. I'm not sure this is required anymore as no one is using it Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 8, 2015 Share Posted October 8, 2015 And cube has always been created with 24 vertices. This is not a regression Wingnut 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted October 8, 2015 Author Share Posted October 8, 2015 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 Quote Link to comment Share on other sites More sharing options...
jerome Posted October 9, 2015 Author Share Posted October 9, 2015 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=100012He 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 side25 vertices, so 24 normals and correct light reflection and the ability to apply textures per face as wanted Quote Link to comment Share on other sites More sharing options...
jerome Posted October 13, 2015 Author Share Posted October 13, 2015 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 13, 2015 Share Posted October 13, 2015 rocks! 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.