Is JSON model format is better for THREE.js

I am using Three.js to create a simple game, i load about 100 low poly models in obj format but the performance is not smooth, all models size not more than 18 MB, if i use JSON format will it be faster although the size will be more than double? i tried Collada but for simple objects like my case obj is faster, if JSON is not the best solution, what is the best one?

Upvotes: 2

Views: 1670

Answers (2)

Careen
Careen

Reputation: 567

Not any one file format is better overall, depending on your needs and requirements external software used and if it consist of animation .Personally I generally don't use json that much i use obj but json is heavily supported by three.js.. but that's more of an opinion.

There are many factors as too why your application can be heavy. with out source code or the model files themselves I can only speculate.

Few things to consider:

Are your models optimized as best you can , 100 models in one scene is quiet allot at one time at 18mb, is this including textures?.

Are Textures compressed and reused.This will increase performance. From shadows , lighting and animation types all have an impact, Google has plenty of resources to offer you.

There are several techniques to keep your poly count down: subdivision is a good example of this, there is a really useful article on this. http://www.kadrmasconcepts.com/blog/2011/11/06/subdivision-surfaces-with-three-js/

Also LOD Level OF DETAIL is visible depending on how far or near an object is. A great useful explanation here: http://www.pheelicks.com/2014/03/rendering-large-terrains/ Three.js supports this with out any added libs..

Detail and how you render it is the key for best performance..

Even down to how you have set up your project can have a major influence.Take a look at functions and how you use them, for example on mouse move and dom element clicks can slow your three.js app dramatically if they are not optimized and used efficiently.

Reuse and share is your best option, There is no point in loading the same model twice because one is blue and the other is green...

Upvotes: 3

I think that there is no better format? It really depends what you need and what not. However, for me I will go for obj!

Upvotes: -2

Related Questions