jorditantadiaz Posted January 19, 2017 Share Posted January 19, 2017 Hi, i am trying to subdivide a mesh, after load it by OBJLoader on BabylonJS, but i don't understand how do something like this (ThreeJS). var geometry = new THREE.Geometry().fromBufferGeometry( mesh_.geometry ); var modifier = new THREE.SubdivisionModifier( 3 ); modifier.modify( geometry ); geometry.mergeVertices() mesh_.geometry = geometry But on Babylon JS, i could not found documentation about how subdivide polygons after load mesh by OBJLoader Quote Link to comment Share on other sites More sharing options...
JohnK Posted January 20, 2017 Share Posted January 20, 2017 Hi there and welcome to the forum. Not really sure if this is what you want to do or not but maybe useful http://babylonjsguide.github.io/snippets/Increasing_Facets A facet is one of the trianglular planes that make up a mesh adam 1 Quote Link to comment Share on other sites More sharing options...
adam Posted January 20, 2017 Share Posted January 20, 2017 BJS does not currently have a mesh subdivide feature. Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted January 20, 2017 Share Posted January 20, 2017 @jorditantadiaz @adam Wouldn't splitting it into subMeshes be the same? or am i completely off as to what threeJs "subdivide" is? subMeshes like when using multi-materials; https://www.eternalcoding.com/?p=283 Quote Link to comment Share on other sites More sharing options...
adam Posted January 20, 2017 Share Posted January 20, 2017 My understanding is that it is the same as the subdivide in blender. http://blender-manual-i18n.readthedocs.io/ja/latest/modeling/meshes/editing/subdividing/subdivide.html Quote Link to comment Share on other sites More sharing options...
jerome Posted January 20, 2017 Share Posted January 20, 2017 I guess Jorditantadiaz looks for this : https://threejs.org/examples/webgl_modifier_subdivision.html Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted January 20, 2017 Share Posted January 20, 2017 ahh Quote Link to comment Share on other sites More sharing options...
jorditantadiaz Posted January 20, 2017 Author Share Posted January 20, 2017 Thanks @JohnK i am going to try it. @jeromeYou are right i want to do that but on Babylon JS not in ThreeJS. @adam Yes!!, i am trying to do the same as the subdivide in blender, if there is not a subdivide in BabylonJS, is there any way to increment polygons on mesh? Quote Link to comment Share on other sites More sharing options...
adam Posted January 20, 2017 Share Posted January 20, 2017 One thing you could do is subdivide it in your modeling software and then simplify it in BJS. Quote Link to comment Share on other sites More sharing options...
adam Posted January 20, 2017 Share Posted January 20, 2017 http://doc.babylonjs.com/tutorials/In-Browser_Mesh_Simplification_(Auto-LOD) Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted January 20, 2017 Share Posted January 20, 2017 @jorditantadiaz While there actually is a mesh.subdivide(number) function, it doesn't seem to update the mesh. " But unfortunately (As we try to simplify rendering) we do not have a way to increase mesh complexity "-Deltakosh a "work-around" that might work for you, would be to have several LOD's of your model.http://www.babylonjs-playground.com/#1DTMBL#1 // Click on the sphere. Quote Link to comment Share on other sites More sharing options...
jorditantadiaz Posted January 20, 2017 Author Share Posted January 20, 2017 @adam Yeah but if i do that i will need to download a big file and that is not a option for me D: Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 20, 2017 Share Posted January 20, 2017 And the use of octree does not make it that ? mesh.createOrUpdateSubmeshesOctree(); //To call at the end of the loading of your scenes and subdivide exist: => http://doc.babylonjs.com/classes/2.5/Mesh#subdivide-count-rarr-void In a single line you do what ThreeJS does in 5 lines mesh.subdivide(3); //Value 3 may not work. Try another value if that is the case. Quote Link to comment Share on other sites More sharing options...
adam Posted January 20, 2017 Share Posted January 20, 2017 @Dad72 it doesn't do the same thing, though: Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 23, 2017 Share Posted January 23, 2017 Correct me if I'm wrong but you can also delete the current object and recreate it with more subdivisions right? Like playing with the tesselation parameters of Sphere or Disc? (https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.meshBuilder.ts#L74) Quote Link to comment Share on other sites More sharing options...
Nabroski Posted January 24, 2017 Share Posted January 24, 2017 for (var lod = 1; lod <= MESH_LOD; ++lod) easy Quote Link to comment Share on other sites More sharing options...
jorditantadiaz Posted February 21, 2017 Author Share Posted February 21, 2017 @Dad72 It's something like that, but for example, subdividing modifier into ThreeJS, it increases my vertex and smooth my geometry. https://threejs.org/examples/webgl_modifier_subdivision.html 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.