Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Instantiating characters on runtime
#1
Hello, I am trying to instantiate up to 9 characters on runtime and I am facing some issues, I have the solver attached to main camera, and when I instantiate the objects I get the solver component and assign it to the cloth objects but they don't seem to be moving, if I give each prefab its own solver so I don't have to assign it via script it really starts to lag.

The skirt has around 1k-1k2 vertex (is that too much maybe?) as it has some thickness, It would be good to know the max amount of vertex that it can handle without causing drop in fps (the game is targetted for mobile) I can modify the clothing so there is less movable cloth on each one of them.

Also is there a way to scale the cloth object? since scaling the parent object has no effect on the cloth.

Thanks!

[Image: Capture.png]
Reply
#2
(11-02-2018, 04:17 AM)Mystigan Wrote: Hello, I am trying to instantiate up to 9 characters on runtime and I am facing some issues, I have the solver attached to main camera, and when I instantiate the objects I get the solver component and assign it to the cloth objects but they don't seem to be moving, if I give each prefab its own solver so I don't have to assign it via script it really starts to lag.

The skirt has around 1k-1k2 vertex (is that too much maybe?) as it has some thickness, It would be good to know the max amount of vertex that it can handle without causing drop in fps (the game is targetted for mobile) I can modify the clothing so there is less movable cloth on each one of them.

Also is there a way to scale the cloth object? since scaling the parent object has no effect on the cloth.

Thanks!

[Image: Capture.png]

Hi Mystigan,

1200 x 9 = 10800 vertices is way too much for mobile. I'd never go over 1500-2000 in total. No wonder it lags when you set all them up. Also, if the cloth has thickness (that is, it isn't a single layer of triangles) you must use proxies to avoid the "bag" effect. This can also help you reduce the amount of simulated vertices greatly, as your simulated mesh and the renderer mesh can have different polycounts.

You should also really use local-space simulation for character clothing, as done in the CharacterCloth sample scene. This will allow you to scale cloth by scaling the ObiSolver transform (that should be at the character's root transform), as well as increase the stability of the simulation and increase your control of it (as you will be able to blend local and world space velocities).

Note that having separate solvers for each character is extremely beneficial in your case, as you can cull cloth simulation per-character (otherwise you'd be forced to simulate all characters as long as any of them was visible) and increase parallelism (better core utilization). You should not use a single solver for all of them.
Reply
#3
(11-02-2018, 10:30 AM)josemendez Wrote: Hi Mystigan,

1200 x 9 = 10800 vertices is way too much for mobile. I'd never go over 1500-2000 in total. No wonder it lags when you set all them up. Also, if the cloth has thickness (that is, it isn't a single layer of triangles) you must use proxies to avoid the "bag" effect. This can also help you reduce the amount of simulated vertices greatly, as your simulated mesh and the renderer mesh can have different polycounts.

You should also really use local-space simulation for character clothing, as done in the CharacterCloth sample scene. This will allow you to scale cloth by scaling the ObiSolver transform (that should be at the character's root transform), as well as increase the stability of the simulation and increase your control of it (as you will be able to blend local and world space velocities).

Note that having separate solvers for each character is extremely beneficial in your case, as you can cull cloth simulation per-character (otherwise you'd be forced to simulate all characters as long as any of them was visible) and increase parallelism (better core utilization). You should not use a single solver for all of them.
Thank you for this info, I will definitely optimize the mesh, is it possible to pause/resume the simulation? I am thinking that cloths will only be simulated when the character does any action if they are standing idle I should not simulate them.
Reply
#4
(11-02-2018, 07:38 PM)Mystigan Wrote: Thank you for this info, I will definitely optimize the mesh, is it possible to pause/resume the simulation? I am thinking that cloths will only be simulated when the character does any action if they are standing idle I should not simulate them.

Not currently for character cloth, but will probably add it in a future release.
Reply