leota Posted July 20, 2018 Share Posted July 20, 2018 When creating a Box using BABYLON.MeshBuilder.CreateBox() I can pass it parameters like width, height and depth, but I don't see widthSegments, or heightSegments for example. Is there a way to do that? Quote Link to comment Share on other sites More sharing options...
Guest Posted July 20, 2018 Share Posted July 20, 2018 What should be the effect of height or widthSegments? Quote Link to comment Share on other sites More sharing options...
leota Posted July 20, 2018 Author Share Posted July 20, 2018 1 minute ago, Deltakosh said: What should be the effect of height or widthSegments? You can see here: https://threejs.org/docs/index.html#api/geometries/BoxGeometry (Can open GUI controls at the top right) Quote Link to comment Share on other sites More sharing options...
Guest Posted July 20, 2018 Share Posted July 20, 2018 Oh ok, kind of subdivisions. We do not have this feature out of the box Quote Link to comment Share on other sites More sharing options...
leota Posted July 20, 2018 Author Share Posted July 20, 2018 Just now, Deltakosh said: Oh ok, kind of subdivisions. We do not have this feature out of the box That's a shame Is there any easy workaround to achieve that? Or do I have to modify that Class to implement this change? Quote Link to comment Share on other sites More sharing options...
Guest Posted July 20, 2018 Share Posted July 20, 2018 If you want to update the class, I will be happy to merge the PR Everything is here: https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.meshBuilder.ts#L33 The main code is here: https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.mesh.vertexData.ts#L928 Quote Link to comment Share on other sites More sharing options...
leota Posted July 20, 2018 Author Share Posted July 20, 2018 I'll give it a try thanks Quote Link to comment Share on other sites More sharing options...
Guest Posted July 20, 2018 Share Posted July 20, 2018 Thank you! Quote Link to comment Share on other sites More sharing options...
brianzinn Posted July 20, 2018 Share Posted July 20, 2018 1 hour ago, leota said: Is there any easy workaround to achieve that? The box doesn't have that parameter, but the other shapes do! The parameter can be used to increase accuracy or reduce poly count. I think you mentioned cone or cylinder before - it has subdivisions (same with IcoSphere). Also, circle has segments. So, the other shape creation methods probably have what you are after. More segments on a square will increase triangles and obviously have the same shape, though! I can imagine some use cases still. Quote Link to comment Share on other sites More sharing options...
leota Posted July 20, 2018 Author Share Posted July 20, 2018 15 minutes ago, brianzinn said: The box doesn't have that parameter, but the other shapes do! The parameter can be used to increase accuracy or reduce poly count. I think you mentioned cone or cylinder before - it has subdivisions (same with IcoSphere). Also, circle has segments. So, the other shape creation methods probably have what you are after. More segments on a square will increase triangles and obviously have the same shape, though! I can imagine some use cases still. I see that other shapes have that parameter. On the box would be useful for 3D modeling puposes brianzinn 1 Quote Link to comment Share on other sites More sharing options...
JohnK Posted July 20, 2018 Share Posted July 20, 2018 See if this is useful http://doc.babylonjs.com/snippets/increasing_facets leota 1 Quote Link to comment Share on other sites More sharing options...
leota Posted July 20, 2018 Author Share Posted July 20, 2018 19 minutes ago, JohnK said: See if this is useful http://doc.babylonjs.com/snippets/increasing_facets Yes it is. It's not exactly what I was looking for, as it applies a uniform subdivision, but it's good enough. Thanks! 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.