The condition of 'json' to be spawned in Threejs

Hello, I’m looking for the condition of json file to load and spawn on three.js
For mine, now I have, cannot spawn in the scene with an error, ‘json has no property ‘shapes’ .’

I wonder that what should I include ‘The properties’ for a json file.

Thanks.

Please provide enough information to reproduce the error you’re seeing — code, a demo, and the JSON file if possible?

loader.load(
	"models/jsonTest.json",
	function ( object ) {
		// Add the loaded object to the scene
		tempObject = object;
	}
);

...

var loader = new THREE.ObjectLoader();
let alpha = loader.parse(tempObject);
scene.add(alpha);  // <- where I got the error, json undefined property 'shapes' .... 

sorry I removed json file so I cannot attach it.
I think, json is not better than others(but speed), so I decided to use fbx loader.

That will definitely be faster than JSON, as long as you use binary FBX.

The GLTFLoader is likely to be even faster though, if you can use glTF format.

Oh thanks. Then, I need to convert my fbx files to glTF format.
I’m using binary FBX, but it shows too low performance on IE, Edge.
I have not much information about three.js, because I learned it during 10 days and I’m learning it, Maybe I’m a fool.
Thanks for your info. :smiley:

Then welcome to the club haha!

You can use this tool to convert FBX:

It’s worth noting though that the performance increase of glTF will not be that big compared to FBX. Mainly it just loads faster. If the model is already too complex to display as FBX then it probably won’t work as glTF either.

3 Likes

@looeee
Then welcome to the club haha!

Thanks :slight_smile: