Three.js - Scale model with scale.set() or increase model size?

jskidd3 picture jskidd3 · Jul 13, 2014 · Viewed 58.1k times · Source

What is the best practise for scaling 3d models in Three.js (or other 3d renderers)?

Here is an example I just faced:

I load a model in and realise the size of the model is too small. I then scale the mesh using mesh.scale.set(2,2,2); and it is perfect size.

What action should I take in this scenario, do I leave it scaled like that (programatically scaled) or do I go back to my 3d modelling software and double the size of the model?

Thanks

Answer

gaitat picture gaitat · Jul 14, 2014

It is not a matter of best practice but rather of optimization. If your mesh will always be scaled, it is better if you do the scaling in your modeling software. That simple statement mesh.scale.set(2,2,2); is a matrix multiplication that needs to happen on each frame rendered. Now maybe your scene does not have much geometry in it in which case you don't care. But as I said it is a matter of optimization. What if your scene had 1000 such meshes or 1000000. That matrix multiplication would need to happen for each one of them. Optimize whenever you can.