GameMonetize Posted April 10, 2017 Share Posted April 10, 2017 Hey team!!! I'm pleased to announce the availability of morph targets! Please read more here:http://doc.babylonjs.com/tutorials/how_to_use_morphtargets Vousk-prod., jessepmason, MarianG and 9 others 12 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 10, 2017 Author Share Posted April 10, 2017 @JCPalmer: Would you havetime to add it to the blender exporter? I'll add serialize+parse support tomorrow in bjs Quote Link to comment Share on other sites More sharing options...
gryff Posted April 11, 2017 Share Posted April 11, 2017 3 hours ago, Deltakosh said: I'm pleased to announce the availability of morph targets! Shape keys finally arriving !! cheers, gryff Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted April 11, 2017 Share Posted April 11, 2017 Not going to prioritize over my work, but will add. There are many things from my implementation which should help, like keeping track of Blender's vertices as they are being added. The exporter, as you know, grabs things in material order & duplicates vertices at the borders where the material changes. Part of the shapekey code can be kept, but think it needs to be reworked. Your GPU implementation's restriction on having the exact same # of vertices is going to require shutting of groups. I allow a group of the entire mesh, but it still tries to optimized out vertices which are un-affected. Normals are not going to get passed though. Am reading Shapekeys directly, not mesh posing like an armature for an action. Shapekeys do not have normals themselves. Normals are derivative data. Have progressed from my own calculations of a targets normals to using @jerome's, which were faster than my own. There are minor creases in some of my scenes with makehuman. Think it is actually a makehuman issue. Have a triangulation idea of as the vertex changed from the basis (direction), make the corresponding change to the basis normal. Should be faster than calcing a normal too. See creasing highlighted. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted April 11, 2017 Share Posted April 11, 2017 That's cool. I was waiting for this feature for a long time. it's nice to see. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 11, 2017 Author Share Posted April 11, 2017 @JCPalmer: Thanks a lot! If you cannot do it or don't have time for it, please let me know. I'll try to dig again into Python code Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted April 12, 2017 Share Posted April 12, 2017 I have looked at the TOB version of my code base. I find in my ShapeKeyGroup.py file that I had broken out extracting the keys / targets from organizing them into groups. This is a class called RawShapeKey. I added the constructor arg, allowVertReduction, which when passed as False does not log how many vertices are actually different from the original value. RawShapeKey could have a to_scene_file() added: # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - def to_scene_file(self, file_handler): file_handler.write('{') ... file_handler.write('}') This not going to be something I am going to do for a while. I am in the process of finalizing Mesh.py unrelated to a .babylon. Will adjust the logic to work with or without groups. There are other things I am doing to close code for the mesh code, but when done will: copy ShapeKeyGroup.py file to BJS repo, & hook it up in __init__.py Merge the flow control to create either RawShapeKeys or RawShapeKeys & ShapeKeyGroups in Mesh.py That would leave the flow control in Mesh.to_scene_file() to write the keys. This along with the actual writing, shown above. This primarily a plumbing job. I'll do it, but not for about a month or so. Quote Link to comment Share on other sites More sharing options...
ozRocker Posted April 13, 2017 Share Posted April 13, 2017 OMG YES!!! I no longer have to have my avatars moving around with blank expressions on their faces jessepmason 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 13, 2017 Author Share Posted April 13, 2017 Thanks a lot @JCPalmer Quote Link to comment Share on other sites More sharing options...
ozRocker Posted April 14, 2017 Share Posted April 14, 2017 "Please be aware that most of the browsers are limited to 16 attributes per mesh. Adding a single morph target to a mesh add 2 new attributes (position + normal). " So this means we can only have max 8 morph targets? Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted April 14, 2017 Share Posted April 14, 2017 I have my own implementation of morphing, QueuedInterpolation extension, so not an authority on this new one. Would say that positions, normals, UV1, UV2, vertex colors, matrix weights, matrix indices, ( matrix weights extra, and matrix indices extra for more than 4 influencers ) each also take up an attribute. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 14, 2017 Author Share Posted April 14, 2017 @ozRocker Correct Quote Link to comment Share on other sites More sharing options...
ozRocker Posted April 16, 2017 Share Posted April 16, 2017 Does anyone know how I can use Blender exporter for morph manager. I tried 2 meshes with exact same vertex number but the exporter made one 9,350 vertices and the other 9,352 vertices so I can't use them with morph manager. I'm not sure if the exported vertices are in the same order either. Quote Link to comment Share on other sites More sharing options...
ozRocker Posted April 16, 2017 Share Posted April 16, 2017 ok, I had to use the objLoader because that doesn't mess with the vertices. I've got a demo here: http://punkoffice.com/weight This is just a simple "weight gain" example. This mesh has about 7,000 quads. I've realised that for every blendshape I need to replicate another 7,000 quads. This could get expensive! Edit: I just realised the PBR material doesn't work with the morph target. It just shows the original mesh shape. Click on "Disable diffuse map" to see what I mean Quote Link to comment Share on other sites More sharing options...
ozRocker Posted April 17, 2017 Share Posted April 17, 2017 I'm using an iPhone 6+ with iOS 10.3.1 and its breaking. I've attached the console output Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 17, 2017 Author Share Posted April 17, 2017 Does this one works? https://www.babylonjs-playground.com/#HPV2TZ#6 if yes can you repro your issue in the PG? Quote Link to comment Share on other sites More sharing options...
ozRocker Posted April 18, 2017 Share Posted April 18, 2017 10 hours ago, Deltakosh said: Does this one works? https://www.babylonjs-playground.com/#HPV2TZ#6 if yes can you repro your issue in the PG? Yes that works. I've made a playground here using my mesh: http://www.babylonjs-playground.com/#28YUR5#201 I can't get it to compile. I have to use an OBJ loader but this OBJ loader loads one of the meshes as twice the number of vertices as the first mesh. I don't know any other way to load an OBJ in the playground Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 18, 2017 Author Share Posted April 18, 2017 I have no issue either Quote Link to comment Share on other sites More sharing options...
ozRocker Posted April 18, 2017 Share Posted April 18, 2017 I think I need to wait for an upgrade to the Blender exporter and OBJ loader cos at the moment none of them are supporting mesh duplicates properly Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 19, 2017 Author Share Posted April 19, 2017 Not sure what mesh duplicates is? Can you explain? Perhaps I can help Quote Link to comment Share on other sites More sharing options...
ozRocker Posted April 19, 2017 Share Posted April 19, 2017 2 minutes ago, Deltakosh said: Not sure what mesh duplicates is? Can you explain? Perhaps I can help I'm using the .OBJ file here http://preview.punkoffice.com/morph/weight.obj In that .OBJ there are 2 meshes. There's the normal girl. Then what I did was simply "duplicate" her so I have a copy with exact same vertices, then I made her fat. In Blender and when using SceneLoader it properly shows that they both have 7,405 vertices, but in the method I'm using in the playground one has 7,405 and the other has 14,810 (exactly double). You can see in the console output Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 19, 2017 Author Share Posted April 19, 2017 Ok see my response in your other post You were using an old version of the obj loader (latest one is here: https://github.com/BabylonJS/Babylon.js/blob/master/dist/preview release/loaders/babylon.objFileLoader.js) Quote Link to comment Share on other sites More sharing options...
ozRocker Posted April 19, 2017 Share Posted April 19, 2017 I figured out what's wrong. I get this crash on everything when I use the latest preview version of babylon.js (I downloaded it from GIThub 10 minutes ago). I've applied that preview version to my old stuff that just displays a mesh from a .babylon file and it crashes at executeWhenReady(). They all do. Fine in desktop browsers but crashes in iOS. So its nothing to do with the morphing code that I'm using. However, I don't get any errors when morphing in the playground. Is the playground using a different version of babylon.js? I've attached the output Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 19, 2017 Author Share Posted April 19, 2017 Playground uses the latest preview version as well Can you share the code you are using? Quote Link to comment Share on other sites More sharing options...
ozRocker Posted April 20, 2017 Share Posted April 20, 2017 I found the problem with my coding. I did this to check if webGL is supported: function webgl_detect(return_context) { if (!!window.WebGLRenderingContext) { var names = ["webgl", "experimental-webgl", "moz-webgl", "webkit-3d"], context = false; for(var i=0;i<4;i++) { try { context = canvas.getContext(names[i]); if (context && typeof context.getParameter == "function") { // WebGL is enabled return true; } } catch(e) {} } // WebGL is supported, but disabled return false; } // WebGL not supported return false; } which is stupid because I can just use BABYLON.Engine.isSupported() instead. But that code above gave all those errors with the preview release of babylon.js So now if you go to http://punkoffice.com/weight you'll see that it works on desktop and mobile gryff 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.