天天看點

UE4渲染用到的Bounds

官方介紹:

Testing Visibility with an Actor's Bounds

Each Actor placed in a Level has a set of bounds using a box and a sphere that is used for various things in the Engine. One of those being specifically to test whether an it is visible or not. The bounds of an Actor is made up of two parts: a sphere and a box. The bounding sphere is used for fast collision detection with a simple distance test, and, more often than not, it's greater in size than the object it contains. On the other hand, the bounding box is a closer match to the shape of the object and provides more accurate results. 

Visualize bounds of Actors in the Level Viewport by selecting Show > Advanced > Bounds. Alternatively, in the Skeletal Mesh Editor you can select Character > Bounds and in the Static Mesh Editor, select Bounds in the main toolbar.

UE4渲染用到的Bounds

An Actor with its bounds (sphere and box) displayed.

Each Static Mesh and Skeletal Mesh has its own bounding box and sphere that automatically scales to the size of the geometry when imported, or when scaled or rotated in the viewport.

You can edit an Actor's bounds using the following ways:

  • By setting the Bounds Scale from its Details panel when it's selected in a Level or in a Blueprint. The Bounds Scale uniformly scales the bounds of an Actor, acting as a multiplier of the original scale values.
    UE4渲染用到的Bounds
    Click image for full size.
  • By opening the Static Mesh or Skeletal Mesh Editors to apply non-uniform scaling for Positive Bounds Extension and Negative Bounds Extensions using the Details panel. 
    UE4渲染用到的Bounds

Increasing an Actor's bounds can potentially impact performance and shadow quality by keeping the Actor from be culled sooner than it would otherwise have been. 

源碼解釋:

    UPROPERTY(EditAnywhere, AdvancedDisplay, Category=Rendering, meta=(UIMin = "1", UIMax = "10.0"))

    float BoundsScale;

使用:

玩家快速走過,相機視角可看到某物體,可以适當增加BoundsScale,但是降低性能。相機視角渲染,會根據Bounds檢測是否渲染裁剪剔除。