How to store and apply painted textured

Hey, i’ve run into This example - which is exactly what i need - but i also need to be able to store the textures with their position in DB and then reapply them. Until now i’ve worked with raycast so i stored the coordinations of the decals , i wonder how can i do it with textures.
Thanks!

Assuming you are working with a canvas texture like in the following example, you serialize it like any other texture.

https://threejs.org/examples/webgl_materials_texture_canvas

@Mugen87 thanks - i couldn’t find a reference to your solutions in the example you mentioned … can you please elaborate? thanks!

With “painted texture” I though you refer to a manually drawn texture like in the mentioned example.

In any event, if you serialize a mesh via toJSON(), textures are serialized, too. You can then use ObjectLoader to deserialize objects or an entire scene. The three.js editor also uses this loader to save and restore scenes (and thus textures meshes).

@Mugen87 thanks - so what you are saying is that the “storing” is for the entire object - just serialized… so the painted texture is serialized with the model itself - correct?

Yes, the texture would be embedded in the JSON along other mesh data.