简体   繁体   English

在 WPF 3D 中,如何确定 Cube 的顶点是否可见

[英]In WPF 3D, How to determine whether a Cube's vertex is visible

We know that the cube has eight vertices, and we can easily build a cube using the Media3D of WPF.我们知道立方体有八个顶点,我们可以使用 WPF 的 Media3D 轻松构建立方体。 But how to determine whether the vertex of the cube is visible.但是如何判断立方体的顶点是否可见。

Just as the following pictures show, the red vertex should be invisible, while the others should be visible.如下图所示,红色顶点应该是不可见的,而其他顶点应该是可见的。

立方体1

立方体2

If any of the faces connected to the vertex has a normal facing the camera (see back face culling), the vertex is visible.如果连接到顶点的任何面的法线朝向相机(请参见背面剔除),则顶点是可见的。 This should be pretty quick to calculate.这应该很快就能计算出来。

If you need actual visibility in a complex scene, some other solution like stencil buffer as TiberiumFusion suggested should be used.如果您需要在复杂场景中实际可见,则应使用 TiberiumFusion 建议的其他解决方案,例如模板缓冲区。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM