honya Posted June 9, 2019 Share Posted June 9, 2019 Hi, i create plugin in c++ for merge nodes to one mesh with our logic and some generated meshes will cause crash editor when i try open folder in asset browser. I simply use function addMeshSurface for it to merge same surfaces to one from source mesh where i fix position of vertexs, normals and tangents. Also some meshes cannot open even in resource editor. You can they find in 977 changeset on our repo in folders: .\data\merge\meshes - this meshes can show and open in empty unigine project, but editor crash when i open this folder in asset browser. .\data\merge\not_worked - this meshes cause hard crash of editor without exception, when i open this folder in asset browser and also i cannot open them in resource editor. Source nodes are in folder .\data\merge. Can you check it and tell me, why cannot editor process them? Thanks Honya Link to comment
vvvaseckiy Posted June 10, 2019 Share Posted June 10, 2019 Hello honya, I reproduced this problem, but for now i can't figure out what is the cause of crash. I've forwarded this issue to our RnD team. Meanwhile, since that engine crashes on vertex creation, it would be helpful if you specify exact operations you perform on vertices UPD. Also it is possible to open mentioned meshes in 3dsMax 2015 with UnigineMeshImport plugin. Unfortunately 3ds Max shows no additional errors or warnings, but after exporting same model to .mesh, it's working fine in Editor and engine. Thank you Link to comment
demostenes Posted June 10, 2019 Share Posted June 10, 2019 (edited) Hello, we are creating tool for automatical mesh optimization (merge in Unigine, discard LODs, send to Siplygon, receive LODs from Simplygon, merge into previously created mesh in Unigine). This is the first stage and code should do following: Take all meshes in given node (can be hundreds of node references there), merge into one mesh all surfaces not containing LOD1 and bigger, merge surfaces with the same material, assign proper material. Currently output is mesh with discarded LODs and merged surfaces with same material. Thanks. merge.cpp merge.h Edited June 10, 2019 by demostenes Link to comment
demostenes Posted June 13, 2019 Share Posted June 13, 2019 I would also like to ask how to copy normals, currently it does not copy it and since there are normals modified by hand, it must be copied, not recalculated. Thanks! Link to comment
vvvaseckiy Posted June 13, 2019 Share Posted June 13, 2019 28 minutes ago, demostenes said: I would also like to ask how to copy normals, currently it does not copy it and since there are normals modified by hand, it must be copied, not recalculated. Thanks! There's catch when serializing normals, please check out this topic. If that's not the issue, please give us more details on what you're trying to do. Thank you for sharing the code of mesh merging, it will help on figuring out the problem, but for now there's no updates on main issue Thanks Link to comment
demostenes Posted June 13, 2019 Share Posted June 13, 2019 We take mesh, apply transformations and then use addSurface function to merge into target mesh. It does not seem, that addSurfaces copies normals as well. Do we need to handle normals separately? Link to comment
morbid Posted June 20, 2019 Share Posted June 20, 2019 Hi, At the moment we can't provide the developer for the issue, so no updates. Will try to investigate this further next week. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
demostenes Posted July 1, 2019 Share Posted July 1, 2019 Any progress? We would like to know, why we are creating crashing mesh and how to copy normals properly (currently we need to smooth mesh in resource editor, because normals of some surfaces are wrong). Thanks. Link to comment
morbid Posted July 1, 2019 Share Posted July 1, 2019 Hi, Sorry it takes that long. At the moment we're finishing important features for 2.9, so it's hard to switch any of developers to the supplemental task. We'll try to give you feedback on the issue by thursday-friday. Thank you. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
morbid Posted July 1, 2019 Share Posted July 1, 2019 6 hours ago, demostenes said: We would like to know, why we are creating crashing mesh It looks like that the sample mesh was created by merging regular vertices with vertices where vertex color was applied. Does this sound like your case? Please, check this version. 6 hours ago, demostenes said: how to copy normals properly MeshStatic calculates tangent basis according to the original normals. Method addMeshSurface copies them. So the manually created normals should be safely transferred from tangent basis. Hope this helps. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
demostenes Posted July 1, 2019 Share Posted July 1, 2019 (edited) 5 hours ago, morbid said: It looks like that the sample mesh was created by merging regular vertices with vertices where vertex color was applied. Does this sound like your case? Please, check this version. Object is made from hundreds of meshes, so it is possible, that some of them have vertex color (we dont use this feature at all, but since some assets are bought from marketplace, it is possible, that they have some vertex color). We dont try to merge any vertexes, we only merge surfaces with same material. On the other side if we create mesh (or fbx) manually via editor, it does not crash, so this does not have any impact and there must be something wrong in our code (or does fbx/mesh exporter handle this in some way?). Unfortunately we cant work with editor created fbx or mesh because after export we loose information which material was on which surface. This is the reason, why we wrote our own exporter, which is going through all subnodes of selected node, takes meshes, applies rotations and scale and adds surfaces to target mesh (editor fbx/mesh exporter must do something similar). And finally we rename merged surfaces according to used material. 5 hours ago, morbid said: MeshStatic calculates tangent basis according to the original normals. Method addMeshSurface copies them. So the manually created normals should be safely transferred from tangent basis. We thought so, but created mesh has some surfaces black in resource editor (surfaces, which are from node with some rotation). This probably means, that we work with rotations in wrong way, but honesly we dont know where is the problem. Thanks! Edited July 1, 2019 by demostenes Link to comment
morbid Posted July 2, 2019 Share Posted July 2, 2019 Well, I can suggest wiping vertex color value before the merge starts. As for the normals. I'm afraid we can't research your code deeper at the moment. Everyone is busy with pre-release tasks. We'd be glad to come back to the problem a bit later if you can wait. Thanks. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
honya Posted July 2, 2019 Author Share Posted July 2, 2019 @morbid The editor crashing was caused by vertex colors. After add this code below in function where modify source mesh, i can add to world generated mesh in editor mesh.get()->setNumColors(0, surfaceId); Thanks for the hint. Honya Link to comment
honya Posted July 3, 2019 Author Share Posted July 3, 2019 (edited) I try function setSurfaceTransform to set world transform from node to surface and its work right to me. It add surface with right coordinates and normals are copy right too. So its not blocking for us now. Honya Edited July 3, 2019 by honya Link to comment
demostenes Posted July 3, 2019 Share Posted July 3, 2019 (edited) Please close topic, thanks for help. Edited July 3, 2019 by demostenes Link to comment
Recommended Posts