26-01-2021, 08:51 AM
(This post was last modified: 26-01-2021, 03:58 PM by josemendez.)
There's several things that look off in the video.
- Some transforms in your character hierarchy have non-unit scale. There's one with 100, another with 200-ish. While it's not necessary to use unity-scaling for cloth, you need to compensate for it when building the blueprint, and this is often not easy for beginners as you need to use the inverse scale and understand transform hierarchies quite well.
By far the simplest solution is to always use unit scale on your transforms. This can easily be achieved by applying the transform values to your vertices before exporting. In Blender, Object->Apply->Scale, in Maya Edit->Freeze Transforms, etc.
The reason for using unit scaling is that cloth blueprints take a mesh as input, but a mesh may be transformed by many different transforms once drawn on scene. In your case, you're rendering the mesh 100 times bigger than it really is, but the cloth has been generated for the unscaled mesh. So you're simulating the cloth at unit scale, but drawing it 100 times larger. Scaling (and transforms in general) do not work as you'd expect for deformable objects since these are affine transforms, and can only transform rigid objects. At best, this will result in your mesh being invisible, at worst it will become a triangle soup.
Sorry if this is a lot of information condensed into a few lines. Takeaway is to always have clean transform hierarchies, and to always use real-world units when dealing with any kind of physics (your guys should be roughly 1.8 units tall).
- I see the bottom part of the character's cloth normals look bent. My guess is that this is because you're using two-sided flat meshes, which are non-manifold. You can model meshes any way you want, but the only restriction Obi puts on cloth meshes is that they must be 2-manifold. Otherwise, they won't be simulated.
This is warned about in the manual:
http://obi.virtualmethodstudio.com/tutor...setup.html
If you're unsure what non-manifold meshes are, there's tons of resources online describing it and explaining how to avoid/fix non-manifoldness. Roughly speaking, a non-manifold mesh defines a surface that cannot exist in the real world. A 2-manifold mesh, is a mesh that can be unfolded into a flat surface. This means all edges can belong to 1 or 2 faces, not more. No floating vertices, no zero-length edges, no zero-area faces, no adjacent faces with opposite normal direction, etc. This is the same restriction that 3D printers impose on meshes (as it's impossible to get a non-manifold mesh into the real world).
In the particular case of two-sided meshes, they're non-manifold because edges are connected to 4 faces at once (2 faces per side). The usual approach to flat two-sided meshes is not to duplicate and flip faces, but to just use a two-sided shader. It's cheaper, looks much better, and can actually be simulated.
- Finally, a personal observation: if you're aiming to add cloth simulation to a RTS, keep in mind that cloth simulation is expensive. Unless you have a really clear idea of what your ms/frame budget is and how much you want to spend on each specific thing (AI, pathfinding, rendering, etc), better add cloth simulation once you have all basic systems in place and you know for a fact how much extra time you can spend on eye candy.
Let me know if you need any help with this. Cheers!
- Some transforms in your character hierarchy have non-unit scale. There's one with 100, another with 200-ish. While it's not necessary to use unity-scaling for cloth, you need to compensate for it when building the blueprint, and this is often not easy for beginners as you need to use the inverse scale and understand transform hierarchies quite well.
By far the simplest solution is to always use unit scale on your transforms. This can easily be achieved by applying the transform values to your vertices before exporting. In Blender, Object->Apply->Scale, in Maya Edit->Freeze Transforms, etc.
The reason for using unit scaling is that cloth blueprints take a mesh as input, but a mesh may be transformed by many different transforms once drawn on scene. In your case, you're rendering the mesh 100 times bigger than it really is, but the cloth has been generated for the unscaled mesh. So you're simulating the cloth at unit scale, but drawing it 100 times larger. Scaling (and transforms in general) do not work as you'd expect for deformable objects since these are affine transforms, and can only transform rigid objects. At best, this will result in your mesh being invisible, at worst it will become a triangle soup.
Sorry if this is a lot of information condensed into a few lines. Takeaway is to always have clean transform hierarchies, and to always use real-world units when dealing with any kind of physics (your guys should be roughly 1.8 units tall).
- I see the bottom part of the character's cloth normals look bent. My guess is that this is because you're using two-sided flat meshes, which are non-manifold. You can model meshes any way you want, but the only restriction Obi puts on cloth meshes is that they must be 2-manifold. Otherwise, they won't be simulated.
This is warned about in the manual:
http://obi.virtualmethodstudio.com/tutor...setup.html
If you're unsure what non-manifold meshes are, there's tons of resources online describing it and explaining how to avoid/fix non-manifoldness. Roughly speaking, a non-manifold mesh defines a surface that cannot exist in the real world. A 2-manifold mesh, is a mesh that can be unfolded into a flat surface. This means all edges can belong to 1 or 2 faces, not more. No floating vertices, no zero-length edges, no zero-area faces, no adjacent faces with opposite normal direction, etc. This is the same restriction that 3D printers impose on meshes (as it's impossible to get a non-manifold mesh into the real world).
In the particular case of two-sided meshes, they're non-manifold because edges are connected to 4 faces at once (2 faces per side). The usual approach to flat two-sided meshes is not to duplicate and flip faces, but to just use a two-sided shader. It's cheaper, looks much better, and can actually be simulated.
- Finally, a personal observation: if you're aiming to add cloth simulation to a RTS, keep in mind that cloth simulation is expensive. Unless you have a really clear idea of what your ms/frame budget is and how much you want to spend on each specific thing (AI, pathfinding, rendering, etc), better add cloth simulation once you have all basic systems in place and you know for a fact how much extra time you can spend on eye candy.
Let me know if you need any help with this. Cheers!