在 BabylonJs 中,如果一个相机被放置在离物体一定距离的地方,那么它的距离与物体的大小成正比,那么整个场景应该是大致相同的。
我创建了这个简单的测试(可以复制并粘贴到http://www.babylonjs-playground.com/以运行),它产生一个大小为 1000 的球体的场景,从位于 (0, 0) 的相机看到, 10000):
var createScene = function () {
// This creates a basic Babylon Scene object (non-mesh)
var scene = new BABYLON.Scene(engine);
// This creates and positions a free camera (non-mesh)
var camera = new BABYLON.FreeCamera("camera", new BABYLON.Vector3(0, 0, 10000), scene);
// This targets the camera to scene origin
camera.setTarget(BABYLON.Vector3.Zero());
// This attaches the camera to the canvas
camera.attachControl(canvas, true);
// This creates a light, aiming 0,1,0 - to the sky (non-mesh)
var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(1, -1, -1), scene);
// Default intensity is 1. Let's dim the light a small amount
light.intensity = 0.7;
// Our built-in 'sphere' shape. Params: name, subdivs, size, scene
var sphere = BABYLON.Mesh.CreateSphere("Sphere", 16, 1000, scene);
return scene;
};
请注意,如果球体的大小减小到 100,并且相机的距离也相应减小(因此相机位于 (0, 0, 1000)),场景看起来仍然相同。
如果实验重复减少另一个因素,即球体的大小减少到 10 并且相机定位到 (0, 0, 100),仍然没有任何变化。
到目前为止,一切都很好。但是,如果我尝试增加球体的大小和距离,那么一切都会消失:如果球体的大小为 10000 并且相机定位到 (0, 0, 100000),则场景看起来是空的。为什么?是否有可能改变这种行为?如何?我错过了什么?
谢谢!