当前位置:网站首页>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 .
边栏推荐
- Ue4/ue5 multi thread development attachment plug-in download address
- Yunxiaoduo software internal test distribution test platform description document
- 大表delete删数据导致数据库异常解决
- [Lanzhou University] information sharing of postgraduate entrance examination and re examination
- Introduction of mongod management database method
- Nacos conformance protocol cp/ap/jraft/distro protocol
- [quick start of Digital IC Verification] 25. AHB sramc of SystemVerilog project practice (5) (AHB key review, key points refining)
- XMIND frame drawing tool
- The "go to definition" in VS2010 does not respond or prompts the solution of "symbol not found"
- Vertex shader to slice shader procedure, varying variable
猜你喜欢

Mathematical modeling -- what is mathematical modeling

【數據挖掘】視覺模式挖掘:Hog特征+餘弦相似度/k-means聚類

Unity's ASE realizes cartoon flame

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

Gd32 F3 pin mapping problem SW interface cannot be burned

【兰州大学】考研初试复试资料分享

postman生成时间戳,未来时间戳
![[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)
![[quick start of Digital IC Verification] 24. AHB sramc of SystemVerilog project practice (4) (AHB continues to deepen)](/img/cf/45775b712f60869186a25d3657ee1b.png)
[quick start of Digital IC Verification] 24. AHB sramc of SystemVerilog project practice (4) (AHB continues to deepen)

【数字IC验证快速入门】26、SystemVerilog项目实践之AHB-SRAMC(6)(APB协议基本要点)
随机推荐
Mesh merging under ue4/ue5 runtime
Webcodecs parameter settings -avc1.42e01e meaning
The "go to definition" in VS2010 does not respond or prompts the solution of "symbol not found"
[deep learning] semantic segmentation experiment: UNET network /msrc2 dataset
写一篇万字长文《CAS自旋锁》送杰伦的新专辑登顶热榜
Yunxiaoduo software internal test distribution test platform description document
MongoD管理数据库的方法介绍
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
Vertex shader to slice shader procedure, varying variable
15. Using the text editing tool VIM
Mathematical modeling -- what is mathematical modeling
[quick start for Digital IC Validation] 26. Ahb - sramc (6) for system verilog project practice (Basic Points of APB Protocol)
Write sequence frame animation with shader
numpy--数据清洗
XMIND frame drawing tool
How to deploy the super signature distribution platform system?
[quick start of Digital IC Verification] 22. Ahb-sramc of SystemVerilog project practice (2) (Introduction to AMBA bus)
[quick start of Digital IC Verification] 26. Ahb-sramc of SystemVerilog project practice (6) (basic points of APB protocol)
[data mining] visual pattern mining: hog feature + cosine similarity /k-means clustering
Jacobo code coverage