jdurrant Posted April 27, 2017 Share Posted April 27, 2017 I have a Blender test scene with two objects. One is a complex "tube," and the other is a high-resolution test cube. Both have UVs. The test cube has 58,984 verts, and the tube has 62,808 verts. So both come in under the ~65,500 limit for exporting as a single mesh. When I export using the Babylon.js ver 5.2.1 exporter, the test cube is exported as a single mesh, but the tube is divided into multiple meshes. The log file suggests there are far more tube verts that Blender reports: Exporter version: 5.2.1, Blender version: 2.78 (sub 0) ========= Conversion from Blender to Babylon.js ========= Scene settings used: selected layers only: false flat shading entire scene: false inline textures: false texture directory: /Users/jdurrant/Documents/Work/durrant_git/protein-vr/webapp/scenes/influenza/ Python World class constructor completed processing begun of mesh: Cube processing begun of Standard material: Material num positions : 63245 num normals : 63245 num uvs : 126490 num uvs2 : 0 num colors : 0 num indices : 353892 processing begun of mesh: NA_patch_single_tube processing begun of Standard material: Material.003 num positions : 65534 num normals : 65534 num uvs : 131068 num uvs2 : 0 num colors : 0 num indices : 107769 WARNING: The following mesh has exceeded the maximum # of vertex elements & will be broken into multiple Babylon meshes: NA_patch_single_tube processing begun of mesh: NA_patch_single_tube1 registered as also a user of material: Material.003 num positions : 65535 num normals : 65535 num uvs : 131070 num uvs2 : 0 num colors : 0 num indices : 107043 processing begun of mesh: NA_patch_single_tube2 registered as also a user of material: Material.003 num positions : 65533 num normals : 65533 num uvs : 131066 num uvs2 : 0 num colors : 0 num indices : 125214 processing begun of mesh: NA_patch_single_tube3 registered as also a user of material: Material.003 num positions : 21593 num normals : 21593 num uvs : 43186 num uvs2 : 0 num colors : 0 num indices : 29625 processing begun of camera (FreeCamera): cmra ========= Writing of scene file started ========= ========= Writing of scene file completed ========= ========= end of processing ========= elapsed time: 0 min, 16.3766 secs When I view the scene in the browser, it ends up looking checkered (perhaps related): Thanks so much for your help! Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted April 27, 2017 Share Posted April 27, 2017 The problem is that in order to re-use a vertex with multiple triangle faces, not only do they need to share the same position, but also same normal, UV, vertex color, & matrix weights if being used. Cannot comment on the alternating pattern. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 27, 2017 Share Posted April 27, 2017 For the alternating pattern, are you using a texture? or is it just a plain material Quote Link to comment Share on other sites More sharing options...
jdurrant Posted April 28, 2017 Author Share Posted April 28, 2017 Thanks for your help, guys. So re. the vertex count, I'm guessing it's because of the mesh's complexity. Different UV coordinates had to be assigned to the same vertices. What a mess! Do you agree that that's the culprit, then? Re. the material, it is the standard material with an ambient texture. Here's the gist: var mat = new BABYLON.StandardMaterial("some_name", scene); mat.diffuseColor = new BABYLON.Color3(0, 0, 0); // to make shadeless mat.emissiveColor = new BABYLON.Color3({some_val}, {some_val}, {some_val}); mat.specularColor = new BABYLON.Color3({some_val}, {some_val}, {some_val}); mat.ambientTexture = new BABYLON.Texture("shadow.png", scene); mesh.material = mat; When I use the texture in Blender, it looks great: Thanks! Great community you've got here. Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted April 28, 2017 Share Posted April 28, 2017 Can you show us the diffuse texture which is baked at the export ? ('cause you have Cycles materials) [edit] or maybe theses artefacts appears due to alpha ? [/edit] Quote Link to comment Share on other sites More sharing options...
jdurrant Posted April 29, 2017 Author Share Posted April 29, 2017 Hi V!nc3r. Just to be clear, I was using Blender to show that the textures do render correctly in that context. I'm not using the diffuse texture that Blender would export. Though I am using the baked shadow texture. Here it is: Quote Link to comment Share on other sites More sharing options...
jdurrant Posted April 29, 2017 Author Share Posted April 29, 2017 Also, for what it's worth, I tried different backFaceCulling settings on the material (true and both), but that didn't fix the problem either. Thanks! Quote Link to comment Share on other sites More sharing options...
jdurrant Posted April 29, 2017 Author Share Posted April 29, 2017 Hi all. I was able to resolve this problem by unwrapping the mesh manually (marking seams, etc.). I also divided the mesh into four separate meshes, which may have contributed to the solution. I'm still not certain why it happened on the other version of the mesh, though. For what it's worth, with the new manual unwrapping the mesh did not have to be divided on export. I suspect that's where the problem lies. With low-res shadow map: Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted May 1, 2017 Share Posted May 1, 2017 Looks like some kind of folded protein. I think to truly isolate the problem to the mesh division, you would actually need to export the mesh without any material at all. In any case, I am adding an option to turn off the mesh splitting feature. That's right it is a feature to allow very large meshes to run on old WebGL implementations. This just made it on the very end of the Source Code Exporter, Tower of Babel, 5.3 release being finalized today. Making the JSON exporter is largely a file diff exercise I do using Netbeans. Here is the TOB UI with the switch. FYI, if a mesh requiring more than 64k vertices contains multi-materials or shapekeys, it will be exported as a single mesh regardless. V!nc3r 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.