MAX MAP BRUSHSIDES

来自Valve Developer Community
跳转至: 导航搜索
English (en)中文 (zh)
编辑

本页面由大康翻译于2023年10月28日 (UTC+8)。欢迎任何人补充新内容或者修改其中的错误。


MAX_MAP_BRUSHSIDES 当贴图超过 VBSP 19 格式定义的最大笔刷量时,会发生此情况。

当前的限制为 65536,这是由于 VBSP 19 格式使用 16 位整数(也称为「shorts」)来计算固体的数量。16位无符号整数的最大值为65536(2^16),这就是限制值的来源。

如果不改变 BSP 格式就无法解决此问题,并可能破坏兼容性。

Hammer 中的与编译后的 brushsides 数据差异

术语「brush sides」有点误导性,如果你以前在 Hammer 中注意过你的 brush side 数目,你可能已经注意到编译的结果要更高。

这是因为在编译时,它包括笔刷的边界框,每个笔刷最多可以增加6个笔刷边。如果面与边界框的边缘对齐(意味着没有任何角度),则不会添加额外的笔刷边。

例如:一个五面棱锥笔刷,底面与边界框的底部对齐。虽然笔刷本身只有5个边,但它将算作10个边。额外的5个笔刷边来自边界框。

作为经验法则,更容易弄清楚这一点。6+斜面数=每个笔刷的 brushside

MAX_MAP_BRUSHSIDES occurs when your map exceeds the maximum defined brush face amount.

The current limit is 65536, due to the engine internally using 16-bit integers (also known as "shorts") to count the number of brushsides. The maximum value of a 16-bit unsigned integer is 65536 (2^16), hence the limit.

There is no fix for this without changing the brushside structure in the engine to use 32-bit integers.

Note.png注意:The BSP format already stores brushsides as 32-bit integers, so such a change wouldn't break compatibility.

Hammer/Compiled brushsides discrepancy

The term "brush sides" is a bit misleading, if you've paid attention to your brush sides in Hammer before, you may have noticed the compiled result was higher.

This is because when compiling, it includes the bounding box of a brush, which can be up to an additional 6 brushsides per brush. If a face is lined up with the edge of the bounding box(meaning not angled in any way) it will not add an additional brushside.

Example: A 5 sided pyramid shaped brush with the bottom face lining up the bottom of the bounding box. While the brush itself is only 5 sides, it will count as 10. The 5 extra brushsides come from the bounding box.

As rule of thumb for figuring this out easier. 6 + angled faces = brushsides per brush

Instance discrepancy

Putting angled geometry in an instance will lower brushsides. This can be easily observed by compiling a rotated building in the main map, then in an instance, and comparing the brush side count. It is unknown why this works, but it messes up some QPhysics calculations.