English 中文(简体)
三.js 中的相机参数
原标题:Camera arguments in Three.js

这就是摄像头的即时反应:

var camera = new THREE.PerspectiveCamera(
    VIEW_ANGLE,
    ASPECT,
    NEAR,
    FAR
);

这些价值意味着什么?

最佳回答

第一个参数是FOV 表示视野, 想象三脚架上的摄像头, 如果你将镜头换成宽角, 你就会得到更高的视野。 试着想象一个锥体从镜头中出来, 它只能看到那个区域中的物体 。

ASPECT 表示宽屏电视宽度比为 16/9, 旧电视为 4/3, 通常只是给它屏幕宽度/ 高度或DIV 的暗度, 您想要使用 3. js 。

问题回答

我也在想同样的事情,所以我查了一下,它是一个“坚固”的“坚固”的风景,一个“坚固”的风景,一个“坚固”的风景,一个“坚固”的风景。

我会在这里粘贴一个代码 评论,我写 在最近一个项目 因为它总结它 不错的IMHO。

// "What the f*** is a frustum?" you ask. Well I did.
// Think about it as a truncated pyramid. The tip is the camera. From a certain
// point "down" the pyramid (the "near plane"), stuff can be seen on-screen.
// After the "base" of the pyramid (the "far plane"), stuff is too far to be
// seen. Stuff outside the pyramid is off-screen too. There is also the "aspect
// ratio" (the rectangle that makes up the pyramid s base, so this value is
// width/height) and the "field of view" (think of it as a lens or something,
// it distorts the pyramid so there s more objects on screen - it is set in
// degrees and 45° is more-or-less a "natural" perspective. The bigger the
// number, the more "perspective" there is).

我发现这个>tutial 非常有用,可以理解所有摄像参数,以及PerspepherCamera 和OrthphicCamera 。

< 强度 > perspectCameera

  • Fov(视野) - 这是从摄像头的位置可以看到的场景的一部分。 正如你们可能知道的,我们人类有近180度的视野,而有些鸟类甚至有完全360度的视野。然而,对于计算机来说,我们通常使用60至90度的视野。

  • 外观 - 侧比是输出区域水平和垂直大小之间的比例。 由于我们通常使用整个窗口, 我们将只使用该比例。 从下页的图中可以看到, 侧比决定了水平视野和垂直视野之间的差别。 普通值是 window.innerWidth/ window.innerH8

  • 近处 - 此属性定义离相机的最小距离 < code> three.js 使场景成为场景。 通常, 这个值很小, 如 0.1 。

  • - 远处 - 此属性定义了距离摄像头位置的最大距离。 如果我们设定此距离过低, 我们的一部分场景可能不会完成; 如果我们设定得太高, 在某些情况下, 它可能会影响成形性能。 正常值在500到2000之间 。

<强度 > 天文摄影馆 < /强 >

  • 左转( Camera fruustum left plane) - 您应该将这里视为要完成的左边框。 如果我们将这个值设定为 - 100, 您将看不到左侧更远的任何物体 。

  • 右转(Camera frutytum right plane) - 右转再往右走一点都无法完成。

  • 顶部( Camera 褐色顶端平面) - 最大顶部位置要设定 。

  • 底部( Camera 灰土底平面) 底部位置要设定 。

  • 附近(接近飞机的焦土)-从这一点开始,根据摄像头的位置,现场将拍摄完毕。

  • Far (Camera frutytum far plane) - 根据摄像头的位置, 距离最远的点, 现场将到达那里 。

以下情况应非常能说明问题:

两种照相机模式的主要区别在于,在正统摄影机 距离中,所有元素的大小均相同,红球和黄球的情况就是如此。

最后,这里是一些代码, 你可以用它从一台相机转换到另一台相机:

this.switchCamera = function(SCENE_WIDTH, SCENE_HEIGHT) {
  if (camera instanceof THREE.PerspectiveCamera) {
    camera = new THREE.OrthographicCamera( SCENE_WIDTH / - 2, SCENE_WIDTH / 2, SCENE_HEIGHT / 2, SCENE_HEIGHT / - 2, 0.1, 1000 );
    camera.position.x = 0;
    camera.position.y = 0;
    camera.position.z = -1;
    camera.lookAt(scene.position);
    this.perspective = "Orthographic";
  } else {
    camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 0.1, 1000 );
    camera.position.x = 0;
    camera.position.y = 0;
    camera.position.z = -1;
    camera.lookAt(scene.position);
    this.perspective = "Perspective";
  }
};

<强 > 注:

<强 > 有用链接:





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签