Thursday, April 28, 2011

Map optimization part 2

I will now show you what is vis leafs and how it will influence your map design.

While you play a linear design game like cs, call of duty, l4d2,etc every polygon on the map is not calculated. To shorten the load on the processor, only the polygons visible to the player is rendered and textured.
        But how can the game engine know which polygons are seen by the player
When you compile your map, it runs through 4 processes; bsp, csg, vis and rad. During the vis process, the area visible by the player will be calculated.

2 Rooms are conected by a corridor. The player is standing on the blue circle. From his viewpoint, he can see about 1/3 portion of the other room. But if you test this map and turn gl_wireframe 2, you will see the entire room being rendered. To fix this, I am taking another example.


The rooms being rendered are shown by an orange outline. The small room on the southeast corner is not actually being rendered but if the corridor is placed further north and the viewpoint shifts to the north, the room will get rendered. Partly because the corridor joining the small room is too small to qualify as a room itself. To improve this, we will modify our layout a bit.
This time, only the room in which the player is standing and the corridor is rendered. To apply this to a practical layout, see this picture.
See the corridors ending in an angle. Not only do they block the visleaf but they also juice up the design. One particularly interesting area is the room east of the ct spawn. The corridor ends in a room and the door is located north and is fully blocking the visleafs.

    So the moral of the story is to make well planned maps. Any large, highly detailed open world map in cs won't post good r_speeds because of visleafs. On another note, you can use the the hint texture with the skip texture to manually create a break in visleafs but only as a last resort. I will post more about special textures later.

No comments:

Post a Comment

Post your views here