UE4渲染用到的Bounds

博客介绍了使用Actor边界进行可见性测试的相关内容。每个Actor的边界由球体和盒子两部分组成,可在视口可视化其边界。还说明了编辑Actor边界的方法,如设置Bounds Scale等,同时指出增加边界可能影响性能和阴影质量,相机视角渲染会根据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.

 

ActorBounds.png

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.

    PerActorBoundsSettingsDetailsPanel.png

    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. 
    ActorEditorBoundsExtension.png

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. 

 

源码解释:

/** 
     * Scales the bounds of the object.
     * This is useful when using World Position Offset to animate the vertices of the object outside of its bounds. 
     * Warning: Increasing the bounds of an object will reduce performance and shadow quality!
     * Currently only used by StaticMeshComponent and SkeletalMeshComponent.
     */
    UPROPERTY(EditAnywhere, AdvancedDisplay, Category=Rendering, meta=(UIMin = "1", UIMax = "10.0"))
    float BoundsScale;

 

使用:

玩家快速走过,相机视角可看到某物体,可以适当增加BoundsScale,但是降低性能。相机视角渲染,会根据Bounds检测是否渲染裁剪剔除。

<think>我们正在处理用户关于在UE4中调出bounds模块的问题。根据用户提供的引用内容,虽然引用中提到了Gameplay调试器、EQS信息等,但没有直接提到bounds模块。但是,我们可以根据UE4的常见操作来推断。 在UE4中,bounds(边界)通常指的是物体的包围盒(Bounding Box)。要查看物体的包围盒,我们可以通过以下方法: 1. 在视口中显示:在编辑器中选择一个物体,然后在视口左上角的“显示”选项中,勾选“边界”或者“显示边界”(具体名称可能因版本略有不同)。这样,选中的物体就会显示包围盒。 2. 使用控制台命令:在编辑器视口中按下“~”键打开控制台,然后输入命令: ``` show collision ``` 这个命令会显示碰撞体,而碰撞体通常与物体的边界有关。另外,也可以尝试: ``` show bounds ``` 但是,注意在UE4中,`show bounds`命令可能并不直接存在,而更常用的是`Show Bounds`作为一个编辑器选项。 3. 通过编辑器菜单:在编辑器的“显示”菜单中(通常在视口上方),可以找到“可视化”或“显示”相关的子菜单,里面可能有“边界”选项。 然而,根据用户引用的内容,他们提到了使用Gameplay调试器(按“~”打开,然后输入命令)。在Gameplay调试器中,通常用于调试游戏运行时的AI、动画等状态,并不直接用于显示静态的边界。 但是,如果用户是在运行时查看物体的边界,我们可以使用控制台命令`ShowDebug`系列。例如: ``` ShowDebug Bounds ``` 但是,请注意,UE4中常用的显示边界的命令可能是`ShowDebug Animation`或者`ShowDebug Collision`等,而专门显示边界的命令可能需要具体到某一类。 实际上,在UE4中,要查看物体的包围盒,最直接的方法是在编辑器中选择物体,然后在“细节”面板中查看其包围盒的尺寸,或者在视口中通过显示选项来显示。 考虑到用户可能是在游戏运行中查看,我们可以使用以下控制台命令: ``` show Debug Bounds ``` 或者 ``` show Bounds ``` 但是,这些命令可能因版本而异。 另外,UE4有一个命令`Display`可以用来切换显示各种调试信息,包括边界。可以尝试: ``` Display Bounds ``` 如果上述方法都不行,我们还可以通过以下步骤: - 在编辑器中选择物体,然后按F键聚焦,这时可以看到物体的包围盒(短暂显示)。 - 在“显示”菜单中,找到“高级”选项,然后勾选“显示边界”。 由于用户引用的内容是关于AI调试的,可能与当前问题关联不大,因此我们主要从常规操作角度回答。 综上所述,以下是在UE4中调出bounds模块(显示物体边界)的方法: 1. **在编辑器视口中显示**: - 选择要查看的物体。 - 在视口左上角的“显示”下拉菜单中,勾选“边界”(或类似名称)。 2. **使用控制台命令**: - 在编辑器或运行的游戏窗口中按“~”打开控制台。 - 输入命令:`show bounds`(如果有效)或者尝试`ShowDebug Bounds`。 - 如果无效,可以尝试`show collision`,这通常会显示物体的碰撞边界。 3. **通过显示菜单**: - 在编辑器视口中,点击左上角的“显示”按钮,展开后找到“可视化”或“显示”选项,然后勾选“边界”。 4. **通过快捷键**: - 在编辑器中选择物体后,按Ctrl+B可以显示选中物体的边界(注意:这个快捷键可能因版本或自定义设置而异)。 注意:在UE4的不同版本中,具体名称和命令可能略有不同。如果以上方法都不行,建议查阅对应版本的文档。 由于用户的问题可能是在运行时查看,我们重点给出运行时控制台命令: - 在游戏运行中按“~”打开控制台,输入: ``` show collision ``` 这个命令会显示所有碰撞体,而碰撞体通常就是物体的边界。 - 或者输入: ``` show bounds ``` 但请注意,这个命令可能需要引擎支持,如果不行,请尝试其他命令。 另外,UE4还有一个专门显示静态网格体边界的命令: ``` r.VisualizeBuffer 1 ``` 然后选择要可视化的缓冲区,但这通常用于渲染调试。 因此,最实用的还是`show collision`。 最后,根据用户引用的内容,他们之前可能是在调试AI,因此也可能是想查看AI相关的边界(如导航网格边界),这时可以使用导航相关的显示命令: ``` show navigation ``` 来显示导航网格的边界。 综上所述,我们根据用户的问题,给出多种可能性,并建议首先尝试`show collision`和编辑器中的显示选项。 §§相关问题§§ 1. 在UE4中如何显示物体的碰撞体? 2. UE4中如何查看导航网格的边界? 3. 如何通过控制台命令显示UE4中的调试信息? 4. UE4编辑器中有哪些常用的可视化选项? </think> 在Unreal Engine 4 (UE4) 中调出**Bounds模块**(通常指物体的边界框可视化)可通过以下方法实现: ### 方法1:通过编辑器视图选项(推荐) 1. 在编辑器视口中选中需要查看边界的物体 2. 点击视口左上角的 **"显示" 下拉菜单** 3. 勾选 **"边界"** 选项(英文版为 *"Bounds"*) ```markdown [显示] → [可视化] → [边界] ``` 4. 选中物体的橙色边界框将立即显示 ### 方法2:使用控制台命令 1. 在编辑器或游戏运行窗口按 **`~`** 打开控制台 2. 输入命令: ``` show bounds ``` 3. 所有场景物体的边界框将显示为绿色线框 ### 方法3:通过蓝图代码(运行时调试) 在Actor的蓝图脚本中添加: ```blueprint // 在BeginPlay事件后添加: Set Actor Enable Collision → True Set Hidden(false) // 确保物体可见 Draw Debug Box (位置=GetActorLocation, 范围=GetBounds().BoxExtent, 颜色=红色) ``` ### 注意事项 1. **边界类型**: - 橙色框:编辑器静态边界 - 绿色框:运行时动态边界 (`show bounds`) - 红色框:蓝图调试边界 2. **边界计算依据**:由物体的碰撞组件(Collision Component)或静态网格体(Static Mesh)的尺寸决定 3. 若未显示,检查物体是否启用了碰撞属性(在Details面板中确认 *Collision* 设置为 *BlockAll*) [^1]: UE4官方文档《可视化和调试边界》
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值