GLB creates multiple groups instead of combining like brush types

Encountering issues importing into unity for worlds. When using a GLB, there are too many nodes so I have to group like brush types in Blender to reduce draw calls. When you correct this issue in blender and export as a glb, it's a broken file and all of the special particle brushes (embers, smoke, etc) break. Can't use FBX anymore with particle brushes because they cause artifacts and the brushes dont appear or work as they normally do so GLB is really the only option to get all brush types working. Using glb on export is great but unless the brush types are grouped together (like we tried way back), joining in blender is mandatory. If this isn't done, frame rates tank. This solution would help a lot of people creating worlds or using assets created in OB for game dev.
No description
18 Replies
Zandy
Zandy11mo ago
Example here: Hundreds of like brush strokes that need to be joined ....its a lot of work to do this. The screenshot is a small example of what is going on. Maybe a different type of solution for this would be in the toolkit where a script could be run for models on import to Unity to merge like brush strokes so it doesn’t interfere with OB itself in game. I think last time we did this there were export issues with shaders not showing on models (the snowman post way back). But then again I don’t think you had a cap on brush strokes for the export. Not sure if that would break the particle brushes doing it externally. Just trying to brainstorm here This May break anyway because you would need to remap UV’s once brush strokes were joined esp for hulls in blender to apply different materials in Unity and for it to bake properly. The hulls exported from TB/OB never have proper UVs. They always have to be deleted and remapped in Blender and that will break the GLB file again.
andybak
andybak10mo ago
If I recall correctly we managed to reduce the number of separate game objects by switching to Unity's large mesh format (they are being split because a regular mesh has a limit of 65536 vertices) But this caused a problem elsewhere so I had to remove it. I should take another look to see if I can solve this. (incidentally fbx will have the same problem I believe as it's a Unity limitation not a glb limitation. So even if we solved the fbx texture issue we'd still hit this problem) For reference here's the commit that reverted the change: https://github.com/icosa-gallery/open-brush/commit/3940924a4b02e547e21ed2bc731329661941c543 Thinking about it, we probably just need to set mesh.indexFormat = IndexFormat.UInt32 in the toolkit code as well But - another reason I reverted it was because I wasn't sure about the knock-on effects. We probably want to make it optional. (or even PC only?) It's an ideal candidate for a config file switch.
Zandy
Zandy10mo ago
We had an issue with certain shaders not being applied after the limit increased. (Sent you my snowpeople) Not sure how or why that would impact the glb itself. Optional would be great maybe with the built in decimation/optimization tool? Sometimes I have to work with both fbx and glb for one piece because the glb will make the particles brushes show, fbx does not which is weird since the original TBT worked fine with those shaders. Maybe it’s because of the unity version? Had to use fbx to remap UV’s on hulls or they won’t bake
andybak
andybak10mo ago
@mikesky - now Open Brush has the option to export large meshes - we need to support this in the SDK/Toolkit also. I've got a commit that forces SDK/Toolkit to use large meshes. Making it either optional or smart enough to do it only when needed looks tricky so I prospose we default to "large meshes" always for now. I don't want to spend ages on the GLTF import code if we're going to replace it with GLTFast at some point. For anyone else following this issue - it's now in the current beta. Add:
"LargeMeshSupport": true
"LargeMeshSupport": true
to the "flags" section of your Open Brush config file
Zandy
Zandy10mo ago
Thanks again, @andybak ! Do you know when the update to TBT is projected to be available?
andybak
andybak10mo ago
Did the fixes I sent you work?
Zandy
Zandy10mo ago
I was afraid to try and break my world (my biggest one). Just making a copy now and will test
andybak
andybak10mo ago
So that is the update to TBT!
Zandy
Zandy10mo ago
Ahhhhh ok so just add those files in explorer
andybak
andybak10mo ago
yes. i pushed them to the repo here: https://github.com/icosa-foundation/open-brush-toolkit/tree/feature/large-mesh-support - but it's marked as untested until someone confirms if it works
GitHub
GitHub - icosa-foundation/open-brush-toolkit at feature/large-mesh-...
Scripts and assets that help you use Open/Tilt Brush data in your creative projects. - GitHub - icosa-foundation/open-brush-toolkit at feature/large-mesh-support
Zandy
Zandy10mo ago
Will definitely test this!!! Thanks again! Downloading now. So just reinstall TBT? when I "click here for the latest download" there is a 404 error got the right one on the side though...that other link is broken Andy, that one says Jan 19th I think I have the wrong one. Please advise....
andybak
andybak10mo ago
So just reinstall TBT?
No? Just do exactly what I said when I sent you the files. Copy them into the correct location using Explorer
Zandy
Zandy10mo ago
ok will do Will get back to you later today. Still copying files from the build and have another hr and a half to go
andybak
andybak10mo ago
ok. stop! you don't need to do all that if you copy over those two files, then you can revert just by copying the originals back. Worst case scenario - you get in a muddle - just delete the whole scripts folder and copy it in from another working project and if you really want to duplicate a whole project - it should never take 1.5 hrs. Don't forget - you only need 3 folders: Assets, Packages and ProjectSettings. Always ignore Library - it's huge and Unity will just recreate it if it needs to (get a fast SSD drive and put all your Unity stuff on that if you're not. Old style hard drives are way too slow nowadays) (and make sure you're connecting external SSDs via the right socket - some USB sockets are 10x or 100x slower than others)
Zandy
Zandy10mo ago
Thanks for the tips....stepped away though (played some COD while waiting...lol..I'm a big time old school gamer) and just got this.lol Its copied, always on externals but will just do the assets, projects and packages next time. Just opening the file and getting ready to test. ok here's the result: 1.) deleted the old 2 files from the scripts folder in explorer and replaced importGltf.cs and EditorUtils.cs did not delete the meta files with the same name. 2) reimported the models that had repeats of the same brush type on different nodes or multiples of the same type. 3) No change in joining Looks the same as the original. Shoot....its because I exported from the experimental build hang on....
Zandy
Zandy10mo ago
still a no go. It is working technically but shes got bits missing parts on etc of full original model. (trying to be polite here)😄
No description
No description
No description
andybak
andybak10mo ago
ok. Can you send me the gltf and super ultra clear instructions on how to verify if there's something missing? like - make it really easy for me 😉 in fact - send me the sketch if possible. i'll try the whole workflow
Zandy
Zandy10mo ago
The original model is to the left, the piece on the right is with large mesh export. Only one boob shows, and is generated not all of her 😂 So I think the items grouped and placed after to sculpt the piece aren’t being generated at the same time for export.