在BabylonJs中,如果摄像机与物体保持一定的距离,使其距离与物体的大小成正比,则整个场景应该大致相同。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),则场景看起来是空的。为什么?有没有可能改变这种行为?怎么样?我错过了什么?
谢谢!