[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ] [ Search: ]

5.8.6 Exporting Portals

This section presents how portals can be created in order to link the different sectors of a virtual environment. Each Blender scene in the file is exported as a Crystal Space sector, and the use of specific meshes allows to define portals between them.

This is made using the ‘Crystal Space Portal’ panel that is found in the ‘Object’ context of the ‘Properties’ window:


Creating portals

In order to define a portal, you must create two meshes that will be the source and the destination of the portal. Each mesh will be in a separate Blender scene so that the portal will lead from the first scene to the second one (this is not a limitation and a portal is allowed to lead to the same sector than the starting one).

You must pay attention to the shape of your source mesh as well as to the order of its vertices. The shape of the mesh will be used as the one of the Crystal Space portal, but one tricky problem is that the order of creation of the vertices will also define its orientation. For a correct behavior, be sure to create the vertices of your source mesh in clockwise order when you look at the portal.

Unless you plan to create another portal to go back in the other direction, the actual shape of the destination mesh has no importance at all, only its position will be important.

Once the two portal meshes are created, select the source mesh, go to the ‘Crystal Space Portal’ panel, and activate the ‘Portal’ checkbox. A drop-down list ‘Destination scene’ appears, you must now select the destination scene of the portal. You can reset the portal configuration by selecting scene ‘NONE’. Once le scene is selected, a second drop-down list ‘Destination object’ and a button ‘Create destination portal’ appear:


The list is composed of all mesh objects belonging to the selected scene. Once its destination mesh is selected, current object will be exported as a portal instead of a mesh. Select ‘NONE’ entry to reset the selection tool.

You must also pay attention to the relative transform of the source and destination meshes since it will define the warping transform that is applied when crossing the portal. If the source and the destination of the portal are the same (i.e. there is no warping transform), then the two meshes should be at the same position.

Commonly, the destination object will be defined as a portal that leads back to the source portal. To do this, select this object, check its ‘Portal’ option in ‘Crystal Space Portal’ panel, then select its destination scene and object. Both objects will be exported as portals instead of meshes.

Automatic creation of destination portal

Last section explains how to manually create two corresponding portals. Here is a tool to automatically generate the destination portal of a mesh.

Unlike preceding method where a corresponding mesh had to be manually created then selected as destination object of a portal and finally configured itself as a portal, all these steps are automatically performed by button 'Create destination portal'.

Once the source mesh is correctly created, select it, check its ‘Portal’ option and select its destination scene. Instead of selecting a destination object, click on the ‘Create destination portal’ button. It will generate an identical mesh of current one (same position and orientation) in the destination scene and configure it as a portal to go back to current scene.

The ‘portaltut’ example file

As an example we will follow the making of the file ‘portaltut.blend’ that can be found in the CS/browser/CSAssets/trunk/blender/ SVN repository.

The example is split in three different scenes that will correspond to three different sectors in Crystal Space: two rooms ‘roomA’ and ‘roomB’, to be linked by a transitional sector ‘Corridor’. The goal of this example will be to create the portals in order to travel from one room to the other.

The walls of the rooms have already been created, and some holes have been dug that have to be replaced by the portals:


Let's do the following steps:


If some of the portals don't look ok while exporting Blender worlds, check that:

If you still have a defective portal after you have checked those points, it is highly probable that the relative transform of the source and destination mesh is causing the problem. A good hint in this case is to move the destination mesh at the same position and orientation than the source mesh in order to get a valid portal with an identity warping transform, then, starting from this configuration, move the destination mesh by small steps in order to visualize the changes.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated using texi2html 1.76.