Culling Techniques

Culling Techniques

遮挡剔除是提升性能的一种手段,剔除的方法很多,下面一一分析。


Culling Techniques_第1张图片
Culling Techniques

View Frustum Culling(视锥体剔除)

只绘制眼睛能够看得见的物体。难点是如何处理instance数据。


Culling Techniques_第2张图片
image.png

Backface Culling

背对着摄像机的部分,不需要绘制,可以减少绘制一半的三角面,其功能由硬件时间,只需要打开即可。


Culling Techniques_第3张图片
image.png

Portal Culling

适用于室内场景。


Culling Techniques_第4张图片
image.png

Small Feature Culling(Details Culling / Screen Size Culling)

Using the smallFeatureCulling flag this technique is activated. For each node the amount of pixels is calculated it’s bounding volume would cover in screen space. If the coverage is below the smallFeatureThreshold parameter the node (and subsequent shapes) is culled.

SETTING USAGE VALUES
smallFeatureCulling (de-)activate the culling technique [true;false]
smallFeatureTreshold cull objects covering less pixels than treshold [0..*]
Culling Techniques_第5张图片
image.png
if(any(round(min) == round(max))) {
    discard;
}

When geometry is so far away that it’s not visible then there is no need to draw it at all so it can safely be culled. A more advanced scheme of detail culling that decreases the amount of details with the distance is LOD (level of detail).
如何提取Small Feature,值得深入研究。

 if(object is in frustum ){
       var priority = (bounding.max - bounding.min) / distanceToCamera 
    }

Occlusion Culling(遮挡剔除)

The hardest culling technique to implement. Geometry that is occluded by other geometry does not need to be rendered. One solution is to use the Z-buffer and sort the geometry in a front to back order. But this does not always work and all pixels need to be checked against the Z-buffer so it will be costly for big scenes. Better occlusion culling techniques culls the geometry before it’s even sent to the GPU.


Culling Techniques_第6张图片
image.png

Culling Techniques_第7张图片
image.png

被view cell遮挡的都可以不绘制。

OcclusionCullingAlgorithm(G)
    OR =empty
    P =empty
    for each object g ∈ G
        if(isOccluded(g,OR))
            Skip(g)
        else
            Render(g)
            Add(g, P)
           if(LargeEnough(P))
               Update(OR, P)
              P =empty
          end
     end
 end

Low Priority Culling

This is the only supported comparison-based culling technique. Triggered by the lowPriorityCulling the nodes which passed all previous (activated) culling techniques are sorted by their priority. Afterwards the part of this list defined by the lowPriorityTreshold is removed. At the moment the screen-space coverage is used as priority, later on there will be a more sophisticated calculation allowing the user to set priorities to mark his or her personally important nodes. Therefore by now the priority culling is very similar to the small feature method but culling a relative amount instead of comparing to an absolute threshold.

SETTING USAGE VALUES
lowPriorityCulling (de-)activate the culling technique [true;false]
lowPriorityThreshold draw only objects within threshold fraction of priority sorted list [0..1]

Tesselation Detail Culling

The possibiliy of using this culling technique completely depends on the support of each drawable. Up to now only the POP-Geometry natively supports it. As long as the resulting error stays within the amount of pixels defined by tesselationErrorThreshold the tesselation of the mesh is lowered to certain degree. It can be enabled using the flag tesselationDetailCulling.

SETTING USAGE VALUES
tesselationDetailCulling (de-)activate the culling technique [true;false]
tesselationErrorTreshold use mesh simplification having lower error than threshold [0..*]

Conclusion

Triangle Level

Description: Determine for each triangle if it should be culled or not.
Primary goal: Minimize triangle count.
Culling technique example: BSP (Binary Space Partition)
Usage: Not used anymore, cost too much CPU.

Object Level

Description: Check each object (a group of triangles in one buffer) if they should be culled or not.
Primary goal: Minimize triangle count and keep state changes low.
Culling technique example: View Frustum Culling of Bounding Box Hierarchies
Usage: Often used.

Batch Level

Description: Will check whole batches (a group of objects in one buffer) if they should be culled or not.
Primary goal: Minimize draw calls and triangle count.
Culling technique example: Uniform Grid Culling
Usage: Often used.

Reference

  1. Occlusion Culling Algorithms

你可能感兴趣的:(Culling Techniques)