Jump to content

Home

Use of the Area Portal shader to boost framerate


Patrick_H

Recommended Posts

OK. My maps are messy. They are complex. They often have leaks. I am lucky I just learned about using the Region setting.

 

When running on a Geforce 3 1.4 GHz machine, my MP map was getting knocked down to under 30 fps. Like I said, its complex. I didn't and don't completely understand the concept of Portals. But I did figure out that if a brush covered in the "Area Portal" shader stands between my point of view and a lot of triangles, then the engine wouldn't be trying to draw them while I look in that direction.

 

With that in mind I realized that when I looked at the side of my free standing building, the engine was drawing the side of the building I looked at, the interior, the interior floor above, the exterior wall on the other side of the building, the bridge on that side, and the rocky wall beyond. My solution was this- embed an Area Portal Brush in every wall of the building I could find. Eureka! My framerate in those areas jumped from the low 20 fps up to a low of 45!

 

I just thought I'd share this revelation with those having similiar trouble.

Like I said, its messy- but it got great results. My map is now very playable.

Link to comment
Share on other sites

Err, I don't think you have this quite right. There are two types of brushes, structural and detail. The engine draws things behind detail bushes and entities like doors, but does not draw thing behind structural brushes. The main walls, cielings and floors of the buildings should be structural brushes, and so shouldn't have the engine drawing things behind them - so no need to put areaportals in these walls. You use area portals, as far as I understand, to block up holes in the structural walls, for things such as doors. Putting area portals into the holes for doors (1 unit thick) will stop the engine drawing behind them and will improve FPS. As far as I know putting area portals into structural walls will have no effect, and if they aren't structural - they should be.

Link to comment
Share on other sites

True. I was going under the basic assumption that most of my brushes not touching the void should be detail brushes. The walls of my building are complicated and made of many brushes. To speed up compile time I made them detail brushes, thus caulking many, many unseen surfaces. If I kept all of the brushes on the buildings exterior as structural, wouldn't I be waiting around a long time for it to compile? And I swear to you those embedded area portal brushes did speed up my framerate. Maybe I'm just being lazy about waiting for my compile...

 

Oh, and what's that console command to show drawn triangles? I think I tried it but nothing happened.

Link to comment
Share on other sites

Dread: You build a brush with the shader system/areaportal. :)

 

Patrick: Area portals are ONLY for DOORS, not walls in general. To keep the engine from drawing behind walls, you want those walls to be structural as Kengo just explained.

 

To get more complicated, you can use a hint brush to force a split in the VIS process, but that doesn't necessarily prevent the game from drawing behind the brush.

Link to comment
Share on other sites

So is it possible I found another good use for the Area Portal shader? Before I used it I made the exterior walls detail and then structural with no improvement in framerate. The Area Portal trick is the only thing that worked. When playing the map the only difference is faster FPS!

 

Anyone have a good explanation for this phenomenon or would care to examine the .map file?

 

It's currently taking 30 minutes to compile so if something works I tend to not want to mess with it.

Link to comment
Share on other sites

Originally posted by rgoer

The command you asked about is "r_showtris 1"--however, as far as I can tell, it only works in jk2sp.exe, so you have to "devmap yourmap" in that instead of jk2mp.exe.

It works in MP too, but needs a "developer 1" command after the devmap and before the r_showtris. ;)
Link to comment
Share on other sites

Patrick: Area portals are ONLY for DOORS, not walls in general. To keep the engine from drawing behind walls, you want those walls to be structural as Kengo just explained.

Yeah. However, I have frequently turned my door frames that protrude somewhat from the wall detail and then stretched the areaportal to also cover them, not only the door. But that's only a little larger area than the door itself. The walls are of course structural. Works just fine.

Link to comment
Share on other sites

  • 2 weeks later...

Tonight I realized one of my reasons for trouble building doorways with area portals. Rich Diesal's tutorial- while quite thorough, led me to believe he constructed his doorway from detail brushes and then stuck an area portal in amongst them. It's a bit unclear... so anyway I made all those brushes there structural and now I've got it- the junk.txt file reports no faulty area portals!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...