14. Defining obstacles with masks
Obstacles of simple geometric shapes such as e.g. the fence on the following picture can be defined using a few surfaces with the background panorama as texture:
Many other obstacles are having complex shapes and are partially even transparent such as e.g. bushes, trees and grasses. Wrap these obstacles with a hull made of a few surfaces:
Since this tree is well afar from the location, two slightly inclined surfaces are sufficient to form a hull. Now select the Masks tab in the Scenery data window:
In order to create a mask for the tree, please proceed as follows:
- Click on the New mask button.
- Click on the Description input box and enter a name for the mask of the tree. It is recommended to include the orientation of the object for which the mask is, i.e. e.g. Tree 176.
- Select the Surfaces tab and assign the new mask as texture source to the hull surfaces of the tree.
- Design all other surfaces to which the new mask needs to be assigned, e.g. around a neighboring tree at the same distance.
- Return to the Masks tab, select the new mask and click on Export mask template.
Now you can find the masks subdirectory with the name of the project file and the extension .AX in the project directory. In this subdirectory you will find the exported mask template as a BMP file, i.e. e.g. Tree 176.bmp. It includes the part of the location panorama which is covered by the mask.
Open up the mask template with an image editing program and create a transparent mask with the help of this program. In the transparent mask, the pixels which belong to the obstacle need to be white, the others need to be black. Gray pixels are semi-transparent whereas the grey value will determine the covering degree of the obstacle later on. Often it is helpful to use the special functions for masking or extracting of such image editing programs. Save the mask as a grey scale BMP file with a color depth of 24 bits. Use the name of the mask template as file name, extended by an underscore. The mask template and the mask may for instance look as follows:
Tree 176.bmp Tree 176_.bmp
Please make sure that the mask template and the mask are always of the same size.
- Return from the image editing program to the RSK and activate the Mask tile 0 window. On a mask tile several masks are positioned in a square range. Drag the new mask to an empty part of the mask tile while holding the left mouse button pressed and make sure that no mask will overlap another one. Generally it is possible to put all masks of a scenery on one single mask tile. If not, create additional mask tiles using the function New mask tile on the Masks tab and assign masks to a certain mask tile number using the Mask tile setting. The finished mask tile 0 of the scenery “Modellflugverein Grosse Heide 73 e.V.” looks as follows:
Each mask tile has an unchangeable resolution of 2048x2048 pixels. In order to be completely visible, it is being displayed reduced by factor 4.
- Test the mask by dragging a model behind the wrapping surfaces using the left mouse button and the mouse wheel and by moving the model around. The obstacle should realistically hide the model or let it show through. If required, touch up the mask with the help of the image editing program.
- Optionally you can create an additional shadow mask for each mask. On pixel level it will define where and how intense shadows can show up. White pixels will allow shadow casting while black pixels never show shadows. Save the shadow mask also as a grey scale BMP file with a color depth of 24 bits. Use the name of the mask template extended by two underscores as the file name for a shadow mask.
- If the wrapping surfaces of a mask are covering the wrapping surfaces of another mask, the rear mask has to be listed above the front mask. Use the buttons to back or to front in order to sort the masks according to the correct depth position.
The grey values of a mask do not only control the visual hiding effect of the model and its casted shadows, it enables the aircraft to fly through the black or dark areas of the mask without any collisions.
Following topic: Creating flow fields