Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 461
jskidd3 Avatar asked Jul 13 '14 14:07

jskidd3


1 Answers

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.

like image 162
gaitat Avatar answered Oct 20 '22 18:10

gaitat