Questions About Leaves
crode
Join Date: 2002-11-09 Member: 7876Members
<div class="IPBDescription">>0<</div> hey all im have problems dealing with too many leaves on my map causing bsp to crash outright. As far as i can tell leaves are faces that get divided where is comes into contact with other faces. Is this correct? Anyone know ways of lowering them?
Comments
The VOLUME of your map gets divided into leaves that are conected to each other at its faces by leaf portals.
This leaf creation ignores brushes of any type.
Leaves are important for the VIS calculation, wich does not more that testing which leaf is visible from each other leaf (=vis matrix)
You can control the way of getting leaves created by using the a HINT brush wisely.
Now, the easyer it is to fill the volume of your map with cubes, cylinders, pyramids, tetraeders (all simple convex/round brush types)... the less leaves your map uses.
Curved convex surfaces (pipes) cause the most leaves, when they are solid. converting them into brushes helps alot.
Simplify your architecture. You can think of leaves as volumes that describe the space inside your map that brushes don't take up -- they aren't really the opposite of brushes, but that's a simple way of thinking about them that might help you to visualize what's going on. Like a brush, a leaf must describe a convex polyhedron (a polyhedron is to three dimensions what a polygon is to two; convex means that any straight line segment starting inside the shape can't pass out of the shape and then back into it again).
Think about what would happen if you tried to use your entire map with a CSG carve operation on a solid block, then removed the resulting brushes that were outside of your original walls -- that's equivalent to the volume that leaves occupy (but not how leaves are created). To reduce the number of leaves, you'll need to think about how you would reduce the number of brushes resulting from that carve.
<!--QuoteBegin--Ollj+Apr 25 2003, 07:31 AM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Ollj @ Apr 25 2003, 07:31 AM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Curved convex surfaces (pipes) cause the most leaves, when they are solid. converting them into brushes helps alot.<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
I think he means brush entities <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->.
I know about how to use the hint/skip but will this lower the leaves count or just optimize the visibility for lower r_speeds?
i tried increasing max_node_size to 2048 and i cut them down a bit (94.5%) At least it finished compiling. although i guess this causes some vis calculation problems....
Yes lots of details on this map thanks to your wonderful compile additions Cagey <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo--> It would be a disgrace to remove some of them
To a mapper it would make more sense to call leaves Volumes or Chunks o' Space.
Clipnode is another programmer term, since node is another term for the points in a tree structure.
I know about how to use the hint/skip but will this lower the leaves count or just optimize the visibility for lower r_speeds?
i tried increasing max_node_size to 2048 and i cut them down a bit (94.5%) At least it finished compiling. although i guess this causes some vis calculation problems....
Yes lots of details on this map thanks to your wonderful compile additions Cagey <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo--> It would be a disgrace to remove some of them <!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
playing around with maxnodesize changes your leafes, most times decreasing their number.
Clip brushes do not affect leafes or VIS but they help you lowering max_map_clipnodes.
HL uses 4 Hulls:
The vis hull , determines what you can see, and were skulks can climb, and 3 player hulls, determines were you can move around as what creature.
leafnodes are volumes, as has been said. they are used to determine what you can see - the VIS works not from point to point, but from leafnode/area to leafnode/area. the number of them depends on how your level is divided up. here are a few of the things that affect the division:
<b>maxnodesize</b>: this says how big the biggest leafnode can be. if you have wide open flat areas (outdoors?) it is a BIG factor, and you would want to raise the maxnodesize of a leafnode to 2048 or 4096. but for twisty indoors maps, like most NS maps the default maxnodesize of 1024 is fine. if you are fighting r_speeds and can afford more leafs, 512 may cut down on r_speeds a little - or may not.
<i>related - i have noticed that leafnodes also cut up the faces of brushes if the face is bigger than the maxnodesize, eg if you stretch a texture 9x to lower wpolys on a 2048x2048 floor brush, it will STILL be chopped up from 1 wpoly into 4 by the maxnodesize of 1048.</i>
maxnodesize only affects the x and y axis, not the z - leafnodes always go up as high as they can, until the upper brush or a HINT is reached.
<b>planes</b>: a leaf node seems to be made for every change in altitude by a <b>regular</b> brush. example, stairs - each stair step, if a regular brush, will get 2 leafnodes (triangle wedges) that go up as high as they can. so a set of 15 steps = 30 more leaf nodes. make the whole stair into one func_wall and you can save those 30 leafnodes, or make just 2 more for the area.
now NS is short on entitys, so you do not want to overdo that either. so you got to think - is this trim brush/ledge/stair/furniture brush needed at all? do i want to make it a func wall and use an entity, or leave it a regular brush that requires 2 leafnodes for its top/bottom, or turn it into a decor texture variant?
and remember, it is not just the tops of the brush, it can also be the bottom if your ceiling regular brushes goes up and down.
<b>HINT/skip</b>: this brush also cuts leafnodes like a knife thru jello, or forces the compiler to change how the leafnodes are laid out. but it also cuts across the next portal face of the next leafnode, chopping up brushes wpolys along the way.
HINT can help the VIS to make better use of what you can see from where, so you have lower r_speeds. example: 2 corridors filled with long leafnodes - if you stand far from the corner the engine is still rendering things way down the other corridor. but if you use HINT to cut up the leaf nodes, you will see less.
another example: tall elevator shaft. remember leafnodes go up/down until they hit a brush or HINT. so if you stand in the bottom the engine could be thinking you can see down the long corridor by the upper entry. but if you put a HINT across the elevator shaft middle, it could stop you from "peeking over" the top.
but HINT does make more leafnodes, by cutting up the longer ones.
i *think* those 3 are the only factors deciding how leafnodes are made, and what size. your main problem is probably too many small regular non-entity brushes, each of whose top/bottom will need 2 leafnodes. if you decide you NEED them, func_wall them if you can afford the entity. otherwise start removing them.