Author Topic: Quick question about Struct/Detail brushes  (Read 5847 times)

nubcake

  • Posts: 529
  • Turrets: +49/-85
Quick question about Struct/Detail brushes
« on: November 26, 2008, 07:28:10 am »
If i have a room made out of Structural brushes (ie walls roof, ceiling etc) does that mean the game engine doesnt need to process whats behind those walls (assuming its not in the visible range of the player)? For example

-----------------------------------------
-                                                       -
-                                                       -
-        ------                                ++   -
-        -    p -                                ++  -
-        ------                                      -
-                                                      -
-                                                      -
-----------------------------------------

- = Structural Brush
+ = Detail Brush
p = Player position

In that diagram, will the players PC need to render those detail brushes, even when they arent visible? Also, If the box the player is in were all detail brushes, would his PC render the outer brushes (brushes outside the room)?


gimhael

  • Posts: 546
  • Turrets: +70/-16
Re: Quick question about Struct/Detail brushes
« Reply #1 on: November 26, 2008, 08:40:28 am »
As far as I understand the algorithms the compiler uses the structural brushes to split up the level into several areas called 'clusters'. Then it computes for each pair of clusters if any point of the first cluster is visible from any point of the second cluster and stores the result in the bsp file.

During rendering the engine looks up the cluster in which the player (resp. the camera) is and renders only those clusters that were marked as potentially visible during compilation.

This algorithm doesn't help much if you have a large room with a box or pillar in the middle, because it will hide different parts of the room depending on the camera position and so the engine will just draw them all anyway. So you could just make it a detail brush to speed up the compiler.

Where it does help are solid walls, U-turns, turns in small passages etc. where the potentially visible part of the map is cut off no matter where the camera is placed.

You can see what parts of the map are actually rendered when you load the map with /devmap <map> and then /r_showtris 1 from the console.

nubcake

  • Posts: 529
  • Turrets: +49/-85
Re: Quick question about Struct/Detail brushes
« Reply #2 on: November 26, 2008, 09:18:05 am »
Thanks for the reply. The reason i ask is because while testing my new map, for compilation time purposes ive made all my brushes except the bounding box brush detail. In a particular part of the map i get a FPS drop due to alot of brushes, but, in another part of the map, even when no brushes except the wall is visible, if i face the direction the mound of brushes are i get the same FPS drop. Its as if my PC is rendering all those behind the wall, even when its not visible. Thats why i was wondering if it is changed to structural if i will make a difference (i havent done so yet it will will make my map compile alot slower)

UniqPhoeniX

  • Spam Killer
  • *
  • Posts: 1376
  • Turrets: +66/-32
Re: Quick question about Struct/Detail brushes
« Reply #3 on: November 26, 2008, 12:48:40 pm »
3rd link in Useful mapping links: http://tremmapping.pbwiki.com/Understanding+Vis+and+Hint+Brushes
You can see how your map is divided when you load the .prt file.
« Last Edit: November 26, 2008, 12:50:50 pm by UsaKilleR »

nubcake

  • Posts: 529
  • Turrets: +49/-85
Re: Quick question about Struct/Detail brushes
« Reply #4 on: November 26, 2008, 01:26:51 pm »
Thanks for the link USA, although ive seen it before. I still need a basic answer, yes or no, will a structural wall differ from a detail brush in terms of brushes outside of it being rendered?

UniqPhoeniX

  • Spam Killer
  • *
  • Posts: 1376
  • Turrets: +66/-32
Re: Quick question about Struct/Detail brushes
« Reply #5 on: November 26, 2008, 02:05:21 pm »
That depends on how the compiler divides your map. If it's possible from anywhere in the portal you are in to see any part of the portal the brushes are in, then they will be drawn. If you are in a completely sealed room, then the outside area won't be drawn. If you want to test in-game, use:
You can see what parts of the map are actually rendered when you load the map with /devmap <map> and then /r_showtris 1 from the console.

nubcake

  • Posts: 529
  • Turrets: +49/-85
Re: Quick question about Struct/Detail brushes
« Reply #6 on: November 26, 2008, 02:38:25 pm »
I was in a completely sealed room, and the entire outside was shown. Im guessing that 'sealed' room needs to be sealed with structural brushes...

Ingar

  • Tremulous Developers
  • *
  • Posts: 554
  • Turrets: +302/-7
    • Ingar's projects on the Web
Re: Quick question about Struct/Detail brushes
« Reply #7 on: November 26, 2008, 05:29:21 pm »
UsaKiller is right by saying it depends on the compiler. What you probably need the hear is this:
when the compiler divides your map, it will do so using the structural brushes only. It will ignore
detail brushes in this step. The old saying anything but the map hull should be detail is not completely accurate.

Anything that blocks visibility should be structural. Detail brushes do not block vis. Models do not block vis.
Doors do not block vis! Sky does no block vis (this sounds obvious until you're confronted with it).

Note that visibility here does not mean what you can see but rather what will be rendered.
This means if one room is visible when standing in a second room they will be both rendered,
even if there is  a wall of detail brushes between them, and the player can't look into the second room
from within the first.

Imagine two locations in your map. If you can draw a straight line between the two locations that does not
intersect with a structural brush, these two locations will be visible to each other.

Visibility is one of the most difficult and non-obvious aspects of mapping. Bad vis will kill performance because
the area that has to be rendered gets too big.

Note: even if you play by the rules, the compiler does not always calculate the optimal visibility.
It is still possible there are areas you can't see but that still get rendered.
« Last Edit: November 26, 2008, 05:45:25 pm by Ingar »

seeeker

  • Posts: 122
  • Turrets: +19/-5
Re: Quick question about Struct/Detail brushes
« Reply #8 on: November 27, 2008, 12:22:33 am »
Yes.

do r_showtris 1, it should help you see that =)

another awesome tool (when you are adding hint brushes) is on plugins-> prtview -> load prt, run that after you do a basic bsp -meta, it will show you how your portals are divided.

Having in mind how portals and vis works while mapping will greatly help you increase the efficiency of your map. Read and reread that guide and also do some testing with hint, structural and detail brushes along with r_showtris =)

Note: >_> i didn't see it had been answered previously, but yea =P
« Last Edit: November 27, 2008, 12:27:41 am by seeeker »

nubcake

  • Posts: 529
  • Turrets: +49/-85
Re: Quick question about Struct/Detail brushes
« Reply #9 on: November 27, 2008, 05:22:38 am »
Thanks alot guys :D Ingars explanation answered my question. :D