Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Blueprint and Bind on runtime
#2
(03-03-2023, 11:52 AM)SimonP Wrote: 1. It is possible to copy each of the variables (Positions, rest, orientations, etc) from the Blueprint to a file and load them again individually in each field. If so, I should call some function once this process is done (This would save me 40s in models already made)

Hi Simon,

Blueprints are ScriptableObjects and can be saved in the project as an asset using AssetDatabase.SaveAsset. Once saved you can reuse them as much as you want. If you're doing this outside the Unity editor, then you need to serialize the data contained in the blueprint in a custom format of your choice, this is entirely up to you (just like you'd do for save game data for a game, for instance).

(03-03-2023, 11:52 AM)SimonP Wrote: 2. The binding process seems to take the longest, is there any way to speed it up? For already created models or for new ones, either option would work well.

As it is, not really. Binding a mesh to a set of particles requires generating vertex skinning data for all vertices in the mesh, so you have to iterate trough all vertices no matter how you do it. If really in need of a faster binding algorithm, you could write a multithreaded version or even move it to compute shaders, but that's outside the scope of Obi.

(03-03-2023, 11:52 AM)SimonP Wrote: PS: The meshes currently go around 20,000 vertices and 500/900 particles depending on the preset.

Unless you have lots of meshes, a blueprint with 500-900 particles should not take too long to generate.

(03-03-2023, 11:52 AM)SimonP Wrote: PS2: I am generating the blueprint with the couritine to avoid any crash or error that the immediate method can give me

Not sure how calling a coroutine may avoid crashes/errors? In fact both methods call the exact same code, all the immediate method does is advance the coroutine one in a while loop like this:
Code:
while (coroutine.MoveNext());
Reply


Messages In This Thread
Blueprint and Bind on runtime - by SimonP - 03-03-2023, 11:52 AM
RE: Blueprint and Bind on runtime - by josemendez - 03-03-2023, 12:27 PM
RE: Blueprint and Bind on runtime - by SimonP - 03-03-2023, 06:31 PM