Ru/Hint brush: Difference between revisions

From Valve Developer Community
< Ru
Jump to navigation Jump to search
Line 48: Line 48:
Здесь нет прямой видимости между красным и коричневым листами, избегая ненужной отрисовки. Однако, если один игрок перейдет на зеленый лист, он будет видеть их оба - и свои и чужие объекты. Вы не сможете прекратить это с помощью хинтов. Это можно сделать либо перекройкой макета уровня, либо с помощью таких методов, какие описаны, например, в [[Controlling Geometry Visibility and Compile Times|Управление видимостью геометрии и временем компиляции]].{{clr}}
Здесь нет прямой видимости между красным и коричневым листами, избегая ненужной отрисовки. Однако, если один игрок перейдет на зеленый лист, он будет видеть их оба - и свои и чужие объекты. Вы не сможете прекратить это с помощью хинтов. Это можно сделать либо перекройкой макета уровня, либо с помощью таких методов, какие описаны, например, в [[Controlling Geometry Visibility and Compile Times|Управление видимостью геометрии и временем компиляции]].{{clr}}


== More examples ==
== Еще примеры ==
[[Image:Hint example6.PNG|frame|caption|right|Various ways to use hints.]]
[[Image:Hint example6.PNG|frame|caption|right|Различные способы использования хинтов.]]


Here a few examples of when and how to use hints. In all cases the goal is to hide the green players from each other. The upper three work as they should. The left one illustrates that it doesn't even matter if its one hint-brush spanning the corner, as long as its angle is > 180&deg; the two players will not "see" each other's leaves because no straight line can be drawn between their leaves. The bottom-left example shows you that can happen when the angle is less than 180&deg;. One can easily draw a straight line from leaf to leaf, resulting in non-functional hints.
Вот несколько примеров того, где и как использовать хинты. Во всех случаях цель - скрыть зеленых игроков друг от друга. Верхние три работают как надо. The left one illustrates that it doesn't even matter if its one hint-brush spanning the corner, as long as its angle is > 180&deg; the two players will not "see" each other's leaves because no straight line can be drawn between their leaves. The bottom-left example shows you that can happen when the angle is less than 180&deg;. One can easily draw a straight line from leaf to leaf, resulting in non-functional hints.


When the corner in the hallway is 180&deg;, as in the middle top picture, two hints will suffice. In fact, they can even be closer to the players, but that would decrease their effectiveness (more stuff will be drawn "around the corner". ) In the example in the middle bottom, the hints have been lowered and <code>vbsp</code> is forced to cut up the top visleaf because visleaves can't be [[concave]]. No matter how <code>vbsp</code> cuts up this corner, the hints will always work less effectively and create extra leaves (more work for <code>vvis</code>). In the example, the left player can see leaves 1 and 2 (same surfaces as above), but the right player will see all three numbered leaves (which is more than the top example.).  
When the corner in the hallway is 180&deg;, as in the middle top picture, two hints will suffice. In fact, they can even be closer to the players, but that would decrease their effectiveness (more stuff will be drawn "around the corner". ) In the example in the middle bottom, the hints have been lowered and <code>vbsp</code> is forced to cut up the top visleaf because visleaves can't be [[concave]]. No matter how <code>vbsp</code> cuts up this corner, the hints will always work less effectively and create extra leaves (more work for <code>vvis</code>). In the example, the left player can see leaves 1 and 2 (same surfaces as above), but the right player will see all three numbered leaves (which is more than the top example.).  

Revision as of 00:13, 22 August 2015

Template:Otherlang2

Hint-плоскости используются для того, чтобы разрезать листья в процессе компиляции, и являются средством оптимизации на стадии Vis-компилирования карты.

Обычно, они упоминаются как обычные хинт-браши, поскольку помещаются в мир карты как обычные браши. Хинт-плоскости определяются стороной браша, покрытой текстурой tools/toolshint. Несколько хинт-поверхностей определяются несколькими окрашенными сторонами браша, или нескольких брашей. Остальные стороны браша могут быть покрыты текстурой tools/toolsskip; эти грани будут проигнорированы компилятором.

Хинты автоматически привязываются к своей вис-группе, так что вы легко можете скрыть их.

Зачем и когда разрезать листья

Template:Note:ru

Иногда, некоторые формы листьев предпочтительнее других просто потому, что они меньше их. Каждый раз, когда лист не виден, его содержимое не прорисовывается, ускоряя графику.

Следующие иллюстрации показывают важность нарезки листьев, и, в то же время, предлагают примеры того, где хинты полезны.

Первый пример почти такой же, как и на карте SDK. Это комната с игроками и трубами, разделенная стеной:

Пример карты sdk_hints.vmf, показывающей игроков слева и модели справа, разделенные стеной.

Когда игрок находится в одном из двух player_starts, движок должен решить, какие браши (трубы) справа от стены необходимо прорисовывать. Это происходит потому, что vbsp.exe не может эффективно разделить вашу карту на листья:

Без хинтов, vbsp создает листья вплоть до потолка.

Поскольку листья очень высокие и простираются до потолка, лист слева (с игроками) напрямую "видит" лист с трубами справа. Таким образом, лист и содержимое (трубы) будут прорисованы. Это обидно, поскольку игрок не видит трубы напрямую (они находятся за стеной в центре). Мы используем хинты, чтобы показать процесс создания листьев.

Один горизонтальный хинт создает несколько листьев, и два листа по обе стороны стены не будут видеть друг друга.

Белая линия - это сторона браша с текстурой tools/toolshint. Он заставляет vbsp разделить нашу карту на три листа. Теперь нет прямой линии между листьями с игроками и трубами. Вот в чем суть хинтования.

Скайбоксы иногда завышены, чтобы игрок мог видеть все здания в городе, находящемся на одном листе (как в нашем примере). Это тоже хорошая ситуация, когда можно использовать хинты для ограничения видимости.

Угловые хинты

Без хинтов, в этом помещении будет рендериться любой угол, когда стоите в противоположном углу.

Это вид сверху типичного угла. Здесь два игрока в разных концах (зеленые квадраты) и цилиндры, представляющие собой много материала для прорисовки. В данном случае цель хинтования - избежать отрисовки ненужных объектов, т.е. когда игрок находится за углом относительно объектов.

Можно подумать, что vbsp убежден, что игроки не видят объекты, принадлежащие другому игроку. Это не так. Он разделит это пространство на два листа, либо обрежет листья вдоль коричневой или розовой линий (в зависимости от стороны браша).

В любом случае, оба угловых листа напрямую видят друг друга, так что содержимое каждого угла будет отрисовываться во время нахождения в другом углу.

Добавление углового хинт-браша создаст на листах угол, так что они не будут видеть друг друга.

Эту ситуацию можно значительно улучшить, и разделить наш уровень на три листа, поместив хинт в угол, (создав в целом три листа вместо двух), но лишь убедившись, что объекты одного игрока не будут видимы другим.

Здесь нет прямой видимости между красным и коричневым листами, избегая ненужной отрисовки. Однако, если один игрок перейдет на зеленый лист, он будет видеть их оба - и свои и чужие объекты. Вы не сможете прекратить это с помощью хинтов. Это можно сделать либо перекройкой макета уровня, либо с помощью таких методов, какие описаны, например, в Управление видимостью геометрии и временем компиляции.

Еще примеры

Различные способы использования хинтов.

Вот несколько примеров того, где и как использовать хинты. Во всех случаях цель - скрыть зеленых игроков друг от друга. Верхние три работают как надо. The left one illustrates that it doesn't even matter if its one hint-brush spanning the corner, as long as its angle is > 180° the two players will not "see" each other's leaves because no straight line can be drawn between their leaves. The bottom-left example shows you that can happen when the angle is less than 180°. One can easily draw a straight line from leaf to leaf, resulting in non-functional hints.

When the corner in the hallway is 180°, as in the middle top picture, two hints will suffice. In fact, they can even be closer to the players, but that would decrease their effectiveness (more stuff will be drawn "around the corner". ) In the example in the middle bottom, the hints have been lowered and vbsp is forced to cut up the top visleaf because visleaves can't be concave. No matter how vbsp cuts up this corner, the hints will always work less effectively and create extra leaves (more work for vvis). In the example, the left player can see leaves 1 and 2 (same surfaces as above), but the right player will see all three numbered leaves (which is more than the top example.).

The two right pictures show you you should keep things as simple as possible. If one hint will suffice, like in the top example, that is preferred. And, obviously, hints should not be used if not needed, as in the bottom picture. As shown, vbsp cannot create leaves that enable both players to see each other, so there's no need to use hints here to hide the players from each other (hints can be used, of course, to hide parts of the hallways). In the same example, the middle wall should never be a detail brush. Details geometry do not create visleafs and are not taken into consideration by vvis. It will think both players will see each other and that's not what we want. vbsp may even make it so both players here are in the same leaf.

In summary, since hints have no direct rendering cost during the playing of a map, when used wisely they are a primary way to speed up your map and control your visibility.

Hints used to simplify

Lastly, hints can be used to simplify a map. Sometimes, vbsp cuts up a level into more leaves than necessary. This increases compile time. Hints can be used to counteract this. For instance, hints can be placed in doorways to prevent the doorways from cutting up the rooms they connect. Or, if you get an error that a certain visleaf is cornering too many other visleaves, hints can used to cut that leaf into multiple leaves that corner a smaller amount of leaves.

Note.pngПримечание:Visleafs will always be divided every 1024 units (at each red or blue line in the 2D views)

See also

Examples

  • sourcesdk_content\hl2\mapsrc\sdk_hints.vmf - sample map included in the Source SDK.