Quake3World.com Forums
     Level Editing & Modeling
        Area Portals and Hint Brushes?


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




Print view Previous topic | Next topic 
Topic Starter Topic: Area Portals and Hint Brushes?

Boink!
Boink!
Joined: 19 Apr 2003
Posts: 4493
PostPosted: 10-15-2012 08:51 AM           Profile Send private message  E-mail  Edit post Reply with quote


I have been trying to help with mapping, concerning doors and area portals. Alas I know little about area portals, because I hate doors and thus never used them in my many maps for Q3A.

As I understand it, you create a hole in a structural room for a door made of structural brushes (possibly group several brushes for a more complex, multi-brush door), the door closes the hole completely. Then place an area portal brush over the structural hole in the wall that the door parts will then will close up, making the e.g. room airtight with the area portal.

If you have several windows in that room, those windows would need to also have "dynamic" shutters, i.e. door-like structural brushes that close those as well?

I tried to make a room airtight by simply plastering all windows with area portals. That leads to never showing the outside geometry though (hall of mirrors). Thus area portals only work with doors in Q3A?

(And they do NOT work like the dynamic portals in Q4 where you indeed make a room air-tight with portal brushes, and if you can look through the portal, you will see the geometry on the other side (in real time).)

I also take it that hint brushes will not work to seal off a room's window? From a hint brush line of sight point of view of course not, but maybe from a "portal" point of view maybe?

I tried to read up on area portals, but could no longer find some more detailed step by step for the issue. Any links left?

Hope Obsidian can help here.

Thanks.




Top
                 

Theftbot
Theftbot
Joined: 07 Oct 2009
Posts: 483
PostPosted: 10-15-2012 09:17 AM           Profile Send private message  E-mail  Edit post Reply with quote





Top
                 

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


First off, Q4's portals are totally different, they use a completely different way of culling geometry that is unlike hints or area portals. That is a totally different paradigm.



Hints work much by line of sight and whether or not the adjacent BSP volume can be seen from the player's line of sight. Area portals on the other hand do not work at all on line of sight. The area portal is either "open" or "closed" strictly on whether the door is open or closed, and it will only work with a door. This is why a room needs to be completely sealed ("airtight") from the rest of the map in order for the area portal to work. As soon as you poke windows into that room, the area portals will fail to work. The only holes you are allowed to have must be covered with a func_door and area portal brush.

You can have a room with two doors, both sealed by area portals. If any one door opens, the area portal is "disabled" and the contents of the area is revealed until both doors are closed again. Any holes in this room (be they doors or windows) must have a closed func_door covering them.

Area portals are pretty limiting so they aren't used all too frequently. If your room has any holes in it at all other than doors, forget about area portals and try to figure it out with hints. If your room is like swiss cheese, you may have to accept that even hints won't help at all. There are even times when converting everything to detail is at least better than a totally useless PRT.



Not really related to anything above, just a technicality about your "structural door" comment:
func_ movers (like a func_door) is never "structural", it behaves much like detail, but technically isn't either - they just become entities. Q3Map2 ignores func_ entities when calculating vis much like if you had built a wall out of a misc_model, it does not block vis. The only exception to all of this is func_group, but that's not a true entity anyway, it's just how the editor groups brushes for selection.



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Boink!
Boink!
Joined: 19 Apr 2003
Posts: 4493
PostPosted: 10-15-2012 10:02 AM           Profile Send private message  E-mail  Edit post Reply with quote


Thanks for clearing all that up, I seem to have understood most of this via my tests, but worded it badly. Good to have all that verified. Thanks for clearing up the "structural door" mistake I made, from the way the map was behaving the non-airtight room (several doors but not enough of them), i.e. the windows with "shutters" behaved as if they had been detail.

I forgot to ask:
  • IIRC there was something about hint brushes and area portals brushes intersecting. They should not right?
  • Entities should not intersect with area portal brushes, right?
  • Was there some issue with area portal brushes used as trap doors? i.e. placed horizontally?

BTW... thanks for the links above, I read the Q2 description and it was scary, because area portals in Q2 must have been extremely limited compared to Q3A.




Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 10-15-2012 10:16 AM           Profile Send private message  E-mail  Edit post Reply with quote


I'm not sure about the above bullet points as I haven't tried them or came across those situations. I suggest you test all three cases in a test map. Take the below with a fat grain of salt...

The first two sound like bad ideas and may indeed cause something to not work as intended. The third doesn't have any technical reason why it should not work just fine unless there is some odd programming laziness where they did not consider that possibility.



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

surfaceparm nomarks
surfaceparm nomarks
Joined: 10 Aug 2009
Posts: 1018
PostPosted: 10-15-2012 11:52 AM           Profile Send private message  E-mail  Edit post Reply with quote


You can only use area portals if you got a section sealed entirely by doors. Like on the small stock q3 map with haste and the flat water pool, forgot the name.

Disclaimer: I did not read all of the posts.



_________________
Portfolio
Twitter


Top
                 

Boink!
Boink!
Joined: 19 Apr 2003
Posts: 4493
PostPosted: 10-15-2012 12:14 PM           Profile Send private message  E-mail  Edit post Reply with quote


We are aware of that fact cityy... :)




Top
                 

Insane Quaker
Insane Quaker
Joined: 26 Nov 2009
Posts: 341
PostPosted: 10-15-2012 12:51 PM           Profile Send private message  E-mail  Edit post Reply with quote


Thank you already, AEon for helping me out =)
So hints combined with areas don't work... that's bad in my case.

It's about the pic in the attachment.
The red circles are area portals, the frames on top, on the bottom and on the right side have hints included. And you can always see everything. actually I thought area portals are more useful. If one area portal is opened the rest will be shut anyway. Hm... I will have to deal with this,then.

Another question concerning hints. The x in the middle is coming from the floor below, where I put two hints crossing each other. Is there any way to hinder a hint portal from continuing into the next room?




Attachments:
mittelgang-oben_areaportale.jpg
mittelgang-oben_areaportale.jpg [ 170.24 KB | Viewed 579 times ]
Top
                 

Boink!
Boink!
Joined: 19 Apr 2003
Posts: 4493
PostPosted: 10-15-2012 04:01 PM           Profile Send private message  E-mail  Edit post Reply with quote


I wonder if this possibly is a bug with the 3D-Portal-Viewer in Radiant... pretty strange anyway.




Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 10-15-2012 04:12 PM           Profile Send private message  E-mail  Edit post Reply with quote


Bliccer wrote:
Another question concerning hints. The x in the middle is coming from the floor below, where I put two hints crossing each other. Is there any way to hinder a hint portal from continuing into the next room?


Give local hint a try:

Code:
// Obsidian: Local hint works like normal hint but doesn't create portals beyond local structural brushes. Experimental, use with caution.
textures/common/hintlocal
{
   qer_nocarve
   qer_trans 0.30
   qer_editorImage textures/common/hintlocal.tga
   surfaceparm nodraw
   surfaceparm nonsolid
   surfaceparm structural
   surfaceparm trans
   surfaceparm noimpact
}



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Insane Quaker
Insane Quaker
Joined: 26 Nov 2009
Posts: 341
PostPosted: 10-16-2012 04:38 AM           Profile Send private message  E-mail  Edit post Reply with quote


Sweet. I'll do as you recommend.
If it works I should get rid of a lot of unnecessary portals.




Top
                 

Boink!
Boink!
Joined: 19 Apr 2003
Posts: 4493
PostPosted: 10-17-2012 06:03 AM           Profile Send private message  E-mail  Edit post Reply with quote


Just out of curiosity I checked, what the difference is between hint and hintlocal in code, apparently just one line, i.e. surfaceparm hint:
Code:
textures/common/hint      // should NOT use surfaceparm hint... strange but true
{
   qer_nocarve
   qer_trans 0.30
   surfaceparm nodraw
   surfaceparm nonsolid
   surfaceparm structural
   surfaceparm trans
   surfaceparm noimpact
   surfaceparm hint           // ydnar: yes it should.
}


Interesting.




Top
                 

Insane Quaker
Insane Quaker
Joined: 26 Nov 2009
Posts: 341
PostPosted: 10-17-2012 08:50 AM           Profile Send private message  E-mail  Edit post Reply with quote


Thanks to Aeon and obisidian, my map reaches constant 125fps... before I had a fps counter of 60. Hint local was the right direction for the amount of portals, and the read of the hint articles in obsidians thread from the archive were top notch. And area portals are baaaaaaaad. If you need more than 2 opposite to each other. Final release, here I come =)




Top
                 

Señor Shambler
Señor Shambler
Joined: 07 Mar 2006
Posts: 849
PostPosted: 10-17-2012 11:37 AM           Profile Send private message  E-mail  Edit post Reply with quote


I wonder how consistent local hint is - I would guess there are some weird cases where the local hint gets selected as the split plane higher up in the tree than the containing room?




Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 10-17-2012 12:25 PM           Profile Send private message  E-mail  Edit post Reply with quote


Local hint "tricks" Q3Map2 into thinks it's just another structural brush, so it generates portal planes along it's face just as any other structural brush does. That's why the portal planes will remain within its place in the tree instead of cutting clear across the map.

I should also mention that it's a good idea to use skip on other faces when using both hint and local hint. I also created a duplicate of skip and renamed it hintskip so that CTRL+H filters hint/skip brushes properly.

All of the above shaders, including editor images are already included in GtkRadiant 1.6.2, one more reason to upgrade and help us test it (though 1.6.3 is pretty close to being done).

I swear there's something else I wanted to mention about this but it slipped my mind. Probably not important and won't create a black hole in your hard drives. :paranoid:



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Boink!
Boink!
Joined: 19 Apr 2003
Posts: 4493
PostPosted: 10-18-2012 05:01 AM           Profile Send private message  E-mail  Edit post Reply with quote


A few things I was thinking about yesterday, that had previously not crossed my mind. Would be interesting to hear if I am right, or if I overlooked something.

  • In bliccer's map we came across a weird issue of two rooms, one in the east one in the west, and one in the middle, with windows/doors that should block the view, e.g. looking from east to west, where the west area should be completely hidden.

    The "hiding" was done using area portals. And per se they worked. Inside the room with multiple doors with all doors closed you could not see anything of the east or west arena.

    Then I stood in from of the door in the east arena, looking west, once the door closed in my face, I could still see almost all of the west arena.

    As it turns out standing *outside* "area portal closed" rooms does *not* block the view when looking from one door to the other. In this case the east doors could see part of a door to the west arena. I.e. closed doors do NOT block vis.

    I double-checked this in several id maps, e.g. q3dm12, that uses doors in pairs, and the only reason they work "sort of" has to do with angled corridors that naturally block vis. I.e. outside the closed double-doors, you could see geometry of the far door... not much, but enough.

    So one should try to avoid any line of sight between arena portals, letting you additionally add hint brushes to really "close off vis". To me that pretty much retroactively justifies never using doors and area portals. Area portals are only useful for "end rooms" with pretty much only one door, apparently.


  • I always thought that hint brush planes actually cut up structural geometry when they are extended into e.g. walls. But after some though that does not seem to happen, only the "empty" space in the map gets cut up, right?

    I probably knew about this, only forgot, and was adding hint brushes by experience and instinct :owned:




Top
                 

Señor Shambler
Señor Shambler
Joined: 07 Mar 2006
Posts: 849
PostPosted: 10-20-2012 09:10 AM           Profile Send private message  E-mail  Edit post Reply with quote


AEon wrote:
I always thought that hint brush planes actually cut up structural geometry when they are extended into e.g. walls. But after some though that does not seem to happen, only the "empty" space in the map gets cut up, right?

I probably knew about this, only forgot, and was adding hint brushes by experience and instinct :owned:


It shouldn't matter whether the hint brush extends into the wall or not since the face still defines a plane which extends across the entire area.

(unless Q3 does something weird, but I don't think it does...)




Top
                 

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


I think he means he thought hints actually split polygons?



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Boink!
Boink!
Joined: 19 Apr 2003
Posts: 4493
PostPosted: 10-21-2012 09:10 AM           Profile Send private message  E-mail  Edit post Reply with quote


Yes, that is what I thought.




Top
                 

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


Here is a test map using areaportals. It has a central room connected by hallways to 3 other rooms, each hallway is closed off with a door using an areaportal. There are no hints. Areaportal is only applied to one face of the brush, other sides are using skip. Standing in each of the rooms with the doors closed will hide most geometry unless doors are opened, even when two areaportals are facing one another.

http://robotrenegade.com/maps/tests/areaportaltest.map



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Señor Shambler
Señor Shambler
Joined: 07 Mar 2006
Posts: 849
PostPosted: 10-22-2012 09:57 AM           Profile Send private message  E-mail  Edit post Reply with quote


AEon wrote:
Yes, that is what I thought.


Okay I see... didn't read the question correctly. Hint planes should be chopping geometry in half, they're just regular split planes with higher priority (AFAICT).




Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 10-22-2012 12:32 PM           Profile Send private message  E-mail  Edit post Reply with quote


Wait, what? Hint should definitely not be chopping geometry or have any effect on geometry at all. It only splits BSP volumes (the invisible space contained within a bunch of stuctural geometry).



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 

Señor Shambler
Señor Shambler
Joined: 07 Mar 2006
Posts: 849
PostPosted: 10-28-2012 12:39 AM           Profile Send private message  E-mail  Edit post Reply with quote


As we talked about on IRC the rendering geometry definitely isn't getting chopped by split planes. However, intermediate geometry is actually chopped up during compilation, which seems like a point of confusion (for me at least).

Hint planes are split planes with a higher priority for selection. That means given a choice between a split plane from a structural brush and a split plane from a hint brush, the hint brush split plane will (in most cases) win out, but both planes will ultimately be used in exactly the same way.

Suppose we have the following test map:



The map is composed of 7 structural brushes: 6 of which are generic and one of which has hint on one of its faces (with all other faces covered in skip). If you ask the specific question, "will the hint plane from the hint/skip brush split in half the brush polygons it intersects?" the answer is "Yes, temporarily during BSP construction."

For simplicity, assume I've turned off blocksize. The function ProcessWorldModel creates a BSP tree for world brushes. After some setup, it makes the following function calls:

Code:
   /* build an initial bsp tree using all of the sides of all of the structural brushes */
   faces = MakeStructuralBSPFaceList( entities[ 0 ].brushes );
   tree = FaceBSP( faces );
   MakeTreePortals( tree );
   FilterStructuralBrushesIntoTree( e, tree );


The first line does exactly what the code says. It loops through all structural brushes and adds pointers to a copy of each face to a list. The brushes in the test map will be ordered in some way - probably in the order I created them - and similarly the function will go through and add their faces in that order. I created the hint brush last, so it's probable that it will be added as one of the last in the face list. We'll see in a minute why this isn't going to matter for answering the question. If you look at MakeStructuralBSPFaceList, you can see how q3map2 is using hint and skip:

Code:
   for ( b = list; b != NULL; b = b->next )
   {
      if ( b->detail ) {
         continue;
      }

      for ( i = 0; i < b->numsides; i++ )
      {
         /* get side and winding */
         s = &b->sides[ i ];
         w = s->winding;
         if ( w == NULL ) {
            continue;
         }

         /* ydnar: skip certain faces */
         if ( s->compileFlags & C_SKIP ) {
            continue;
         }

         /* allocate a face */
         f = AllocBspFace();
         f->w = CopyWinding( w );
         f->planenum = s->planenum & ~1;
         f->compileFlags = s->compileFlags;  /* ydnar */

         /* ydnar: set priority */
         f->priority = 0;
         if ( f->compileFlags & C_HINT ) {
            f->priority += HINT_PRIORITY;
         }
         if ( f->compileFlags & C_ANTIPORTAL ) {
            f->priority += ANTIPORTAL_PRIORITY;
         }
         if ( f->compileFlags & C_AREAPORTAL ) {
            f->priority += AREAPORTAL_PRIORITY;
         }

         /* get next face */
         f->next = flist;
         flist = f;
      }
   }


The next call starts to construct the BSP tree. It, in turn, calls the main recursive function, BuildFaceTree_r, and passes in the structural face list. One of the first things BuildFaceTree_r does is select the best split plane to use from the input face list with SelectSplitPlaneNum. It prefers planes that are shared by many faces, and penalizes planes that produce splits. It gives significant preference to planes marked as hint planes (which is why it's called hint, it's like telling the compiler, "hey choose me first!"). Concretely:

Code:
for ( split = list; split; split = split->next )
   {
      if ( split->checked ) {
         continue;
      }

      plane = &mapplanes[ split->planenum ];
      splits = 0;
      facing = 0;
      front = 0;
      back = 0;
      for ( check = list ; check ; check = check->next ) {
         if ( check->planenum == split->planenum ) {
            facing++;
            check->checked = qtrue; // won't need to test this plane again
            continue;
         }
         side = WindingOnPlaneSide( check->w, plane->normal, plane->dist );
         if ( side == SIDE_CROSS ) {
            splits++;
         }
         else if ( side == SIDE_FRONT ) {
            front++;
         }
         else if ( side == SIDE_BACK ) {
            back++;
         }
      }
      value =  5 * facing - 5 * splits; // - abs(front-back);
      if ( plane->type < 3 ) {
         value += 5;       // axial is better
      }
      value += split->priority;       // prioritize hints higher

      if ( value > bestValue ) {
         bestValue = value;
         bestSplit = split;
      }
   }


In the example test map, the hint plane will produce splits and be penalized, but its split->priority will equal HINT_PRIORITY which is defined as 1000. This will easily be larger than any other value, and so the hint plane will be chosen as the first split plane. Keeping this in mind, we go back to the tree construction and see what the chosen plane is used to do. For each face in the input list, the function determines whether it lies totally behind, totally in front, or straddles the plane. In straddling cases, the face is clipped in half by the plane (ClipWindingEpsilon), producing two new polygons:

Code:
/* determine which side the face falls on */
      side = WindingOnPlaneSide( split->w, plane->normal, plane->dist );

      /* switch on side */
      if ( side == SIDE_CROSS ) {
         ClipWindingEpsilon( split->w, plane->normal, plane->dist, CLIP_EPSILON * 2,
                        &frontWinding, &backWinding );
         if ( frontWinding ) {
            newFace = AllocBspFace();
            newFace->w = frontWinding;
            newFace->next = childLists[0];
            newFace->planenum = split->planenum;
            newFace->priority = split->priority;
            newFace->compileFlags = split->compileFlags;
            childLists[0] = newFace;
         }
         if ( backWinding ) {
            newFace = AllocBspFace();
            newFace->w = backWinding;
            newFace->next = childLists[1];
            newFace->planenum = split->planenum;
            newFace->priority = split->priority;
            newFace->compileFlags = split->compileFlags;
            childLists[1] = newFace;
         }
         FreeBspFace( split );
      }
      else if ( side == SIDE_FRONT ) {
         split->next = childLists[0];
         childLists[0] = split;
      }
      else if ( side == SIDE_BACK ) {
         split->next = childLists[1];
         childLists[1] = split;
      }


So, in the test map, temporary copies of the polygons that compose the floor, ceiling, and two of the walls will be split in half by the hint plane going through the middle, during BSP construction.




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.