Receipe: Create buildings

  • From photo to 3D object: bring a building to LOTUS.

    1 Take photos

    Abstract:

    • Create overview photo
    • Detail photos of the ground floor
    • If all windows are predominantly covered in the overview photo, try to photograph >=1 window as freely as possible by choosing other perspectives.


    First, a main photo is created so that there is always one image that completely represents the building.


    Here, with the later 3D construction in mind, decisions can already be made as to whether certain parts of the texture can be saved. In the subsequent 3D construction, parts of the texture can be used several times. It is important to remember that the night texture will also use this mapping and patterns will quickly become visible, as the same windows of a floor will always light up in the same way - this is immediately noticeable.


    TLDR: You can use some things several times and thus save yourself work, but you should not overdo it.



    Detailed photos are then taken.


    If the building has a row of shops, it is always advisable to take them from the same side of the street as the building stands. This way you only have bicycles in front of your nose, but usually no street signs, parked cars or people.


    If the building has depressions (like entrances) or raised areas (like shop signs), these must also be photographed explicitly from the side so that they can be textured in the 3D construction afterwards. In the example, this concerns the interior of the entrance (where the letterbox is located).


    If trees cover most of the house, you should try to photograph one or more windows from some perspective with as little undergrowth on them as possible. These can then be used for retouching.



    From the side shot you can then take shop signs and sometimes also textures from the entrance area.

    2 Equalise

    Abstract:

    • the lens distortion as well as the perspective distortion must be calculated out, so that the texture appears as "vertically shot" as possible



    As indicated here, we use the programme PTlens for the first rectification process. The programme is chargeable, but the algorithms for rectification are very strong and also take lens distortions into account. The programme displays a grid with which you can align perpendicular lines (such as vertical columns or horizontal window frames) on the original house, so that in the end everything looks as if it had been taken (almost) exactly straight.



    This process is repeated for all relevant photos.

    3 Align

    Abstract:

    • From the photos, all parts are copied out that are to be used later as a texture in the 3D construction - and these are packed onto a texture.



    Now it makes sense to cut out relevant parts from all the photos. These should then really be exactly straight, so our Image Rectifier comes into play. The algorithm is more trivial than with PTlens, but the tool works pixel-precisely and thus 100% accurately - and if it is operated accurately by humans, precise results are also achieved.


    Most of the time, different exposures, different white balances, etc. result from different shots. For this reason, it is best if contiguous areas are not snipped if possible, if you can avoid it, but remain contiguous. This should already be taken into account when taking the photographs.


    If you have to compose contiguous areas individually, you should make the effort to colour the areas at the latest when retouching - but better when arranging them, i.e. now! - to adjust the colour and brightness of the areas to each other.


    From here on, the work may be called "texture", because it already fulfils all the requirements for a successful mapping in the 3D programme.

    4 Retouching

    Abstract:

    • Remove disturbing rubbish!


    (I am a GIF, click me!)


    Time-consuming, yet extremely worthwhile: retouching. Now everything is removed from the texture that we do not want to see in the later 3D object: People, cars, signs, bicycles, bollards, trees, hedges, customer catchers, displays, umbrellas, awnings.


    Rule of thumb: Everything that has no place in or on the 3D object must be removed.


    But: The texture should not be cleaned up under any circumstances! Cracks, graffiti, impurities, debris, inherent shadows and so on are all part of the subconscious perception of reality - everything else looks too clean and it catches the eye.


    Disturbances under balconies are a particular challenge. Almost invisible to the untrained eye, here colour gradients of ambient shadows under the balconies cloud the façade and make clean retouching almost impossible. The remedy here is a clever photographer who notices such areas while taking the photo and rewards the poor Photoshop user with a clean photo from a different perspective.


    Free protip: If possible, don't always stick the same ready-retouched window over and over again on the façade, because this also immediately catches the eye. House facades are untidy and different in themselves! The more individual sections there are that do not repeat themselves, the much better!

    5 Shine & Night

    Abstract:

    • Create alpha for gloss control
    • Create night texture
    • Create alpha for night texture control


    (finished alpha channel for the gloss)


    Depending on whether the building has many windows, this task goes quickly or slowly. ;) I do it in such a way that I mark all the windows of the building with the selection tool. Attention: Since the windows are not modelled out, it is part of the sense of reality not to let tilted and open windows and doors shine along with the closed windows. Since a compromise would only be to the detriment of performance and hardly achieves any gain, we simply leave such windows (parts) out of the selection.


    Then I fill the entire selected area white, use - in Photoshop - the function "Invert selection" and fill the then selected area (that is: everything else) black.


    This non-coloured information is automatically imported together with the main texture as a so-called alpha channel and then used by LOTUS to control the reflection (or in our jargon "gloss") effects. White reflects 100%, black does not reflect at all. In the case of a house texture, all panes of glass are white, the rest of the facade is black, and diffuse reflections such as brushed aluminium or corrugated glass are coloured grey.


    I work with BMP files without a file-specific alpha channel, which is why I save this alpha texture in the folder of the main texture (above) like this: name_of_the_main_texture_alpha.bmp. By adding _alpha, LOTUS automatically recognises this file and merges it with the main texture during import.


    In the case of DDS files, the alpha texture is saved as a separate channel in the main file.


    (finished night texture)


    Now comes a trick! The night texture is later added to the main texture in LOTUS (simply put). This means that areas that look the same at night as during the day should be added with "nothing" (i.e. 0), because colour brown + 0 remains colour brown. In this case, "nothing" is the colour black.


    Areas that should look different at night are coloured as desired in the night texture.


    The following procedure has proven successful:

    • The gloss alpha you have just created should be its own layer above the main texture in the photo editing programme you trust, so that it can be processed separately from it. The bottom layer is the main texture, the top layer is the gloss alpha.
    • The gloss alpha is now set to "Multiply" in the layer properties. This means that black parts of the alpha remain black and white parts of the alpha now "let through" the main texture below.
    • Next, the main texture is inverted (creating a "negative"). If it is unclear which function in the programme triggers this, simply use the gradation curve of the main texture from Standard: to negative: This has the same effect. This usually immediately gives the eye a feeling of "lighting from within" in all visible windows. Caution: Shop windows of all kinds usually do not tolerate inversion well due to their strong colours and should be left out when inverting.

    Now a new layer is created above the multiplied alpha layer and this is also set to "Multiply". First, I select all the windows in the living area and colour this area on the newly created layer a homely yellow tone or yellow-yellow gradient, which then makes the windows look as if the lights were on inside. Proven colours are all colours in the range of RGB 236/231/188 to 231/207/114 - and as said, best across the building in the now marked area as a colour gradient.


    In this layer, individual windows are also filled black with the colour black so that they no longer glow at night. The background is that it is unrealistic for all (!) windows of a building to light up at the same time. So we choose a few windows at random (rule of thumb: 1/3 of the total number of windows in the living area) that we don't want to light up. By the way, I usually take those whose night texture I already don't like, for example because there was a flower box in front of it or a tilted part of the window had to be left out, and then a few more until I like the maximum illumination at the main lighting time (e.g. in the evening at Christmas).


    This is what the layer belonging to the example house looks like as long as it has not been multiplied:

    And you can see the multiplied final result of this process in the night texture at the beginning of this section of the article.


    Half the work of the night texture is now done. Now there is some more manual work to do:

    • From the main texture, surfaces that were not included in the night texture by selecting the slices for the gloss texture must now be added manually. To do this, search for such surfaces in the main texture, select them and copy them to a separate layer at the top. This usually includes:
    • Open doors of shops, luminous and illuminated house numbers, shop signs, shop headings. In the example it is only the house number:
    • In most cases, a gradation curve should be applied to each snippet brought "up" in this way, and this so or so . This usually makes the texture of the relevant snippet look more "luminous", which is almost always desirable for house numbers and shop signs.


    (finished night alpha)


    Now we would like to influence when which part of the night texture lights up. To do this, we again create an alpha channel or an alpha texture, this time the alpha refers to the night texture, so it will later be called the same as, in this case, the night texture, with the addition _alpha. Accordingly: name_of_the_night_texture_alpha.bmp.


    For this alpha, areas that clearly overhang the areas to be illuminated are coloured in shades of grey. Rule of thumb: What is black in the night texture can be used for painting over in the alpha channel, but does not have to be coloured in. I now draw a few rectangular areas over the windows one after the other and colour them according to the template attached here (at the bottom). Hardly visible to the naked eye, here in the example all areas are coloured differently in grey.


    I select the residential windows from the top two lines of the template texture (as randomly as possible!).


    House numbers and shop signs from the area "all night", hallways mostly from the area "schools", the rest is surely self-explanatory.


    LOTUS now interprets the colours of this alpha to decide at which time of the night in the simulation which part of the night texture is lit and which is not (yet).

    6 Final preparation of the texture

    As a starting point we now have the 4 texture files. The next step is to observe the resolution of a texture given for computer technology. All textures have a size of 2^X * 2^Y pixels, i.e. 32*32 pixels, 512*512 pixels, but rectangular sizes such as 2048*512 pixels or 1024*2048 pixels are also possible. With a bit of thinking, the existing texture files can be "squeezed" to a size with which the least information is lost (always scale down!). For this texture the final size is 1024*2048 pixels. The sometimes distorted proportions can be compensated for later in the UV mapping.


    This step should also not be neglected, otherwise the next higher resolution will be used automatically. This wastes resources unnecessarily.


    Finally, the respective alpha channels are assigned to the main texture and the night texture in a DDS texture. This requires a programme that can write DDS files. Free programmes available for this are Paint.net, the DirectX Texture Tool and the combination of the tool DXTBmp and Gimp. In general, it is necessary that the DDS contains mipmaps and that the compression is DXT5.


    There is no obligation to use DDS textures, a 24-bit BMP texture is just as readable by the LOTUS tools. Especially in house construction, it is more convenient to have only 2 texture files (main/night texture) per house, so that clarity is maintained.

    7 3D construction (Blender)

    Note: I am using Blender 2.79, as there are still export problems with .x3d files with newer versions.

    Abstract:

    • Create foundation
    • Create rough dimensions
    • Highlight details

    The first step in Blender begins with the cube from which the house is carved. For the dimensions of the cube, we recommend using the ruler function of Google Earth Pro. The width and the depth of the house can be read and are the first step to the foundation of the house. It is advisable to create a foundation for each house, I usually take 2 metres height, for objects with a large footprint it can be 3 or 4 metres.


    The dimensions for this house are 19.5 metres long (x-axis), 14.5 metres deep (y-axis):


    Now it's time for altitude, which Streetview helps with quite well. At the bottom right of Streetview, an altitude is indicated to which the mouse pointer is currently pointing. If there is no Streetview for your city, you can calculate the heights using the rule of three and the original image. As a rule, floor heights are between 3 and 4 metres. Now, in the first step, there are many "cross decorations" on the façade, so we go floor by floor, only the top 2 floors can be summarised. With the help of the total height of 20 metres and the values from Streetview, the basic shape of the façade is created by extruding the upper poly in on the Z axis:


    Now the height of the front is cut once, as the right 2/5 of the front protrudes a little forward, and the "cross ornaments" prepared so far are modelled out. For me, the minimum dimension for modelling details is a difference of +-0.2 metres to the front . Buildings that are located at intersections or bus stops should be built more detailed than buildings that you drive past at 50 km/h. In general, the details of buildings are more important than those of the front. In general, details in buildings have the unpleasant taste that they are sometimes very elaborate, but tend to be less noticeable during the simulation. Recessed windows, for example, are only noticeable on closer inspection. Details on the ground floor also have a higher priority than in the attic. With the help of the loop-cut function and the extrude function, the house looks like this:


    Time for the front texture and the first texturing. Create material -> assign texture -> UV editing and equalise the snippets. Not so easy with the somewhat complex façade of this building:


    Now it's time for the details on the ground floor, which we can place correctly using the texture. The two lower floors are cut lengthwise in the middle, the rough cut-out is selected using the inset function and the upper rounding is inserted. The indented house entrances have a ground polygon which should be just above the zero point so that there are no clipping problems with the terrain:


    Further details are either cut into the existing mesh or attached to the façade using new cubes. Now the foundation and the side and rear walls can be textured. If you do not have suitable textures for this, you can use a texture from the OpenLOTUS filebase for generic things such as the roof:


    Last but not least, the roof is extruded from the upper polys. In this case, it is just over 2 metres high for a tapered roof and then a flat roof:


    The object is exported as an x3d file to the appropriate working directory of the container.

    8 Import & configuration

    With correct DXT5-compensated DDS textures for the main texture and the night texture, it goes into the Content Tool. A building is always CAT1, the corresponding category is freely selectable. First we take care of the materials. For the main texture, the following values usually have to be set (less has to be done if the textures have been prepared correctly):


    And for the roof/side texture the following (If no pointed roof is used, the "Use alpha value for snow" remains unchecked):


    A building needs a door in the tab Traffic demand, if the building is used by different things, further parts of the building with corresponding doors can be added. This is important for the later calculation of the passenger volume at stops. For residential buildings, window ornaments are also necessary, perhaps 1/3 to 1/4 of the windows can be equipped with window ornaments.


    The behaviour of snow and the night texture can be tested in the Test Environment tab. Now all that is missing is the button at the bottom right and we are done.

    9 Last but not least

    There are numerous tricks in every step of the process that would go beyond the scope of a tutorial that is easy to read and learn. This tutorial should be enough to get you started, but for everything else, we recommend attending a regular content developer's table, where these tricks are applied, shown and explained!


    No regulars' table planned? Then suggest that we organise one again!