首页 > 解决方案 > 用于 LOD 的 Octree 中基于体素的 semless 网格

问题描述

八叉树

八叉树保存体素 lod 级别,单个八分体有 16x16x16 体素。

需要在所有 6 个面上获取 Octant 的邻居体素(邻居不得有子对象)以创建正确的网格边界以实现无缝网格。

面可以有几个邻居或邻居的一部分。

例如:

  1. Octant 的比例为 64,一个邻居的比例为 32 -> 一个 Octant 侧体素从 4(2x2) 个相邻体素计算,

  2. 另一个邻居的比例为 16 -> 一个 Octant 侧体素从 16(4x4)体素计算。

  3. 第三个邻居的比例为 1 -> 一个八分圆侧体素从 4096(64*64)个体素计算。

Octant 可以有太多的邻居,需要添加一些限制。

更新邻居时 - 设置“网格边界过时”标志

当前不好的解决方案:不要得到邻居,所以渲染所有侧面体素。

我的想法:

solution 1:
{
    p_neighbours[Face::FACE_COUNT] in Octant
    create Octant neighbours for all childs on creating
    create Octant neighbours when childs are removed
    update meshs_borders flag when neighbour changed

    Octant with childs has invalid Octant neighbours

    problems:
    Octant can have too many neighbours with different scales, or part of neighbour
    hard to code and maintain, too much cases to solve
    Octant still can have too many neighbours
}

solution 2:
{
    don't store neighbour pointers in childs
    instead get neighbour every time by coordinates

    same problems as in prev solution, and new: 
    can't update "mesh borders out of date" flag when creating or removing childs
}

标签: graphics3dmeshvoxeloctree

解决方案


我发现更好的解决方案#3:八分圆边界体素为空 -> 孩子的 8 个体素之一为空。邻居只连接到具有相同比例的八分圆。如果缺少邻居,则从父级邻居获取边界体素。


推荐阅读