问题描述
在Three.js(或其他3D渲染器)中缩放3d模型的最佳做法是什么?
What is the best practise for scaling 3d models in Three.js (or other 3d renderers)?
以下是我刚才面临的一个例子:
Here is an example I just faced:
我加载模型并意识到模型的尺寸太小。然后我使用 mesh.scale.set(2,2,2);
缩放网格,它是完美的大小。
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.
在这种情况下我应该采取什么行动?我是否将其缩放(以编程方式缩放)或者我是否回到我的3D建模软件并将模型的大小加倍?
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?
谢谢
推荐答案
这不是最佳实践的问题
而不是优化
。如果您的网格将始终缩放,则最好在建模软件中进行缩放。那个简单的语句 mesh.scale.set(2,2,2);
是一个矩阵乘法,需要在每个渲染帧上发生。现在也许你的场景中没有太多的几何形状,在这种情况下你不在乎。但正如我所说,这是一个优化问题。如果您的场景有1000个这样的网格或1000000,那么该矩阵乘法将需要在每个网格中进行。尽可能优化。
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.
这篇关于Three.js - 使用scale.set()或增加模型大小的比例模型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!