当前位置:网站首页>Three. JS introductory learning notes 03: perspective projection camera
Three. JS introductory learning notes 03: perspective projection camera
2022-07-07 15:48:00 【Jiang Duoduo_ Mostly Harmless 】
Reference Content :
https://www.ituring.com.cn/book/miniarticle/49446
## Perspective projection camera
Different from orthogonal projection , The size of an object is not affected by distance , Perspective projection is more in line with physical vision , Near and far away .
structure :
var camera = new THREE.PerspectiveCamera(fov, aspect, near, far);

Gray is the visual body , Parts that can be rendered ,fov Is the angle in the vertical direction of the visual body ( Angle system ).
Code
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>3d_camera</title>
<script type="text/javascript" src="js/three.js"></script>
</head>
<body>
<script type="text/javascript">
//renderer
//
var renderer = new THREE.WebGLRenderer();
renderer.setSize(400, 300);
//
document.getElementsByTagName("body")[0].appendChild(renderer.domElement);
//scene
var scene = new THREE.Scene();
//camera
var camera = new THREE.PerspectiveCamera(45, 400 / 300, 1, 10);
camera.position.set(0, 0, 5);
scene.add(camera);
//cube
var cube = new THREE.Mesh(new THREE.CubeGeometry(1,1,1),
new THREE.MeshBasicMaterial({
color:0xff0000,
wireframe:true
})
);
scene.add(cube);
//render
renderer.render(scene, camera);
</script>
</body>
</html>

fov Change to 60 The effect is as follows :
fov Change to 60 in the future ,cube Instead, it shrinks , As shown in the figure below , Although the actual size of the cube has not changed , But when the vertical angle of the camera is set larger , The visual body has become larger , Therefore, the size of the cube relative to the whole visual body becomes smaller , The square looks smaller .
in other words ,canvas The drawn area is still wide 400 high 300, This size has not changed , After the scene volume increases , Projected on the original width 400 high 300 In the drawing area , it seems cube It shrinks .
change fov It will not cause the horizontal and vertical proportion of the picture to change , And change aspect Will change the horizontal and vertical proportions . This effect is similar 2.3 section , The description will not be repeated here .
The size of the rendered object is a relative change .
边栏推荐
- Introduction of mongod management database method
- 使用Scrapy框架爬取网页并保存到Mysql的实现
- numpy---基础学习笔记
- 居然从408改考自命题!211华北电力大学(北京)
- jacoco代码覆盖率
- Super simple and fully automated generation super signature system (cloud Xiaoduo minclouds.com cloud service instance), free application in-house test app distribution and hosting platform, maintenan
- How to build your own super signature system (yunxiaoduo)?
- 2.Golang基础知识
- numpy--疫情数据分析案例
- Shader Language
猜你喜欢

Cocos creator collision and collision callback do not take effect

【数字IC验证快速入门】23、SystemVerilog项目实践之AHB-SRAMC(3)(AHB协议基本要点)

OpenGL's distinction and understanding of VAO, VBO and EBO
![[quick start of Digital IC Verification] 23. AHB sramc of SystemVerilog project practice (3) (basic points of AHB protocol)](/img/e9/9e32e38e12e1fa71732c52b8ee0ab0.png)
[quick start of Digital IC Verification] 23. AHB sramc of SystemVerilog project practice (3) (basic points of AHB protocol)

20th anniversary of agile: a failed uprising

numpy--数据清洗

微信小程序 01

写一篇万字长文《CAS自旋锁》送杰伦的新专辑登顶热榜

Virtual memory, physical memory /ram what

The difference between full-time graduate students and part-time graduate students!
随机推荐
[data mining] visual pattern mining: hog feature + cosine similarity /k-means clustering
[follow Jiangke University STM32] stm32f103c8t6_ PWM controlled DC motor_ code
2. Heap sort "hard to understand sort"
Getting started with webgl (3)
numpy--疫情数据分析案例
【数字IC验证快速入门】22、SystemVerilog项目实践之AHB-SRAMC(2)(AMBA总线介绍)
Wechat applet 01
2. 堆排序『较难理解的排序』
A wave of open source notebooks is coming
[quick start of Digital IC Verification] 23. AHB sramc of SystemVerilog project practice (3) (basic points of AHB protocol)
【数字IC验证快速入门】26、SystemVerilog项目实践之AHB-SRAMC(6)(APB协议基本要点)
Detailed explanation of Cocos creator 2.4.0 rendering process
LeetCode2_ Add two numbers
Virtual memory, physical memory /ram what
大表delete删数据导致数据库异常解决
[wechat applet] Chapter (5): basic API interface of wechat applet
#HPDC智能基座人才发展峰会随笔
UE4 exports the picture + text combination diagram through ucanvasrendertarget2d
Iterator and for of.. loop
Tkinter after how to refresh data and cancel refreshing