Open Objects

The hangar that we've constructed and painted in the last two chapters has the front doors closed:

Screenshot

What if we want to have the doors open, like in the picture? As we shall see, open objects present extra issues in X-Plane.

First, let's give the open hangar a new name, so that we don't overwrite the closed hangar:

Alpha channel

In addition to specifying the colour of each pixel, the PNG file format that X-Plane uses for textures allows you to specify how transparent each pixel is - from fully transparent to fully opaque. This transparency information is called the "Alpha Channel".

The BMP file format doesn't support transparency. However X-Plane fakes it by rendering any magenta (#FF00FF) pixels that it finds in the texture as fully transparent.

Using transparency

With the doors open, the front of the hangar is quite a complicated shape:

Texture

We could construct this out of three or more rectangles, but that sounds like work. Instead we'll cheat and just make the gap made by the open doors transparent. We can do this by using a version of the texture file that has this area marked as fully transparent in the alpha channel:

Image Replace menu

The hangar now looks like this:

Screenshot

That's not right - the gap is black instead of transparent, even though this area is marked as transparent in the texture file's Alpha channel. Blender and X-Plane have to be told about the Alpha channel:

Texture panel

Blender now correctly shows the door space as transparent:

Screenshot

But wait - what happened to the left hand hangar wall? For efficiency, Blender and X-Plane normally only display one side of each face. This is usually a good thing, since it helps to reduce the work that the OpenGL renderer has to do and so keeps frame rates up. However it's not such a good thing when one is constructing open objects. We could tell Blender and X-Plane to display both sides of the hangar walls (using the Twoside button in the Texture face panel), but we want the inside of the hangar to look different from the outside, like in the picture.

Inward-facing faces

The answer is to add extra faces, and to make them face inwards. We could do this by duplicating every existing face, but that's more detail than we need. So, to keep the number of faces down and frame rates up, we'll add a new cube for the inside of the hangar like this (marked in red) instead:

Hangar sketch

In Blender it can be difficult to edit Meshes that have both inward and outward-facing faces, so we'll add this cube as a new Mesh. First we need to set things up:

Shading menu

We want to add the new cube so that it's centred at the origin:

Screenshot

Blender gives the new Mesh the name "Cube". Lets call it something descriptive, like "Internal":

Now we need to resize the new cube to fit according to our sketch. We'll go back to using Face select mode to do this:

Screenshot
Screenshot
Screenshot
Screenshot

The new cube has outwards-facing faces, just like the faces that make up the outside of the hangar. We can tell this by looking at the light blue "normals" that Blender draws in the middle of each face - they're all pointing outwards:

Screenshot

Whether Blender draws these "normals" and their size is controlled by the Draw Normals and NSize buttons in the Mesh Tools 1 panel:

Mesh Buttons screenshot

We need the faces of the new cube to face inwards:

Screenshot

The light blue "normals" in the middle of each face now point inwards, indicating that the faces are facing inwards:

Screenshot

Finally before we apply textures to the new cube, we should remove hidden faces to keep the number of faces down and keep frame rates up. This time we'll keep the bottom face to use as a concrete floor. But we will get rid of the front face, since this face would only be visible from inside the hangar:

More textures

We need to assign textures to the inside of the hangar. First, we need to set things up for managing textures again:

UV mode
Textured shading

Start by assigning the texture file to all faces of the new cube, and then fix up each face one by one:

UV menu

Now to fix up each face's texture. For each face in the new cube:

Textures

The floor needs an extra step:

Tiles button

In general you should use the Tiles button on all faces that lie horizontally on the ground to prevent artifacts in X-Plane. Don't press this button for other faces. ("Tiles" is not a very descriptive term for what's going on here but it was the only available button in the panel and so got co-opted for this purpose - actually this button tells X-Plane to draw these faces with "polygon offsetting" so that they are raised above taxiways and aprons).

When you're done with all of the faces:

That's it! We've finished the open hangar.

Finished hangar

Now save your work:

Save Over screenshot

Remember that Blender does not automatically save your work when you quit. Always choose File → Save before you quit Blender!