I have been very busy on this project for the past few months. so far I have 2 levels in development, one of which is almost done and is in the polishing stage, the other is still a bit rough around the edges but getting there. I have spent the past couple of weeks of dev time in my second level attempting to get visareas and portals to work properly in a complex structure.
Visareas and portals are in game objects that allow you to adjust lighting in an inside area (such as a house) where the roof and walls block much of the outside light. In a basic scenario, say you have a house with a door and no windows, we would need to draw a visarea around the inside of the house and have a single portal in the doorway to the outside.We can use this to control the lighting inside the house and make it brighter or darker than the outside light. The portal is what allows you to look inside the building from the outside. from the crytek documentation this is how that scenario would look in the engine from a top down view.
To illustrate why this feature is important, see the following image:
you can see the outside lighting and the inside lighting are the same.
The problem comes when you have multiple visareas in the same location adjacent to each other connected by portals, often one visarea connected to the portal works, the other does not.
visareas cannot extend outside of the structure they are created in because of they do they cause graphical glitches such as making a wall or ceiling, or even an entire section of the building invisible, or will appear as a bright white light in game.
This building was especially complicated because the rooms on the lower level are in different positions than on the upper level, and it wasn't possible to just create a visarea on the lower level and scale the height to match the top of the building without the visarea cutting into a room on the upper level, or extending onto the balcony on the side of the building, rendering half of it invisible.
To fix this I had to setup a separate visarea is each room and make sure the visarea in the main hall didn't extend too far to the doorways with the portals connecting them.The stairwell had to have its own visarea and 2 portals, one for upstairs and the other downstairs as well so the whole thing didnt extend through the roof and make the top invisible. When multiple visareas are connected to a portal they must be almost exactly halfway between the edges of the portal.
(the blue balls are AI navigation points)
The main doorways were the hardest part, I would have it working, only to find it wasn't working after saving and reloading the level. but I finally got it going with lots of trial and error adjusting the portal and visarea shapes at the door. Now that I have been able to get this building setup I can replicate this process to other structures throughout the game.
I put lights in the main doorways that trigger when the doors open or get destroyed to give the appearance of illuminating the room with the outside light.