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.
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.
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.
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.
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!
-Benjamin Thatcher (ben72227)