I've gotten some questions regarding how to create interiors in the CryEngine2 Sandbox editor. This tutorial will explain how to create interiors using VisAreas and Portals. I will also briefly discuss how to setup lighting in interiors. If you have any questions or comments, feel free to post them in the comments section at the bottom of this article.

The first thing we need to look at is how VisAreas work:

Now that we have that out of the way, I'm going to give you a step-by-step example of how to set up a VisArea and add a few Portals. I'll work with a simple 4-sided room with 2 doors. You can get larger versions of the screenshots below by clicking on them.

First, we will need to get both the interior and exterior model of the building:

Here we can see the two models - the interior on the left and the exterior 'shell' on the right.

When we move the exterior model onto the interior model we get this:

As you can see, we have shadows turned on for the models, so the sunlight casts a shadow onto the floor of the building. However, since we do not have interior lighting set up, the entire inside of the building is still receiving sunlight which makes it look unrealistically bright on the inside.

This causes problems when we try to setup an interior light source. As you can see below, the sunlight makes the interior light source barely distinguishable:

In order to remedy this problem, we will add a VisArea. To do that, you'll need to go to the RollupBar and go to Objects>Area>VisArea. Once you have your VisArea selected, you should click "DisplayFilled" so that it's value is true. This will help you align the VisArea better (since VisArea placement has to be precise, just a slight error can cause the area to not render properly). I separated the interior and exterior models again for the time being so that I can place the VisArea around the interior model.

Since I want the sunlight to be able to come through the doors, I also clicked "AffectedBySun" so that it's value is true. Once I have the VisArea setup around the interior, then I need to adjust the height so that the VisArea will not interfere with the exterior model that I'm about to place over it. The building is a little under 3 units high, so I set the VisArea's height to 3 units. It is very important that the VisArea is constrained around the interior model as tightly as possible, so not to interfere with the rendering of the exterior model.

As you can see below, the with the VisArea completely enclosing the interior of the model, none of the exterior light (i.e. sunlight) is being rendered.

Now that we have the interior model enclosed by the VisArea, we need to integrate the exterior model.

Once we have moved the exterior back onto the interior model, we will need to create Portals. These are for areas where we want the outside world to be visible from the interior (and vice-versa); examples include doors, windows, etc. We go again to the Area tab in the RollupBar, except this time we'll select Portal. Once the Portal is selected, you need to place it so that it goes in the doorway, with half of the portal on the interior side of the VisArea, and the other half on the exterior side of the VisArea. As with the VisArea, you will need to adjust the height of the Portal so that it only covers the door/window/etc.

Once that is done, if the Portals are aligned properly, the entire building (exterior and interior) should render instantly.

And with that, your interior area is setup. As you can see below, the VisArea/Portal combination makes the inside lighting look more realistic while adding light bloom effects to the outside light that is coming through the Portals (which helps to add contrast between the bright and dark areas). And since the interior is darker, we are now able to easily distinguish the interior light source that we set up early:

Also, performance will be MUCH better optimized since the interior area is being rendered seperate of the exterior area. This is particularly helpful if you are using multiple light sources; CryEngine2 uses a forward renderer so more lights equals lower performance. Using VisAreas to separate different areas from one another will greatly improve the rendering speeds and framerates during gameplay (particularly when it comes to rendering multiple light sources).

And with that I conclude this tutorial. If you have questions or comments, post them below in the comments section. I prefer that over everyone sending me individual PM's - with comments everyone can see all of the questions and I will only need to provide the answer to them once. Thanks again for the support!

Thanks. I did this in part because I get a lot of comments along the lines of "I didn't think CryEngine could do interiors" and I just want to show that it is in fact possible and not very complex at all.

I think Crytek were trying to simulate that effect you get when your eyes readjust as you go from a dark environment to a very bright one (i.e. Ocular Adaptation). A lot of buildings I don't even bother with using VisAreas, especially if they are something simple like a shack/shed or something similar. I generally use VisAreas for large buildings that would have tons of light sources and need the optimization that comes with a VisArea (such as a warehouse or a building with lots of corridors (i.e. like Doom 3 levels)).

very awesome job! this worked really nice, the only problem, (and this is on my part), is that since i suck at making it around the building properly, if i walk up too close to it, the building disappears. lol. nothing major though, good job! i was hoping it would be a video tutoiral, but this worked just as great!

I'm with deathcaller on this, first thanks for the tut as it is really useful, but the end result is not realistic at all, like others have said the first image is what would happen in reality in a small "house" that have a big open door, light bounce would make it bright. But i can see its benefits in cutting down on light rendering and also to make interior maps like doom3 or quake 4.

Yes, that is why most of the small shacks and village houses in Crysis did not use VisAreas - they are more useful for 'true' interiors, such as the alien spaceship and aircraft carrier levels in Crysis.