Hint Brush - Optimizing polygon count in complex levels....
-
- Posts: 866
- Joined: Fri Jul 08, 2005 4:27 am
- Location: PA, USA
Hint Brush - Optimizing polygon count in complex levels....
Ok, I am assuming, which is a very bad thing to do, that when RF renders a scene it renders all polgons in the feild of view whether they are blocked by another object or not. So it would be like this screens here:
The regular render:
now this screen shows the polys rendered:
The above screen shows that the whole hallway is being rendered even though it isnt seen.
These screens found at: http://www.twhl.co.za/tutorial.php?id=71
is showing a T juction hallway with some small objects down the sides at the end of it. There are bookselves and desks. Now I am assuming that this screen is what RF does. It is rendering the other sections of the hall that are not visable to the eye. The tutorial shown in the full webpage the screen is from talks about "hint" brushes in the Half Life game engine and world editor that can stop the rendering of the excess polygons. So, is there any way in RF to render only what the human eye sees? Or will it render everything no matter what?
*Note I have not worked with RFs world editor enough that I should know an answer to this question. I am currently starting to 3D model everything for my game and I am worried about frame rates because I want to make a FPS that is fairly advanced(dual weilding, have many enemies on screen at one time and having a decently detailed world).
The regular render:
now this screen shows the polys rendered:
The above screen shows that the whole hallway is being rendered even though it isnt seen.
These screens found at: http://www.twhl.co.za/tutorial.php?id=71
is showing a T juction hallway with some small objects down the sides at the end of it. There are bookselves and desks. Now I am assuming that this screen is what RF does. It is rendering the other sections of the hall that are not visable to the eye. The tutorial shown in the full webpage the screen is from talks about "hint" brushes in the Half Life game engine and world editor that can stop the rendering of the excess polygons. So, is there any way in RF to render only what the human eye sees? Or will it render everything no matter what?
*Note I have not worked with RFs world editor enough that I should know an answer to this question. I am currently starting to 3D model everything for my game and I am worried about frame rates because I want to make a FPS that is fairly advanced(dual weilding, have many enemies on screen at one time and having a decently detailed world).
Think outside the box.
To go on an adventure, one must discard the comforts and safety of the known and trusted.
To go on an adventure, one must discard the comforts and safety of the known and trusted.
-
- Posts: 866
- Joined: Fri Jul 08, 2005 4:27 am
- Location: PA, USA
Wow really?!! Why isnt this documented in the current RF guides?(I should remember to add a chapter in the RF book project about this) It seems like its somthing that can make or break a games frame rate if used properly. Well, I guess I will be reading up on hint brushes.
Thanks for the help!
BTW what on earth is that r_speed taht the tut. talks about?
Thanks for the help!
BTW what on earth is that r_speed taht the tut. talks about?
Think outside the box.
To go on an adventure, one must discard the comforts and safety of the known and trusted.
To go on an adventure, one must discard the comforts and safety of the known and trusted.
-
- Posts: 866
- Joined: Fri Jul 08, 2005 4:27 am
- Location: PA, USA
Wow, after decifering numerous tutorials and explainations of "hint" brushes, I think I now fully understand them. Basically the game engine breaks up and renders sections of the map. These sections are then used to render polygons on screen. So basically the game looks at the games premade boxes to render. And if anywhere in my current box I can see another box, the game enigne will render the other box and its contents. So basically these hint brushes are used to divide up the visability zones of your game and thus make less boxes visable from your players view.
So in summary and maybe to make myself clearer:
The game engine breaks the bsp file into triangles and visability sections.
The visibility section that the camera is in is always rendered.
Any other visibility section that can be seen from your current visable section will also be rendered.
This rendering of other visability zones is not determined by where the camera is but by where the camera could be in the visability zone.
So lets say you have a long hallway with a room at both ends.off to the right. So its a c shape
Logically the game engine breaks it down into 3 visability sections as so:
Note the long vertical room of visibilty, and the two small rooms of visibility. Now this isnt always the way that the engine will divide up the space. It is unknown if the engine will cut it like above or like this:
How the engine devides up these rooms is key to rendering the other rooms.
Now lets lable the hallway on the left A the top room B and the bottom room c.
This section will explain hint brushes according to diagram A.
While in the top room(b) from any place you can only see into the hallway(A). Right?
While in the bottom room no matter where you are placed, you can only see into the hallway.
Now in the hallway, you have the possibility to see into the top room(b) or the bottom room(c).
So, what will the game render besides the hallway when you are in it? You can possibly see into the two other visibily rooms B and C remember.
When given this problem the game sees what rooms are possible to see from any point in your current room. So in other words, both rooms will be rendered.
So waht about Diagram B?
In diagram B no matter what room you are in you can posibly see into all of the other rooms. So the engine will simply render all of the rooms at the same time.
How can I fix diagram B?
You will have to see the tutorials online for this: I cant show it in code diagrams.
Here are the full diagrams that made everything click for me.
http://developer.valvesoftware.com/wiki/Visleaves
http://developer.valvesoftware.com/wiki/Hint_brush
So in summary and maybe to make myself clearer:
The game engine breaks the bsp file into triangles and visability sections.
The visibility section that the camera is in is always rendered.
Any other visibility section that can be seen from your current visable section will also be rendered.
This rendering of other visability zones is not determined by where the camera is but by where the camera could be in the visability zone.
So lets say you have a long hallway with a room at both ends.off to the right. So its a c shape
Code: Select all
Diagram
_____
[ ___]
[ ]
[ ]___
[_____]
Code: Select all
Diagram A
_____
[ |__]
[ ]
[ ]___
[__|__]
Code: Select all
Diagram B
_____
[____]
[ ]
[__]__
[____]
Now lets lable the hallway on the left A the top room B and the bottom room c.
This section will explain hint brushes according to diagram A.
While in the top room(b) from any place you can only see into the hallway(A). Right?
While in the bottom room no matter where you are placed, you can only see into the hallway.
Now in the hallway, you have the possibility to see into the top room(b) or the bottom room(c).
So, what will the game render besides the hallway when you are in it? You can possibly see into the two other visibily rooms B and C remember.
When given this problem the game sees what rooms are possible to see from any point in your current room. So in other words, both rooms will be rendered.
So waht about Diagram B?
In diagram B no matter what room you are in you can posibly see into all of the other rooms. So the engine will simply render all of the rooms at the same time.
How can I fix diagram B?
You will have to see the tutorials online for this: I cant show it in code diagrams.
Here are the full diagrams that made everything click for me.
http://developer.valvesoftware.com/wiki/Visleaves
http://developer.valvesoftware.com/wiki/Hint_brush
Think outside the box.
To go on an adventure, one must discard the comforts and safety of the known and trusted.
To go on an adventure, one must discard the comforts and safety of the known and trusted.
Oh boy, those are great!! THose links explained so much. As you said, they 'clicked'. I have read about, leafs, visleafs, hint brushs, how bsp renders polys, etc, but those two short articles really made sense.
I tried to make this a sticky!, but couldn't. QOD, can you please sticky this?
I tried to make this a sticky!, but couldn't. QOD, can you please sticky this?
Steve Dilworth - Resisting change since 1965!
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
It is documented in the editor help:Why isnt this documented in the current RF guides?
Hint
A hint brush is invisible and doesn't block passage. Hint brushes instruct the level compiler to split along a particular plane. Their sole purpose is to help the level compiler generate a more efficient level.
Thanks for the sticky, QOD!!
I think what helped most about the tutorials was the graphic representation linked with the explanation of what the hint brush was achieving. It truly helped me to understand how the hint brush forces the engine to split the leafs, and what it truly does for your level. I know of many places I will be using them from now on.
I think what helped most about the tutorials was the graphic representation linked with the explanation of what the hint brush was achieving. It truly helped me to understand how the hint brush forces the engine to split the leafs, and what it truly does for your level. I know of many places I will be using them from now on.
Steve Dilworth - Resisting change since 1965!
-
- Posts: 866
- Joined: Fri Jul 08, 2005 4:27 am
- Location: PA, USA
Here is a tutorial that explains horizontal hint brushes: Also very good:
http://www.sourcemapping.org/akg/tutorials/wiseHINT.asp
Now I need to find some tutorials on how to use hint brushes for large outdoor environments. I have read that it is possible to use hint brushes in outdoor areas, but I cant figure out how.
http://www.sourcemapping.org/akg/tutorials/wiseHINT.asp
Now I need to find some tutorials on how to use hint brushes for large outdoor environments. I have read that it is possible to use hint brushes in outdoor areas, but I cant figure out how.
Think outside the box.
To go on an adventure, one must discard the comforts and safety of the known and trusted.
To go on an adventure, one must discard the comforts and safety of the known and trusted.
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
Hint brushes are not really suited for outdoor environments (to be more precise, the bsp structure genesis3d is using is not suited for outdoor environments no matter how you try to optimize it)
Also keep in mind, that all these tutorials are _not_ for the genesis3d engine so the hint brushes in genesis3d may produce different results.
Also keep in mind, that all these tutorials are _not_ for the genesis3d engine so the hint brushes in genesis3d may produce different results.
I dont know if the issue has been fixed, but if i remember correctly, hint brushes in RF do not function properly.
to achieve the same effect as a hint brush, I kinda remember someone saying that we needed to use a empty brush or something like that. Maybe QOD or wxb1 remembers just what it was.
pretty much the only situation i could see for using hint brushes outdoors would be in a city environment with no actual terrain. In this case, the environment is actually constructed much more like an indoor environment, with streets being hallways and buildings being walls.
to achieve the same effect as a hint brush, I kinda remember someone saying that we needed to use a empty brush or something like that. Maybe QOD or wxb1 remembers just what it was.
pretty much the only situation i could see for using hint brushes outdoors would be in a city environment with no actual terrain. In this case, the environment is actually constructed much more like an indoor environment, with streets being hallways and buildings being walls.
-
- Posts: 866
- Joined: Fri Jul 08, 2005 4:27 am
- Location: PA, USA
I think I know how to use hint brushes outdoors. The way to do it is to have the terrain contain many hills and valleys. When the land is constructed like this, you can use horizontal and vertical hint brushes to divide up the valleys as individual boxes to render. That way when you are in a valley, only the valley you are in will be rendered. The others will however be rendered when you are on top of a hill but the poly count can be minimized there. You would use LOD for buildings and objects along with a do not render objects unless player is x ammount of texels close to it you should be fine. Only the terrain and the low polygon buildings would then be rendered.
So, do the hint brushes work in RF or not?
So, do the hint brushes work in RF or not?
Think outside the box.
To go on an adventure, one must discard the comforts and safety of the known and trusted.
To go on an adventure, one must discard the comforts and safety of the known and trusted.
Hint brushes are good in most cases, but sometimes empty brushes are even better, in this case with mirrors:
I had a level with 4 mirrors in it, all of them in seperate rooms. At first the framerate was REALLY bad. But then i got the idea to fill the doorways to the rooms with empty brushes (NOT transparent), and fitting to the theme of the level, water, i made them 'water'-doors.
Then outside of the rooms i got 30fps instead of 10 and inside them i got 60fps.
If i had made hint brushes, or transparent empty brushes, the mirrors could still have been seen from the outside resulting in bad framerates.
(Area brushes are also an option to get the same effect)
Remind: Place Mirrors inside small, 'closed' rooms. Use area or empty brushes for the doors.
I think hint brushes are working because i once added a hint brush into a level for testing and got an extra leaf in the bsp-tree ->Hint brushes create portals, helping the compiler to optimize the level.
I had a level with 4 mirrors in it, all of them in seperate rooms. At first the framerate was REALLY bad. But then i got the idea to fill the doorways to the rooms with empty brushes (NOT transparent), and fitting to the theme of the level, water, i made them 'water'-doors.
Then outside of the rooms i got 30fps instead of 10 and inside them i got 60fps.
If i had made hint brushes, or transparent empty brushes, the mirrors could still have been seen from the outside resulting in bad framerates.
(Area brushes are also an option to get the same effect)
Remind: Place Mirrors inside small, 'closed' rooms. Use area or empty brushes for the doors.
I think hint brushes are working because i once added a hint brush into a level for testing and got an extra leaf in the bsp-tree ->Hint brushes create portals, helping the compiler to optimize the level.
Everyone can see the difficult, but only the wise can see the simple.
-----
-----