The mod you are trying to view has ceased development and consequently been archived. If you are a member of this mod, can demonstrate that it is being actively developed and will be able to keep this profile up to date with the latest news, images, videos and downloads, please contact us with all details and we will consider its re-activation.

Petrograd: an action-thriller first person shooter. Enter the shoes of a Black-Ops Special Agent, investigating the disappearance of a full city's population overnight. An eerie atmosphere and immersive environments are just the beginning, nothing is quite what it seems in this suspenseful experience set in post-USSR Eastern Europe. The purpose of this project was to create a trailer with near triple-A quality, that goal was achieved on Feb 2009, and thus this project has concluded. The studio has since turned pro and continues to produce commercial games. Thanks for you support.

Report RSS Petrograd Mod Level Design (Interior Lighting/Optimization)

In this tutorial, I explain how to use VisAreas and Portals in CryEngine in order to setup lighting for interiors.

Posted by on - Intermediate Mapping/Technical

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!

-Benjamin Thatcher (ben72227)

Post comment Comments
Chrissstrahl
Chrissstrahl - - 411 comments

Hey, that was quick!
Good work! I like it :)

Reply Good karma Bad karma+1 vote
Tokoya
Tokoya - - 503 comments

Great tutorial once again Ben, very descriptive and easy to follow. These really help me and fellow Hammer users understand what level creation is all about outside of Source!

Reply Good karma Bad karma+1 vote
ben72227 Author
ben72227 - - 144 comments

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.

Reply Good karma+1 vote
hushpuppy
hushpuppy - - 761 comments

I kinda liked the first result better...looked a lot moore realistic than that "bloom-tastic" thing

Reply Good karma Bad karma+1 vote
ben72227 Author
ben72227 - - 144 comments

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)).

Reply Good karma+1 vote
chris_sloany
chris_sloany - - 2,830 comments

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!

Reply Good karma Bad karma+1 vote
w1ngzer0
w1ngzer0 - - 18 comments

yay more people giving simple to normal on walkthroughs. love it love it!

Reply Good karma Bad karma+3 votes
ben72227 Author
ben72227 - - 144 comments

Great! I aimed to make it easy to follow, I'm glad you were able to understand it.

Reply Good karma+1 vote
darkenes
darkenes - - 19 comments

thanks for the tut it will help a lot

Reply Good karma Bad karma+1 vote
TheSyndicate
TheSyndicate - - 9 comments

Images have been deleted.

Reply Good karma Bad karma+1 vote
GARYOSAVAN
GARYOSAVAN - - 259 comments

All photos Dead!

Reply Good karma Bad karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: