Creating HOM, portals, and sectors
From Mod Wiki
For this, we will need the X-ray SDK.
To start with: why this is needed
HOM stands for Hierarchical Occlusion Mapping. Simply speaking, this means that HOM can be used to increase performance of complex levels by about 20%.
How HOM works
Not going into too much technical detail, I will explain it simply: anything that is hidden from the player by occlusion, is not processed or rendered, meaning that the system saves resources. This increases performance.
Sectors and portals
Read more about it here: http://en.wikipedia.org/wiki/Portal_rendering. I can only add that in the X-ray engine, geometry is not used for creation of sectors. HOM objects are used instead.
All this allows as to raise performance nearly twofold, and the thankful users with systems that are not top of the lines (they are the majority) will praise you for such a luscious gift. ;)
- This is most relevant for truly complex maps, since not only will it increase performance, but will also allow you to add more interesting geometry to the level.
- The above principles are relevant not only for STALKER, but also for most modern games. For instance, the Source Engine (Half-Life 2 etc) works best with portals and sectors.
Let's get to work
Say, we have a map that needs all the aforementioned things. I will explain how to do this based on a good old cube: give it HOM, place it onto the map, then create portals with sectors.
Start with HOM.
Here is our map with a cube. We need to create HOM for it.
To create HOM, reset the scene, go to the static geometry library, find our cube. It can be found at editor\shadertest_box, or you can use your own.
Now export this cube from the library into the LWO format, to erase all materials. It is this exported object that will serve as the base for HOM. It needs no materials. I call it shadertest_box_occ (OCC for occluder).
Now, import it back, go into the object's settings, field Object type, change it from static to HOM, exit settings, safe changes. We immediately see the cube change. It is now an HOM object.
Now, load our map again. Select mode "objects" at the bottom, press the button "refresh list", so that you see the new object, then add our occluder onto the map as a regular object.
We now only need to adjust the occluder for the cube as presicely as possible to the cube.
That's all! We have successfully created an HOM occluder for an object. You can do the same with all objects on the map, although it is best to create occluders in 3DSMax as sort of simplified versions of objects.
Sectors and portals should be generated after the map is assembled, all objects are in place, occluders are set, etc. That is, just before compiling. They are very easy to make.
Go into the "Sectors" mode and create base portals by pressing the corresponding button. If there are many objects, it is worthwhile to "check for correctness" with the corresponding button. This creates the sectors.
Go into the "Portals" mode and "calculate all portals".
That's it. Occlusion mapping is done, sectors are created, portals for them are calculated. Thank you for your time.