盒子背面剔除 [英] Box backface culling

查看:153
本文介绍了盒子背面剔除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我具有由它的位置和方向,并通过它的中心和盘区(从盒中心三个正交矢量面对中心)中所定义的盒中定义的相机。脸是可见的,当它的外表面朝向相机和无形的,当它的内表面面对它。

Assume I have a camera defined by its position and direction, and a box defined by its center and extents (three orthogonal vectors from the box center to face centers). Face is visible when its outer surface is facing the camera and invisible when its inner surface is facing it.

很明显,根据框的位置和方向可以有1-3个面可见的方块。有一些聪明的办法如何确定哪些面是可见的?一个显而易见的解决方案是计算6点产品面对正常对每个面面朝相机载体的构建。有没有更好的办法?

It seems obvious that depending on box position and orientation there may be 1-3 faces of the box visible. Is there some clever way how to determine which faces are visible? An obvious solution would be to compute 6 dot-products of the face normal against the face-camera vector for each face. Is there a better way?

注:透视投影将被使用,但我不认为它很重要,面对镜头的性质似乎独立于突出

Note: perspective projection will be used, but I do not think it matters, the property of "facing camera" seems independent to a projecting.

推荐答案

我相信你所描述的方法是正常的方式来做到这一点。这是一个非常快速的计算,所以你不应该担心太多的速度。这是他们使用,以减少计算光线 - 三角形相交的算法的数量相同的方法。如果脸部的前面是不可见的,该方法不继续计算该脸部。请参阅本文中的C ++实现了这个算法。这是在第一个计算的一半。 http://jgt.akpeters.com/papers/MollerTrumbore97/$c$c html的

I believe the method you described is the normal way to do this. It's a very fast calculation so you shouldn't be worried too much about speed. This is the same method they use to reduce the number of calculations for ray-triangle intersection algorithms. If the front of the face isn't visible, the method doesn't continue calculations for that face. See this paper for a c++ implementation of this algorithm. It's in the first half of the calculations. http://jgt.akpeters.com/papers/MollerTrumbore97/code.html

这篇关于盒子背面剔除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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