ozRocker Posted July 14, 2018 Share Posted July 14, 2018 Is it possible to define polygroups or vertex groups? I know Blender allows you to define vertex groups. Is there a way to include that info in the .babylon export? Basically I want to be able to manipulate bodyparts vertices (not armature) babbleon and NasimiAsl 2 Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted July 14, 2018 Share Posted July 14, 2018 you run so fast :)))))) Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted July 14, 2018 Share Posted July 14, 2018 i try mix 2 morph vertex (first frame and last frame ) in one vertex buffer and send to shader that lose some Unrecognizable detail now i wanna attach motion so after that i have one mesh but have some small morph too but i don't have result yet but in this task you wanna change raw data to grouped data that is possible but if you ask to linked animation to them (like rig) it is different it is like write 3d geometry manager app in web Quote Link to comment Share on other sites More sharing options...
ozRocker Posted July 14, 2018 Author Share Posted July 14, 2018 I checked and it looks like groups are parsed in the OBJ importer public obj = /^o/; public group = /^g/; but "group" and "obj" will both create a new mesh //Define a mesh or an object //Each time this keyword is analysed, create a new Object with all data for creating a babylonMesh } else if (this.group.test(line) || this.obj.test(line)) { //Create a new mesh corresponding to the name of the group. //Definition of the mesh Maybe I can hack the OBJ importer to create array pointers to the groups. There's no animation here, but I want to avoid morph targets 'cos I want to manipulate the vertices mathematically Quote Link to comment Share on other sites More sharing options...
adam Posted July 14, 2018 Share Posted July 14, 2018 You might be able to use the Tower of Babel exporter for this. I've done this to make my character blink / squint. Quote Link to comment Share on other sites More sharing options...
brianzinn Posted July 14, 2018 Share Posted July 14, 2018 3 hours ago, ozRocker said: Maybe I can hack the OBJ importer to create array pointers to the groups. Not quite sure what you are after, but you could write your own custom mesh merge as well, if you want the meshes together and your own grouping. https://doc.babylonjs.com/how_to/how_to_merge_meshes#use-your-own-merge-function Pryme8 1 Quote Link to comment Share on other sites More sharing options...
ozRocker Posted November 24, 2018 Author Share Posted November 24, 2018 I finally got off my lazy ass and implemented a solution. You can see the result here: preview.punkoffice.com/bodyparts I altered the mesh.py file of the Blender exporter to parse the vertex groups. If anyone wants to see the code changes I've attached my version of mesh.py. The bits I added have # _NEW_ before the code. I'm not great at Python so maybe it can be improved. @JCPalmer this might be of use to you if you want to incorporate vertex groups. So the extra JSON in the .babylon file looks like this: "vertexGroups":[{"name":"waist","id":"waist","indices":[4053,4054,4055,405, etc....]}] In the Babylon.js code in the Mesh.parse function I added this ( @Deltakosh if you want to incorporate vertex groups you can use this) // Vertex groups if (parsedMesh.vertexGroups) { mesh.vertexGroups = parsedMesh.vertexGroups; } I also had to add a new function to find the vertex group: BABYLON.Mesh.prototype.getVertexGroupByName = function(vgName) { for (var i=0; i<this.vertexGroups.length; i++) { if (this.vertexGroups[i].name == vgName) return this.vertexGroups[i]; } return null; } I'm not sure if this is the best way so feel free to ignore if its not efficient, but it works for my needs. mesh.py Sebavan and brianzinn 2 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted November 25, 2018 Share Posted November 25, 2018 Up to my ears in 2.80 changes & TOB improvements right now. Will look at your file, but not right now. The tricky part about geometry exporting is multiple materials. Border vertices get duplicated across sub-meshes. Anything like this would have to be optional, since it would add to the file size in a significant way. There are going to be many changes to the next version of mesh.py. ozRocker 1 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.