Failed to convert into json

Hello Three js team,

I am trying to convert this imagery provided by three-geo into an json object but getting this error by the three js library i want some one can recommoned the better way to do this.

1 Like

It seems your instance of MeshBasicMaterial uses an instance of DataTexture. three.js does not support serialization/deserialization for this type of textures, yet.

I suggest you upvote the following PR if you need this feature in the engine:

1 Like

@Mugen87 really thanks for this
But i am using three through npm so does it work with npm also

still i am facing the same issue so it means still this featue is not in the three js library and also does it work with the three installed with npm and SIR i checked on the npm repo to but there is no data texture so how i will proceed can you suggest any option to me please

Sorry, but I think this can’t be right. THREE.DataTexture is a class in the core which is available in all official three distributions.

How about taking the code from the PR and implement a custom solution for now?

1 Like

https://github.com/mrdoob/three.js/blob/07e12e2e0e6ff8ba1c1b387106acfad7399fdd49/src/loaders/ObjectLoader.js i see here there is no data texture so i think if we are using three by npm so same issue may occur

It seems there is a misunderstanding. Like I said before, ObjectLoader does not support DataTexture yet. Use the code from the above PR if you need serialization support in your project.

ok that is really helpfull and i can replace my objectloader with yours but this is only to load the mesh with the datatexture what when i convert the mesh into JSON by using toJSON i think still i gives error so how i make it work

The PR also enhances Texture.toJSON() to ensure the serialization of a data texture actually works. You need this code in your app, too.