Quake3World.com Forums
     Level Editing & Modeling
        Advanced Portal and Hinting Optimization Tutorial


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: Advanced Portal and Hinting Optimization Tutorial

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 04-13-2005 03:21 PM           Profile Send private message  E-mail  Edit post Reply with quote


Where I left off (see thread):
Quote:
Well ideally, the portal viewer is supposed to be useful for you to try to optimize your map portals. By allowing you to visualize where the actual portals are being generated, it gives you a chance to see areas that may need some optimization. You do this by changing stuff to detail/structural as well as by adding in hint brushes. Ultimately, you want to create new portals that limit the PVS while getting rid of portals that aren't doing anything.

Portals are generated more or less randomly, so sometimes the order in which they were created yields different results. Also, it doesn't always create them in the most optimized manner. You can split up a room in multiple ways, but how these are split often make the difference between a large number of useless portals and a small number of optimized portals.

First of all, try to convert as much of those small brushes to detail. This simplifies the portals the most. Then add a few hint brushes to limit the PVS in places like hallways between rooms and such. There are a bunch of hinting tutorials around that will teach you where to put these. Then look for portals that aren't doing anything with regards to the PVS and use hints to try to remove those.

Keep in mind that the blocksize also generates portals every 1024 game units along every axis. You can increase/decrease the size of this by adding the _blocksize worldspawn entity key/value pair. You can also set it to 0 to disable if you're comfortable to generate your own portals - though you should avoid this unless you really know what you're doing. When building your layout, you may want to build your floorplan keeping the blocks in mind.

If I have the time in the next few days, maybe I'll throw together a few screenshots from my current alpha to illustrate. I have one room that I spent quite a bit of time optimizing that I think will explain this very well.



First off, I suggest that you read the following tutorials and articles before we start because they will give you a basic foundation of BSP, portal and hinting knowledge that you will need to understand this tutorial. If you've read them before, read them again to refresh your memory. If you're reading them for the first time, make sure you fully understand them because they are some of the best map optimization guides ever written. After all, this tutorial isn't so much to teach you how to hint and limit the PVS as it is to teach you how to optimize the portal volumes. (Sucks that some of these screenshots are disappearing)

SPoG's Technical Note
Old discussion
Q's sample map thread
Bill Brook's hint tutorial
Spog's Hint Brushes: how and why to use them
Plan B's take on Caulk Hull/Overdraw/Hinting
djbob's Hints



Right... now that you've learned about the concepts, lets go through a practical 3-dimensional example taken from the alpha of my current map under development. The reason I'm using this section of my map is because:

  • Fjoggs asked for a portal-viewer plug-in discussion which is perfect timing for me because I just happened to be using the portal-viewer to optimize my current map.
  • This particular room was designed with hinting in mind so I was able to integrate the structural hull with the hints to maximize the effectiveness of the portals and PVS.
  • When finished, this room will likely contain a large number of highly detailed elements (working on a few high-poly models) that I don't want to be able to see from other rooms in the map - so I'm planning ahead and isolating it in it's own PVS.
  • This room contains 2 floors, some hallways and some interesting turns which will make it interesting for those of you who are tired of the basic L or Z-shaped hallway hinting examples (but keep those basic examples in mind - they're still here, just less apparent).

Notes:
I disabled the blocksize for this map simply because it suits me for the rest of the map. While this can reduce the number of portals created, it's generally not recommended that you do this on your map unless you know what your are doing. When creating the layout of your map, keep the blocksize in mind and build accordingly. Also, since this map is just in the alpha phase, the brush building concepts that I'm using are less than optimized... I'll be fixing this as I move towards beta so ignore that. The hints are what counts and I spent quite a bit of time optimizing them.


Here's the room in question. There are actually two hallways extending beyond that actually lead to the rest of my map, but I've sealed them off here to prevent leaks.
Image

In wireframe.
Image

And again from the XY-view.
Image

From here on, I'll be making good use of the Portal Viewer plug-in in GtkRadiant. It's really a great tool for optimizing the PVS and portal volumes in a map.

After compiling vis, I loaded up the .prt file and you can see all the portals generated. There's a lot of them because all the brushes were left as structural. This is a simple block alpha, imagine the number of portals generated if this were a full blown map with all the details and trim. The number of portals would be unimaginable, which is why an optimized map should only take a few seconds to compile the vis stage while an unoptimized map could take hours.
Image

Here are the portals from the XY-view.
Image

Of course, the first step is to convert brushes that aren't useful for vis calculations to detail. Here, I've hidden all patch meshes and converted all unnecessary brushes to detail and then filtered them. Only structural brushes remain.
Image

Recompiling and then reloading the .prt, you can see that already there's a large difference in the number of portals generated.
Image

From another angle.
Image

And from the XY-view.
Image

To limit the PVS, I'm going to add a single brush textured with skip on all sides except for one face which is textured with hint.
Image

From another angle, you can see that this hint brush extends between both floors. In the planning stage, I built the structural brushes in a way that I would only need 1 brush for both floors, simplifying the process.
Image

In this diagram, the green line represents the hinting plane. The red section is the bottom floor, the blue section is the top floor. The purple region are parts of the map where the top and bottom floors overlap.
Image

Lets look at the bottom floor first. You'll notice that when looking at the first floor, it's not anymore complex than those general examples listed in the links above. That's because no matter what, hinting concepts always breaks down to the basics. The most complex examples are only deceivingly so and when looked at in sections, they are actually quite basic. You'll notice that this floor is actually just a Z-shaped hallway.
Image

Player A can't see areas C and D
Player B can't see area D
Player C can't see area A
Player D can't see areas A and B

On the second floor, I'm using the same hint brush. Again, this is a basic Z-shaped hallway.
Image

Player 1 can't see areas 3 and 4
Player 2 can't see area 4
Player 3 can't see area 1
Player 4 can't see areas 1 and 2

In planning the layout of the map, you can see here how I deliberately created the selected triangular section of floor to conform to the hint brush. Small changes to your map like this can simplify your hinting issues while creating some interesting architectural elements. A square floor would not only be boring, but it would have made hinting this section much more difficult. I would probably have had to use multiple hint brushes to achieve the same result.
Image

Portal volumes are created pretty much randomly and as you can see here, this volume extends quite a bit further than the hallway and well into the room. The Portal Viewer really helps in finding these awkward portals so that we can get rid of them.
Image

Remember that all portal volumes are concave. So we want to rearrange the volumes into basic concave shapes. Recompiling with a small hint plane in the doorway prevents the portal from extending into the room. As you can see, there is now a large triangular concave volume in place of the awkward volume sticking out of the hallway.
Image

Here's another problem area. The balcony is creating a portal between floors, which isn't doing much for the PVS.
Image

From another angle, you can see that there are 3 separate portal volumes in that room, each stacked on top of each other.
Image

So we'll add another hint plane here.
Image

This creates a single volume in that room instead of 3. As well, this has the potential of culling the bottom floor from view when the player is standing on the second floor and vice-versa.
Image

Of course, nothing's perfect. In adding that last hint brush, I've inadvertedly created a few new portals. The vertical hint plane created in the last step now extends beyond and across the hallway and down to the first floor.
Image

From above, you can see it creates a small triangular portal volume in the middle.
Image

So, I'll add a another hint plane here...
Image

...which has an interesting result.
Image

From the XY-view we can see some of the portal volumes.
Image

Finally, unhiding the patches and detail brushes, you can see the difference that a little optimization makes.
Image


I may post some .map and .prt files later as examples.

Discuss.



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

NOT OK
NOT OK
Joined: 03 Aug 2003
Posts: 1017
PostPosted: 04-13-2005 08:03 PM           Profile Send private message  E-mail  Edit post Reply with quote


I have never mapped anything and I know what it does.



_________________
Image


Top
                 

Old Skool'
Old Skool'
Joined: 02 May 2002
Posts: 5230
PostPosted: 04-14-2005 06:40 AM           Profile Send private message  E-mail  Edit post Reply with quote


Cheers on the post, great read.
One thing though, I had gotten under the impression that the hint brush should only be visible from one side, but in your example, some are visible in more, but they have SKIP on it. I also use skip, but I thought you shouldn't see them then, so it doesnt matter? Clarification would been nice. :)

I'm gonna work on the map today, and I'll keep you updated.

First off, take a look of an overview shot from my map. This is the structural bit. I know it looks like shit, and I'm sure alot can create this (including myself) cleaner and better:

Image

Now, for the portals. There's no Hints placed out so far:

Old caulk hull:
Image

New caulk hull:
Image

Numerous amounts of portals and there's a few that's placed totally out of place. How would I go about removing those outside my map?

Gonna try cleaning up my caulk hull, as seeing your's is so clean and tidy. :)

EDIT: Caulk hull updated. Not as bad now, but could be better.

EDIT2: Portal shot with the new caulk hull posted.




Last edited by Fjoggs on 04-14-2005 07:02 AM, edited 3 times in total.

Top
                 

XXXG-00W0
XXXG-00W0
Joined: 27 Dec 2002
Posts: 2891
PostPosted: 04-14-2005 06:59 AM           Profile Send private message  E-mail  Edit post Reply with quote


Kaziganthe wrote:
After 3 years of working with q3 i finally found out what hint does! :P


I always thought it had something to do with bots. I'm so ignorant :tear:

Oh and excellent read




Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 04-14-2005 07:23 AM           Profile Send private message  E-mail  Edit post Reply with quote


Hint brushes don't necessarily have to be visible from one side. Skip is a new shader added by ydnar so that Q3Map2 can ignore the other faces of a brush. Think of hint as a plane rather than a solid. You place the hint plane anywhere where you need to make a split in the portal. Since you can't make a 2D plane with a brush (a 3D solid), the other sides are textured with skip. You can have a brush with multiple sides textured with hint if necessary.

The sides textured with hint do have to have their edges flush against structural brushes. Skip surfaces can be anywhere you want (those faces are ignored), but generally, I like to keep them flush with brush faces just for editor neatness.

In summary:
Hint means create a portal split here along the face of this brush.
Skip means ignore the side of this brush completely when calculating portals. Hope that answers your question.

That screenshot of your map is indeed odd... portals shouldn't be generated in the void since there's nothing out there. Try using brush cleanup, you may have a few invisible broken brushes floating somewhere outside in the void. Also make sure to turn off all filters and check to make sure that you really don't have anything floating out there.

To use the blocksize to your advantage (turn on blocksize - view > show > show blocks) you should probably shift your entire map so that as as many edges of your rooms line up with the blocks as possible (can't really see how well this was done from your screenshot). You can't get rid of block portals with hints, so it's better to work with them to your advantage. You can also resize the blocks to work with your map.



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

True Nightmare
True Nightmare
Joined: 06 May 2000
Posts: 4373
PostPosted: 04-14-2005 07:30 AM           Profile Send private message  E-mail  Edit post Reply with quote


Really excellent tutorial on hinting; very well-documented and clear for the most part, but...concave does not mean what you think it means :) ...all volumes in the Q3 engine, whether those volumes are brushes or the space between brushes, are convex, not concave.

Also, maybe say just "volumes" instead of portal volumes? I can see someone who doesn't quite get it thinking that the portals are actually three dimensional things instead of 2-d planes...if you just say "volumes", it makes it clear that you aren't actually talking about the portals themselves...



_________________
I beat the internet; the end guy is hard.


Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 04-14-2005 07:44 AM           Profile Send private message  E-mail  Edit post Reply with quote


So as the most important take-away from this exercise...

Hint is used for 2 reasons:

1) To create new portal splits to limit the Potential Viewable Set, reducing the amount of data that the video card has to draw.
Example: the first diagonal hint brush I placed.

2) To optimize the BSP-tree by merging or redistributing portals in a way that reduces the amount of useless portals.
Example: the second and fourth hint brushes I placed.

The third hint brush did a little bit of both 1 and 2.


You can think of portals as both planes and volumes. When splitting portals for PVS optimization, I think of them as planes - invisible lines that as soon as the player crosses over them, the next PVS loads or unloads. When merging them for BSP-tree optimiztion, I think of them as volumes. You are trying to merge adjacent volumes into a single concave volume. So in the 3rd hint brush example, I had 3 different volumes stacked on top of each other so I merged them into a single concave volume.


On detail brushes:
There's a misconception that only decorative brushes need to be converted to detail. Actually, you need to convert everything to detail that isn't directly used to create portals or a part of the hull. So even large architectural items like stairs, even entire floors may be removed if they're of no benefit to reducing the size of the PVS.



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Old Skool'
Old Skool'
Joined: 02 May 2002
Posts: 5230
PostPosted: 04-14-2005 07:52 AM           Profile Send private message  E-mail  Edit post Reply with quote


Thanks for the clarification ob!
This map was not created with the blocksize in mind, therefore I had to shift it into place like you said. I tried one spot, and it resulted in this:

Image
Image

Overall it looks better then before, but the strange Portals didn't disappear, even though I did brush cleanup, and checked the filters. I even got one more of them.
I'm gonna try placing out some hint brushes now.




Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 04-14-2005 09:27 AM           Profile Send private message  E-mail  Edit post Reply with quote


pjw wrote:
...concave does not mean what you think it means :)


Heh, you're right (you usually are). I tend to think of them as concave since I imagine myself standing within one of the volumes looking out - which from that perspective it looks concave. But you're right, they are convex shapes.

Fjoggs:
Maybe try shifting the map a few more units to the right (3 grid spacings based on your screenshot). I have no idea about those extra portals... I've never had that kind of problem before. Latest version of Q3Map2? You can always try copying the structural brushes and then pasting them into a new map. See if that helps.



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

XXXG-00W0
XXXG-00W0
Joined: 27 Dec 2002
Posts: 2891
PostPosted: 04-14-2005 09:36 AM           Profile Send private message  E-mail  Edit post Reply with quote


Hmm can't find the skip tex in my radiant. 1.2.13 was it entered later?




Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 04-14-2005 09:47 AM           Profile Send private message  E-mail  Edit post Reply with quote


It ships with Q3Map2, not GtkRadiant. It's not a default Q3 shader. See the extras directory in the Q3Map2 zip.



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Old Skool'
Old Skool'
Joined: 02 May 2002
Posts: 5230
PostPosted: 04-14-2005 10:19 AM           Profile Send private message  E-mail  Edit post Reply with quote


Ok, wow, just... wow. I forgot that blocks of course uses all axes. I moved the map a 128 units upwards, giving me this result.

Image

EDIT: After fine tuning my caulk hull to what I believe is best in tis map, I've gotten a quite nice result.

Going from this:
Image

To this:
Image

Thanks for all the help so far ob, I've made great progress. Gonna try to understand the trick with hints, and how to effectivly use them to remove useless portals, and replace them with optimized ones.




Top
                 

True Nightmare
True Nightmare
Joined: 15 Feb 2000
Posts: 3744
PostPosted: 04-15-2005 08:47 AM           Profile Send private message  E-mail  Edit post Reply with quote


pjw wrote:
I can see someone who doesn't quite get it thinking that the portals are actually three dimensional things instead of 2-d planes


*cough*

:paranoid: :paranoid: :paranoid:




Top
                 

True Nightmare
True Nightmare
Joined: 06 May 2000
Posts: 4373
PostPosted: 04-15-2005 06:18 PM           Profile Send private message  E-mail  Edit post Reply with quote


digibob wrote:
*cough*

:paranoid: :paranoid: :paranoid:


What...you're telling me that visportals have volume?...I'm not sure what the *cough* is supposed to mean...




Top
                 

True Nightmare
True Nightmare
Joined: 15 Feb 2000
Posts: 3744
PostPosted: 04-16-2005 05:37 AM           Profile Send private message  E-mail  Edit post Reply with quote


No, but they sure as hell are 3d :)




Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 04-16-2005 08:39 AM           Profile Send private message  E-mail  Edit post Reply with quote


They are 2D planes in a 3D world (X and Y but no Z).




Top
                 

True Nightmare
True Nightmare
Joined: 15 Feb 2000
Posts: 3744
PostPosted: 04-16-2005 09:56 AM           Profile Send private message  E-mail  Edit post Reply with quote


Edit: yeah, that's what i meant ( assuming you meant local z ), was just teasing pjw :P




Top
                 

True Nightmare
True Nightmare
Joined: 06 May 2000
Posts: 4373
PostPosted: 04-16-2005 11:47 AM           Profile Send private message  E-mail  Edit post Reply with quote


digibob wrote:
Edit: yeah, that's what i meant ( assuming you meant local z ), was just teasing pjw :P


Thanks a lot man. :)
You had me wondering if I was crazy for a bit there (or if you were).

Also:

Image




Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 04-16-2005 04:30 PM           Profile Send private message  E-mail  Edit post Reply with quote


Ohoh! Is your eternal supply of funny pictures finally running out, pjw? I've seen you post that one already. I'm soooo disappointed in you.


What... no questions? I was rather looking forward to some nice interesting discussions and thought experiments like those that we used to have. Don't tell me that everyone knows everything that they need to know about hints.



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Lifes owner
Lifes owner
Joined: 02 Feb 2002
Posts: 1300
PostPosted: 04-17-2005 02:10 AM           Profile Send private message  E-mail  Edit post Reply with quote


I love your funny pic database Pjw =)

Really interresting and complete tutorial you did there Obsidian.


I always thought PVS meant Portal Visible Set :confused: , i saw "Potential Viewable Set" somewhere in your post Obsidian.

I didn't know the existence of the skip shader... I have been fighting so long with theses 3DSolid hint...




Top
                 

Trainee
Trainee
Joined: 07 Mar 2005
Posts: 44
PostPosted: 04-17-2005 04:51 AM           Profile Send private message  E-mail  Edit post Reply with quote


Excellent tutorial - best one I've seen on hinting.
One comment; if you copy the 'skip' shader and rename the copy 'hintskip' hint brushes with it on gets filtered out in Radiant with view>filter>hint - with 'skip' they stay in view.

Here's a editor icon I made up for that purpose:

Image

cheers




Top
                 

True Nightmare
True Nightmare
Joined: 14 Nov 2000
Posts: 4216
PostPosted: 04-17-2005 06:27 AM           Profile Send private message  E-mail  Edit post Reply with quote


codey- wrote:
Excellent tutorial - best one I've seen on hinting.
One comment; if you copy the 'skip' shader and rename the copy 'hintskip' hint brushes with it on gets filtered out in Radiant with view>filter>hint - with 'skip' they stay in view.

Here's a editor icon I made up for that purpose:

Image

cheers
Ooo nice one, never thought of doing that.




Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 04-17-2005 06:50 AM           Profile Send private message  E-mail  Edit post Reply with quote


OOOooo hintskip... great tip, codey! Filtering them has been bugging me and I end up using filter translucent instead.

As far as I know, PVS has always been referred to as "Potential Viewable Set". Maybe I'm wrong... I dunno. Anyone else want to confirm?



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 04-17-2005 06:58 AM           Profile Send private message  E-mail  Edit post Reply with quote


You both are very close. It's "Potential Visible Set".




Top
                 

Trainee
Trainee
Joined: 07 Mar 2005
Posts: 44
PostPosted: 04-17-2005 11:38 PM           Profile Send private message  E-mail  Edit post Reply with quote


obsidian wrote:
OOOooo hintskip... great tip, codey!

Can't take any credit for it, I got it from a Enemy Territory mapper called SCDS_reyalP over at the q3map2 support forum when I was sweating hard hinting this bugger:

Image

cheers




Top
                 

Gibblet
Gibblet
Joined: 30 Apr 2005
Posts: 11
PostPosted: 04-30-2005 12:27 PM           Profile Send private message  E-mail  Edit post Reply with quote


Nice work obsidian :icon14:

Another thing I found useful, is to have two different hint shaders, one with surfaceparam hint, and one without.

This gives you finer control of how far your hints split (brushes with surfaceparam hint split before normal brushes). I call the one without surfaceparam hint 'subtlehint'. That, along with hintskip is included with the common shaders for ET in radiant 1.4




Top
                 

Immortal
Immortal
Joined: 15 Dec 2000
Posts: 2297
PostPosted: 04-30-2005 06:02 PM           Profile Send private message  E-mail  Edit post Reply with quote


<pedant>Potentially Visible Set</pedant>




Top
                 

Lifes owner
Lifes owner
Joined: 02 Feb 2002
Posts: 1300
PostPosted: 05-06-2005 01:46 AM           Profile Send private message  E-mail  Edit post Reply with quote


Thanks for the precision Ydnar =)




Top
                 

Gibblet
Gibblet
Joined: 30 Apr 2005
Posts: 11
PostPosted: 05-06-2005 11:56 PM           Profile Send private message  E-mail  Edit post Reply with quote


Here's a quick example of the hint/subtlehint thing I mentioned:
http://www.worldwidegaming.org/modules. ... topic&t=30

The common shaders distributed with radiant have gone back and forth between including 'surfaceparam hint' in the common/hint shader. It is desireable to have both, so check how 'hint' is defined for your particular game before you go making another one.




Top
                 

Recruit
Recruit
Joined: 23 Mar 2011
Posts: 1
PostPosted: 03-23-2011 02:36 PM           Profile Send private message  E-mail  Edit post Reply with quote


Hey

Thanks for the precision. They are very helpful.
The whole tutorial is absolutely wonderful. I am looking forward to some more nice interesting discussions.




Top
                 

Immortal
Immortal
Joined: 12 Mar 2005
Posts: 2205
PostPosted: 03-23-2011 02:38 PM           Profile   Send private message  E-mail  Edit post Reply with quote


:olo:

wait...

:confused:

Six year bump? Crazy.




Top
                 

Your Daddy
Your Daddy
Joined: 20 Feb 2000
Posts: 13095
PostPosted: 03-23-2011 04:00 PM           Profile   Send private message  E-mail  Edit post Reply with quote


I'm not saying that's a bot, but it's pretty likely a bot.



_________________
[WYD]


Top
                 

Grunt
Grunt
Joined: 12 Mar 2011
Posts: 51
PostPosted: 03-23-2011 06:15 PM           Profile Send private message  E-mail  Edit post Reply with quote


Not necessarily, a good hinting tutorial is hard to find.
Obsidian you mind if i add it to my site?




Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 03-23-2011 06:17 PM           Profile Send private message  E-mail  Edit post Reply with quote


Why? It's right here if anyone needs it. :shrug:



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Grunt
Grunt
Joined: 12 Mar 2011
Posts: 51
PostPosted: 03-23-2011 06:19 PM           Profile Send private message  E-mail  Edit post Reply with quote


I like to collect info that is of some use, but if you don't want it to be redistributed in that way it's cool.




Top
                 
Quake3World.com | Forum Index | Level Editing & Modeling


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.