Can someone please explain Areaportals, Skips, and Hints?

Discussion in 'Mapping Questions & Discussion' started by shadowslasher11, May 20, 2014.

  1. shadowslasher11

    aa shadowslasher11

    Messages:
    392
    Positive Ratings:
    325
    I've looked up a ton of videos on these entities/brushes, yet can't seem to figure it out. I must have read the wiki several times over, and still makes no sense.

    I've even loaded up the Valve maps to see what they did to use it, not helping since it changes. Sometimes it's just the hint, other times it has an area portal next to it, and sometimes a skip+hint texture.
     
  2. YM

    aa YM LVL100 YM

    Messages:
    7,099
    Positive Ratings:
    5,742
  3. Sergis

    aa Sergis L666: ])oo]v[

    Messages:
    1,871
    Positive Ratings:
    1,131
    areaportals are portals between areas, skips are skipped and hints hint.

    areaportals iirc ensure you only see props that are visible thru the portal even if the visleaves visible thru the portal have props that aren't directly visible ( which would get rendered if there wasn't an areaportal ). they also help speed up compiles and sometimes help against random visleaves on the other side of the map being rendered.

    skips are skipped, they do nothing in the compiled map. they're only needed for hint brushes to mark unused brushsides and for alignment brushes, for example, if you want all your cubemaps to be at 64 hu you can put a cubemap on a 64 hu high skip brush and copypaste that around your map instead of moving every cubemap up manually. they count as brushes at compile tho, so for huge maps like morras or hydro all non-hint skips gotta be disabled lest you hit the MAX_MAP_BRUSHSIDES.

    hints make sure visleaves cut along the surface textured in hint texture, if a brush is all hint, it'll cut visleaves with all its brushsides. they're useful for ensuring a certain visleave has no chance of seeing another visleave if the level geometry allows it so you dont get much stuff rendered around the corner. they also help speed up compile.
     
  4. wareya

    wareya L7: Fancy Member

    Messages:
    493
    Positive Ratings:
    172
    You need to understand how source engine decides what things to render in order to understand these entities. Since you didn't say much, I'll start from the top.

    Basically, the map is divided up into sections known as "partitions" or "leaves" (they're basically the same idea, but a leaf can be made up of multiple partitions; that's what viscluster is for).

    The areas that connect "partitions" or "leaves" are called portals, and the compiler makes something called a "stab tree" through various portals to best figure out what leaf can see eachother.

    The idea is that a viewpoint inside of a given camera will definitely not be able to see objects that are strictly inside of certain other ones. For example, someone who is on the opposite side of a wall to you. So, what they did, is, for a certain leaf, a camera inside of it will only render objects and map elements that overlap the other leafs in its "potentially visible set" (PVS) of leafs. For a given general area, the compiler will decide whether every single other general area in the level is visible, or not, from said first general area.

    [​IMG]

    This is a (simplified) example of how part of a map may look to the visibility system. The red boxes are leaves; they're the "general areas" that the compiler and game look at to decide what is visible. Note that a leaf *needs* to be completely convex, for mathematical reasons. Also, the most common (and slightly cheapest to compile) kind of leaf is an orthogonal rectangular one. So you're going to have things like this.

    The green numbers all represent objects that might exist in the world and need to be drawn, like health kits, enemies, guns, players, props, whatever. If you can draw a line from any part of the leaf that a single object is in, to any other leaf, without crossing through the void, then an object in that other leaf's contents will be visible to that single object.

    --------------------
    Hints

    The problem with this is, sometimes you get leafs that aren't aggressive enough; they extend out into areas in ways that are suboptimal. In the example image up there, the leaf that the 4 is in extends over to the walkway that the 3 is on. This is bad because it makes it so that the 4's visleaf can draw a line to the 5's visleaf. You can use a hintbrush to force that 4's visleaf to be cut off at the end of the stairs, so that the 4's stairs and the 5's stairs can't "see" eachother.

    You might also notice that the 3 can technically "see" the 1. You can avoid this by cutting off the 1's visleaf something like this:

    https://developer.valvesoftware.com/wiki/File:Hint_example4.jpg

    ...Finally, the 2 can see every leaf here, which is good enough.

    ----------------------------
    Areaportals

    Let's say you have an extremely detailed area where hint brushes wouldn't do justice without using like eighty. You want that area to be mostly invisible to areas outside of it. So what you do is, you make all of its entrances have areaportals in them, so that only the parts visible through the entrances (when you're outside of it of course) need to render.

    https://developer.valvesoftware.com/wiki/Areaportal#Performance_impact

    Areaportals also make VRAD run a little faster because of the little extra information they add to the map's file with grouping partitions into areaportal areas. That's something I can't really explain in depth.
     
    • Thanks Thanks x 1
  5. henke37

    aa henke37

    Messages:
    1,876
    Positive Ratings:
    440
    Do note that areaportals do two separate tasks. What everyone else has (tried to) mentioned is the famous part where they check that geometry actually fits inside the portal.

    But the second task is to act as on/off switches for portals. A disabled area portal quite literally acts like as if there is no way to see between the two connected visleafs. It is this this part that causes the infamous areaportal leaks.
     
  6. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    I wouldn't bother with portals or hints until fairly deep into development and you find problems. One of the biggest time wasters that game developers get themselves into is pre-optimizing, and this applies to mappers as well.

    vvis is pretty good at what it does which means as long as you designed your map in a sensible manner it'll produce a map fast enough that no one will care that you didn't make an areaportal.

    Just make map. If issues develop down the road then you can dig into it, post screenshots here and let people help you out with specific advice. This will save you time, and probably be even more useful instruction because it'll be practical information you can use immediately.
     
  7. Pocket

    aa Pocket func_croc

    Messages:
    4,489
    Positive Ratings:
    2,217
    Eh, I think some understanding of how the engine does its thing can be useful in explaining why, for example, you don't ever want to design a map with massive wide-open areas where the sightlines are broken up only by piles of shipping crates, and stuff like that. Sometimes maps, even maps that play well and look good, were designed by people who had a subpar understanding of optimization, and wind up being fundamentally impossible to optimize satisfactorily.

    But if you'd rather save this stuff for later, just make sure you understand the importance of using func_detail on certain things. That's an easy way to improve optimization that should be done before you ever compile anything.
     
  8. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    Definitely, understanding basic vis calculation is important. There's no way to just figure out how it works by looking at the game. But learning how to wrangle hint brushes to squeeze another 5fps out of your map is probably wasted effort as a beginner.

    Map layout and hinting are certainly related topics, but they aren't the same topic.
     
  9. wareya

    wareya L7: Fancy Member

    Messages:
    493
    Positive Ratings:
    172
    You still need to know what the hell a hint brush does. Otherwise you're not getting anywhere with optimization when you *detail* a TF2 map.
     
  10. Crash

    aa Crash func_nerd

    Messages:
    3,148
    Positive Ratings:
    4,746
  11. theharribokid

    aa theharribokid

    Messages:
    867
    Positive Ratings:
    806
    It's the first thing linked in the first reply Crash, ya goof.
     
    • Thanks Thanks x 1
  12. Crash

    aa Crash func_nerd

    Messages:
    3,148
    Positive Ratings:
    4,746
  13. wareya

    wareya L7: Fancy Member

    Messages:
    493
    Positive Ratings:
    172
    Nice.