Optimization: Prop/Model hiding

Discussion in 'Mapping Questions & Discussion' started by Noggin, Mar 8, 2008.

  1. Noggin

    Noggin L5: Dapper Member

    Messages:
    226
    Positive Ratings:
    48
    This I learnt thru trial and error but can work very well.

    Using func_occluder to hide models

    I use it by placing a 1 unit wallpaper like the pic below,
    Apply nodraw texture to all faces except the one facing the player that texture should be "tools/toolsoccluder", make it a func_occluder entity.

    This will hide models behind it so be careful where u place it, players will disapear too if incorrectly placed!

    In dev mode I use these key binds to show the occluders at work, the green boxes are the models being hidden by the occluder:

    bindtoggle "o" "r_occlusion"
    bindtoggle "p" "r_drawpixelvisibility"
    bindtoggle "[" "r_visocclusion"


    [​IMG]

    Max view distance

    Also with all props/models set the max view distance etc, you can set the distance using the camera button in the entity properties window .
    If the player cannot see the model then there is not point in displaying it all the time, models behind walls for instance.

    I find the longest line of sight that the player can see the model, go a little further then set the max view distance, you call also set the fade for smaller props like light fixtures etc.

    In my case, I hid the generator in the base (big red block) to players outside of the base, determined by distance.

    [​IMG]
     
    Last edited: Mar 8, 2008
  2. Paria

    Paria L5: Dapper Member

    Messages:
    202
    Positive Ratings:
    31
    is there a specific point at which you should decide to start using occluders ? since i found a brief reference to them on the optimization guide, but if you have decent area portals and hints at what point is adding these a good idea ?

    and for the binds have you tried

    sv_cheats 1
    perfui

    occlusion tool.
     
  3. Noggin

    Noggin L5: Dapper Member

    Messages:
    226
    Positive Ratings:
    48
    In my case, it was a big outdoor area so areaportals were not feasible. Hints dont always hide props as much you might like them too either, you will often find things being drawn that shouldnt.
     
  4. Vilepickle

    Vilepickle L7: Fancy Member

    Messages:
    495
    Positive Ratings:
    147
    That's a unique way to use them I suppose, but due to their nature of hiding everything behind them they are a "last resort" optimization technique. Honestly, with a building like that and the walls, they shouldn't be drawing things on the other side of it anyway with properly placed hints and/or area portals as long as the right things are structural brushes and the right things are detail.

    As you said yourself, it's probably better just to set fade distances on props that are being drawn in the wrong spots.

    Also: isn't there an overhead rendering cost for occluders as well?
     
  5. Shmitz

    aa Shmitz Old Hat

    Messages:
    1,129
    Positive Ratings:
    740
    There is. Occluders should only be used if they will be hiding a significant number of models.
     
  6. Sacrifist

    Sacrifist L3: Member

    Messages:
    130
    Positive Ratings:
    7
    I thought you had to have all 4 faces of the brush as an occluder. Didnt think it would work if you had nodraw on some of the faces.
     
  7. Shmitz

    aa Shmitz Old Hat

    Messages:
    1,129
    Positive Ratings:
    740
    You actually only want one of the faces to be occluder, or else the engine will have to calculate the occlusion for every face on the brush, which just increases the already mentioned overhead.
     
  8. Noggin

    Noggin L5: Dapper Member

    Messages:
    226
    Positive Ratings:
    48
    This is a screenshit with the Occluders switched in and out, the occluder performance hit seems less than the cost of the props. All depends on the scene really.

    [​IMG]