hints and skips

SiniStarR

L8: Fancy Shmancy Member
Mar 31, 2009
585
116
Ive gone to the valve community forums and tried learning about them and going into decompiled valve maps, but I just cant wrap my head around it. What are they really used for, how useful are they. and when should I use them?
 

TracerDX

L3: Member
Jun 9, 2009
127
26
You'll need to know about PVS (here's a good article on it with many pictures) to really understand why you use them.

vbsp will do most of the work on its own, but sometimes you need give it "hints" on where to make a visleaf cut, so to speak.

I usually use them on corners and to break up large open areas into smaller chunks.
 

Dr. Spud

Grossly Incandescent
aa
Mar 23, 2009
880
854
Any brush face with the hint texture on it will make a slice through the vis leafs of your map. The skip texture doesn't do anything, you just put it on the remaining sides of the brush.

If you don't know what I mean by vis leafs, read the article Tracer posted. It's very good.

My short run-down is that the renderer breaks the level into leafs. One leaf is a box designating a section of the level to render. The game keeps track of what leaf the player is standing in, and which leafs can be seen from that leaf. It will render (I think) the visible leafs and any leafs adjacent to the visible ones.

Usually I use hints to break up large rooms. For instance, if you have one large room with many exits, and the room is ONE leaf, then no matter where you stand in it, the game renderer assumes you can look straight out of every exit, and will render accordingly. Obviously, that renders more of the level than is needed, so you would use hints to break up that large room into many leafs.
 
Last edited:

LunchBox

L1: Registered
Jun 13, 2009
41
4
Ok my question is do you have to use hints and skips ? I am a noob to hammer but i am working on a map and im curious. And if so is it better to use them while you are making your map or after you pretty much have it done ?
 

Waif

L7: Fancy Member
Mar 22, 2009
412
125
If your map is small, hints and skips arent necessary however if your map is decent sized you will generally get bad fps without them.
Its best to learn how to use them now rather then later, because they are very useful.

EDIT: Implement your hints before detailing your map, as you can build your func details easier when you know where all your vis leafs are.
 

TracerDX

L3: Member
Jun 9, 2009
127
26
Its one of the last steps, and its an optimization step. So really, for a map to be playable its not required, but when used properly it can improve frame rates.

Especially in cases described above, where one big visleaf causes a lot of unnecessary stuff to be drawn behind walls (aka "overdraw").

On a related subject, I suggest you guys read up on func_areaportals as well. Those are a little more important than hints.
 
Last edited:

LunchBox

L1: Registered
Jun 13, 2009
41
4
Why does all this have to be so complicated :mad: it would be much easier if it was like the map editor in Far Cry or Halo 3 :D and thank you
 

Dr. Spud

Grossly Incandescent
aa
Mar 23, 2009
880
854
It's not complicated if you build your map smart from the very beginning. A carefully planned out map without carelessly large sight lines can make hints unnecessary.
 

Pianodan

L3: Member
Apr 11, 2009
108
16
The other thing is, while too few visleafs (or the wrong ones) can slow down fps in some circumstances, too MANY visleafs DEFINITELY will, and will also bring your complies to a screeching standstill if you aren't careful.

This is really a situation where a picture is worth a thousand words. Load your map, hit f9 to compile, and JUST select bsp, not vis, not rad, and don't run tf2. Once you've done that go to Maps -> Load portalfile. This will let you see exactly where your portals are.

Sometimes you'll find that a wall or an object is causing the blue lines to project a long way from the actual object, and you have small visleafs being created halfway across the map from the object creating it. That's the situation where you would use a hint brush to chop those blue lines off at the source.

On the other hand, there's a situation in the tutorial where you would use a hint brush on a corner to make MORE visleafs to reduce rendering load in-game.

One final thing. Even before hint brushes and area_portals, get familiar with func_details. When you have a brush item, like a column, that really shouldn't be creating whole new areas for visibility calculations, making it a func detail is essential. There's more information on that in the tutorial too.

But this will all make a heapin helpin more sense once you load a portal file for the first time.
 

SiniStarR

L8: Fancy Shmancy Member
Mar 31, 2009
585
116
alright Im understanding them alot more now, I just have to experiment with them. However one thing that doesn't clear up for me is how do you know which visleafs are being seen or not, for example how do you know the map isnt loading an entire area but a section
 

Pianodan

L3: Member
Apr 11, 2009
108
16
alright Im understanding them alot more now, I just have to experiment with them. However one thing that doesn't clear up for me is how do you know which visleafs are being seen or not, for example how do you know the map isnt loading an entire area but a section

I'm not quite sure I understand your question. The in-game engine will render EVERY visleaf which is visible from within your current visleaf. If you want a basic idea, just park your 3d camera inside a section and change the view direction with the mouse. Any leafs you can see, will be rendered.

If the leaves you can see have large sections you CAN'T see - in other words, if you can see the tip of a leaf that extends a long way behind a wall, it's time for some optimization, because the engine is rendering all the way to the other end of that leaf, even though it doesn't need to.
 

Open Blade

L420: High Member
Nov 30, 2007
439
34
I've always wondered how areaportals effect visleafs. I pretty much used them in every doorway. I wonder just what the game renders if you are in a certain areaportal, no matter what the hint brushes are like. Anybody know how those 2 things work together?

And nobody has mentioned "NODRAW" yet so I will. Use that texture on every face of a world brush that will not be seen.

Found my own answer. Looks like areaportals work even better then hit/skip brushes. I still think it's a good idea to hint large open areas. But for smaller areas with lots of doorways and such, areaportals look like the way to go. They cull the viewable area.

Open areaportals (whether they're always open, or triggered to open) have a behavior of culling geometry that is visible through the areaportal. Similar to looking through an open window of a house, only the visleaves that are directly visible through the areaportal will be rendered by the engine. In this way, the geometry in the next area is roughly 'culled' to the size of the window, decreasing the amount of geometry rendered, and increasing performance. On top of this, model (prop) geometry is not rendered at all unless part of the model is directly visible through the view frustum (or visible angle) of the areaportal. This makes open areaportals very useful to control visibility of model geometry.

An open areaportal tightly culls model visibility.

Due to these performance benefits, areaportals are often used in an always-open state. An always-open areaportal is created by setting the "Initial State" keyvalue on the func_areaportal entity to "Open". Always-open areaportals are used at the openings to other areas containing large amounts of visleaves and geometry. For example, simply placing an always-open areaportal at the end of the hallway that opens into a wider expanse can produce a substantial performance gain. While the player is inside, looking out of the doorway, only the geometry that is in the each leaf directly visible through the doorway will be drawn.
 
Last edited:

Dr. Spud

Grossly Incandescent
aa
Mar 23, 2009
880
854
alright Im understanding them alot more now, I just have to experiment with them. However one thing that doesn't clear up for me is how do you know which visleafs are being seen or not, for example how do you know the map isnt loading an entire area but a section

Run your map, then in the console put sv_cheats 1 then mat_wireframe 1

That will show you exactly how much map is being rendered at a time.

You can also use +showbudget (another cheat command) to show exactly what is being expensive to render.
 

Sgt Frag

L14: Epic Member
May 20, 2008
1,443
710
go in game, use the console ~
type
mat_leafvis 1

Now when you run around you'll see a red box around you. It always shows the leaf you are in.

now type
mat_wireframe 1

That'll let you see 'through walls' to see what is being rendered (or at least sent to your processor to be ready to be rendered).
With these you can look at the shape of the visleaf and everything that can be seen from that visleaf. It can help you determine where to place hints to cut the leaf into a smaller one.

But placing too many and making too many leafs is bad. If you place one and it doesn't help remove it.
 

TracerDX

L3: Member
Jun 9, 2009
127
26
Areaportals will "hide" non-visible visleafs and props in real time (ie, while the game is running). That means there's a processing cost. Over-use is bad. In certain cases (like a narrow hall opening into a large open area), an always open area portal will greatly decrease the number of visleafs being drawn as you approach the hall's exit.

r_DrawPortals 1 and load up a Valve map to get a sense of when and where its a good idea to use an "Always Open" area portal. With mat_wireframe 1, you can see how this works.

Of course, its almost always a good idea to use them tied to doors.