当前位置:网站首页>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 .
边栏推荐
- Clang compile link ffmpeg FAQ
- [quick start for Digital IC Validation] 26. Ahb - sramc (6) for system verilog project practice (Basic Points of APB Protocol)
- [wechat applet] Chapter (5): basic API interface of wechat applet
- webgl_ Enter the three-dimensional world (2)
- 【数字IC验证快速入门】24、SystemVerilog项目实践之AHB-SRAMC(4)(AHB继续深入)
- 有一头母牛,它每年年初生一头小母牛。每头小母牛从第四个年头开始,每年年初也生一头小母牛。请编程实现在第n年的时候,共有多少头母牛?
- 【数字IC验证快速入门】18、SystemVerilog学习之基本语法5(并发线程...内含实践练习)
- 【数字IC验证快速入门】26、SystemVerilog项目实践之AHB-SRAMC(6)(APB协议基本要点)
- Ue4/ue5 multi thread development attachment plug-in download address
- [Lanzhou University] information sharing of postgraduate entrance examination and re examination
猜你喜欢

【數據挖掘】視覺模式挖掘:Hog特征+餘弦相似度/k-means聚類
![[quick start of Digital IC Verification] 19. Basic grammar of SystemVerilog learning 6 (thread internal communication... Including practical exercises)](/img/a3/7f08f189c608d6086b368dfa3831f7.png)
[quick start of Digital IC Verification] 19. Basic grammar of SystemVerilog learning 6 (thread internal communication... Including practical exercises)

Briefly describe the working principle of kept

【数字IC验证快速入门】29、SystemVerilog项目实践之AHB-SRAMC(9)(AHB-SRAMC SVTB Overview)
![[quick start of Digital IC Verification] 29. Ahb-sramc (9) (ahb-sramc svtb overview) of SystemVerilog project practice](/img/f7/03975d08912afd8daee936799e8951.png)
[quick start of Digital IC Verification] 29. Ahb-sramc (9) (ahb-sramc svtb overview) of SystemVerilog project practice

Create lib Library in keil and use lib Library

2022全开源企业发卡网修复短网址等BUG_2022企业级多商户发卡平台源码

#HPDC智能基座人才发展峰会随笔

Use of SVN

Gd32 F3 pin mapping problem SW interface cannot be burned
随机推荐
There is a cow, which gives birth to a heifer at the beginning of each year. Each heifer has a heifer at the beginning of each year since the fourth year. Please program how many cows are there in the
Write sequence frame animation with shader
[quick start for Digital IC Validation] 26. Ahb - sramc (6) for system verilog project practice (Basic Points of APB Protocol)
OpenGL's distinction and understanding of VAO, VBO and EBO
Whole process analysis of unity3d rendering pipeline
Tkinter after how to refresh data and cancel refreshing
Virtual memory, physical memory /ram what
【数字IC验证快速入门】18、SystemVerilog学习之基本语法5(并发线程...内含实践练习)
【数字IC验证快速入门】29、SystemVerilog项目实践之AHB-SRAMC(9)(AHB-SRAMC SVTB Overview)
写一篇万字长文《CAS自旋锁》送杰伦的新专辑登顶热榜
Asynchronous application of generator function
Streaming end, server end, player end
LeetCode3_ Longest substring without duplicate characters
The "go to definition" in VS2010 does not respond or prompts the solution of "symbol not found"
MongoD管理数据库的方法介绍
2022 all open source enterprise card issuing network repair short website and other bugs_ 2022 enterprise level multi merchant card issuing platform source code
Android -- jetpack: the difference between livedata setValue and postvalue
2022全开源企业发卡网修复短网址等BUG_2022企业级多商户发卡平台源码
Create lib Library in keil and use lib Library
[target detection] yolov5 Runtong voc2007 data set