Three.js 中是否自动完成剪辑? [英] Is clipping done automatically in Three.js?

查看:28
本文介绍了Three.js 中是否自动完成剪辑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我在这篇维基百科文章中阅读了有关剪辑的内容.它似乎对任何和所有游戏都非常重要,所以,我必须这样做,还是由 Three.js 甚至 WebGL 自动完成?谢谢!

So, I was reading about clipping in this Wikipedia article. It seems pretty essential to any and all games, so, do I have to do it, or is it done automatically by Three.js, or even WebGL? Thanks!

推荐答案

您可以将近和远裁剪平面的值传递给您的相机对象:

You can pass values for the near and far clipping planes to your camera object:

var camera = new THREE.PerspectiveCamera( fov, aspect, near, far );

near 和 far 可以包含例如 near = 0.1far = 10000 的值,因此将呈现位于这些值之间的对象.

near and far can contain values for example near = 0.1 and far = 10000 so an object which lies between these values will be rendered.

near 和 far,代表你的世界的裁剪平面.在同时绘制数千个对象和纹理的场景中,尝试显示所有内容会占用 CPU 和 GPU 的负担.更糟糕的是,把你看不到的东西画出来也是浪费.近剪裁平面通常离用户较近,而远剪裁平面则在远处某处.当物体穿过远平面时,它们会自发地出现或消失.一些游戏使用雾来使物体的出现和消失更加逼真.

near and far, represent the clipping planes for your world. In a scene with thousands of objects and textures being drawn at once, it would be taxing on the CPU and GPU to try and show everything. Even worse, it would be wasteful to draw the things you cant even see. The near clipping plane is usually relatively close to the user, whereas the far clipping plane is somewhere off in the distance. As objects cross the far plane, they spontaneously appear or disappear. Some games use fog to make the appearance and disappearance of objects more realistic.

这篇关于Three.js 中是否自动完成剪辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆