Obi Official Forum
Read influence from a texture or vertex color instead of painting in Unity? - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Softbody (https://obi.virtualmethodstudio.com/forum/forum-12.html)
+--- Thread: Read influence from a texture or vertex color instead of painting in Unity? (/thread-4150.html)



Read influence from a texture or vertex color instead of painting in Unity? - kodra - 05-04-2024

ObiSoftbodySkinner has a "Paint Influence" feature. It works okay for simple meshes, but for more complex meshes it's quite hard to paint the influence precisely in Unity's scene view.

I think instead of painstakingly paint it in Unity, it'd be much much easier for me to paint it as a texture (or vertex color) in a proper 3D DCC then import it to ObiSoftbodySKinner. Especially that Obi 7.0 has a "SkinMap" structure that seems to be for this purpose. But I don't know how. Is it possible?


RE: Read influence from a texture or vertex color instead of painting in Unity? - josemendez - 05-04-2024

(05-04-2024, 05:46 PM)kodra Wrote: ObiSoftbodySkinner has a "Paint Influence" feature. It works okay for simple meshes, but for more complex meshes it's quite hard to paint the influence precisely in Unity's scene view.

I think instead of painstakingly paint it in Unity, it'd be much much easier for me to paint it as a texture (or vertex color) in a proper 3D DCC then import it to ObiSoftbodySKinner. Especially that Obi 7.0 has a "SkinMap" structure that seems to be for this purpose. But I don't know how. Is it possible?

Influence and SkinMap are entirely different things.

Influence is a single float value per vertex that blends between skeletal animation and simulation. It is possible to store and read this to/from a texture, but it is currently not implemented. I can add this for you next week, as it is fairly simple to do.

SkinMap is a list of particle weights: for each vertex, a variable number of <particleID, weight> tuples used to determine which particles have influence over the position of a given vertex. This cannot be read from or written to textures.

Kind regards,


RE: Read influence from a texture or vertex color instead of painting in Unity? - kodra - 06-04-2024

(05-04-2024, 08:30 PM)josemendez Wrote: Influence and SkinMap are entirely different things.

Influence is a single float value per vertex that blends between skeletal animation and simulation. It is possible to store and read this to/from a texture, but it is currently not implemented. I can add this for you next week, as it is fairly simple to do.

SkinMap is a list of particle weights: for each vertex, a variable number of <particleID, weight> tuples used to determine which particles have influence over the position of a given vertex. This cannot be read from or written to textures.

Kind regards,

Thank for your reply! That would be a good feature to have.


RE: Read influence from a texture or vertex color instead of painting in Unity? - josemendez - 08-04-2024

(06-04-2024, 07:04 AM)kodra Wrote: Thank for your reply! That would be a good feature to have.

Hi!

Attached to this post you'll find a modified ObiSoftbodySkinnerEditor.cs script (for Obi 7 only!) that allows you to import/export per-vertex influence to/from png textures. Right now the export size is fixed at 512x512, with a border padding distance of 64 pixels.

[Image: dqZ9Nkd.png]

Replace the one in your project with it. Let me know if you have any comments!

kind regards,


RE: Read influence from a texture or vertex color instead of painting in Unity? - kodra - 08-04-2024

(08-04-2024, 01:11 PM)josemendez Wrote: Hi!

Attached to this post you'll find a modified ObiSoftbodySkinnerEditor.cs script (for Obi 7 only!) that allows you to import/export per-vertex influence to/from png textures. Right now the export size is fixed at 512x512, with a border padding distance of 64 pixels.

[Image: dqZ9Nkd.png]

Replace the one in your project with it. Let me know if you have any comments!

kind regards,

That was quick! Thank you very much. I'll take a look.