Is clipping done automatically in Three.js?

我只是一个虾纸丫 提交于 2019-12-24 04:51:36

问题


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!


回答1:


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 and far can contain values for example near = 0.1 and far = 10000 so an object which lies between these values will be rendered.

EDIT:

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.



来源:https://stackoverflow.com/questions/10719403/is-clipping-done-automatically-in-three-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!