Open slapin opened 7 years ago
As I see the actual splitting should not be done directly on mesh by using Blender API as that will lead to seams. So as I see the actual geometry should be processed and multiple .mdls should be written...
Usually the head has a lot of bones so you normally behead your character with a cut just below the jaw or below the neck near the clothes. It is an artistic choice, you can't do it programmatically. About the seams, if you have texture seams because you use different and not aligned textures for head/hands/body, you can try to conceal them with clothes. If you have normal seams, so you see a crease on the neck/hands, you can try an addon to edit normals and make them equal, maybe even the Blender normal modifiers can do this.
Edit: this addon https://github.com/fedackb/yavne seems useful.
Well, I think that mesh splitting can be done programmingly, and that would allow to avoid any work on the model itself. This allows more straightforward workflow, as mesh can be handled as whole, including morphs, etc. Working with split mesh have some downsides. Also requiring clothes to fix seams looks like very bad design choice... As that sets limits on which clothes are and how they are designed. I don't have texture seams, it is more like smoothing (normal) seams. I have basic idea on how to split mesh, it is not really hard. It is more about carefully tracking indices. And I think while it is better to have such things in engine directly (as engine knows the current bone limit) it have better chances to be implemented in exporter, as it is easier to do there than in engine. It is highly unlikely I will do anything C++ any time soon. Zero fun experience :(
On Sun, Apr 30, 2017 at 2:24 PM, reattiva notifications@github.com wrote:
Usually the head has a lot of bones so you normally behead your character with a cut just below the jaw or below the neck near the clothes. It is an artistic choice, you can't do it programmatically. About the seams, if you have texture seams because you use different and not aligned textures for head/hands/body, you can try to conceal them with clothes. If you have normal seams, so you see a crease on the neck/hands, you can try an addon to edit normals and make them equal, maybe even the Blender normal modifiers can do this.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/reattiva/Urho3D-Blender/issues/64#issuecomment-298226457, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAX03OH53mUy9-lcwr0jte4lQUnZrceks5r1G9ngaJpZM4NJfJE .
Does using "Merge objects" in combination with "One vertex buffer per object" can help ?
No, I don't think so. The reason for problem is limit of uniform variables for shader, so these should be different vertex buffers, as these contain the indices. I think some automagic model split, which would count number of different boneindices and if they are above threshold, starts new model. I started doing it, but a problem is I don't have enough knowledge of VBs/IBs/possible corner cases to resolve this task - I had some success with splitting a model and chunks have no side effects, so the actual path is right. The problem is in details. This task should be much easier when generating new model, as you don't have to track polygons and vertex repetitions together with blendindices, so just adding check and discarding the rest of geometry I get working, but incomplete model. Then I need to restart model with new name, then start filling it with remaining data, and repeat until complete. If tracking data on polygon basis (i.e if we find that a poly is filled our index counter, we discard the whole poly for next model). there should not be any side effects. I did simplified version which did not track triangles and got fully working set of models (but some triangles were missing), which supports theory that it should work. Theory and logic also says that generating single multi-geometry model with each geometry having its individual VB should work the same way, but this seems to be not the case. Probably there are some shader limitations for multi-geometry models, so model splitting is the only option.
@Mike3D @reattiva if I was told how the exporter handles model/tris vs VB filling I think I could produce something working myself, but I really can't understand the workings without help.
I think I'm saying nothing you already not know, but anyway: everything is done in DecomposeMesh, the mesh is tessellated in triangles, for each face, for each vertex, look in the vertex buffer if the vertex is new, in that case add it to the vertex buffer and index buffer, otherwise (the vertex is already present in the VB) only add it to the index buffer. It's a shame but the details on how it works, seem arabic to me now.
Current exporter could split mesh geometry if number of bones is too high per mesh. Basic humanoid won't fit into 20-64 bone limitation (30 face + 20 2 legs + 20 2 arms + 25 body) and hand-splitting makes working with mesh really hard (visible seams, morphs, etc.). I think exporter could help here by splitting mesh geometry automatically so that it will not go beyond limitation. Any ideas on how can I do this?
Or should this be done in engine at load time? But in this case, what should be done and where? I specially need to export fully-featured mesh as I make character customization system, so it should feel as whole, which means the actual splitting should be done as last step.
@reattiva @Mike3D Any ideas on how can I approach this? Thanks!