Introduction
For the game
World Void we needed to port a historical monument to the Unreal Engine 4. My task was to scan the castle. I was expecting financing, which was delayed, so I finally decided to just take it and do everything on my own, without money, and I did it - I scanned the lock! A few months have passed, and I am still delighted! In this article I will tell you how I did it. But first, I want to thank Miloš Lukács, Jeffrey Ian Wilson, and the 3D Scanning User Group, without whom this would have been impossible.


')
What is photogrammetry?
In short, photogrammetry is the process of creating 3D models from several photographs of the same object taken at different angles.
I will not consider a three-dimensional scanning of objects, this topic is already sufficiently covered.
If you want to start mastering photogrammetry, I recommend this short
video of James Candy from YouTube. Although Agisoft Photoscan is mentioned in it, the concepts discussed will work in any other software for photogrammetry. You can also read the
Photogrammetry Guide for the Poor .
In their workflow photogrammetry is used by many artists, it was used for the Kite demo from Epic games, in Star Wars Battlefront and an infinite number of other projects. However, most of these studios scanned stones and trees. Epic games wrote a
post about how resources were created for the open world demo. Employees of the company even wrote a
post about the choice of equipment and
another one describing the process of eliminating lighting. I highly recommend reading these posts if you have not seen them yet.
Difficulties
When scanning such a large object as a lock, one should not forget about the following difficulties:
- Number of shots: the lock is more voluminous than a stone, so even if you need a low-poly model, you will have to take more shots. This means that you need a larger SD card. But having bought a bulk SD card, you will encounter problems with the discharge of the battery, so it would be nice to buy a spare battery. This may seem obvious, but when I started taking more than two thousand shots, for me it turned out to be a revelation. In half of this process, I began to discharge the battery. Fortunately, the guards of the castle allowed me to charge the camera in their office. Having taken pictures, you will have to find enough storage space on your computer, but hard drives are very cheap nowadays.
- More time: it is logical that the more you shoot, the more time is needed. It took me 8 hours to scan the castle, which means you will need 8 hours of cloudy / cloudy weather. It would also be nice to take all the necessary photos of one section of the castle, and only then move on to the next. In this case, if the sunlight shifts a little and the software fails to link all the photos together, you can always connect them manually using control points.
- Computational power: because of the large number of analyzed photos, you will need a lot of computing resources. Computer requirements depend on 3D scanning software, but here's what you need to know:
- RAM. A lot of RAM, 64 GB is an excellent choice. However, some 3d-scanning packages use a caching system that allows processing scans with a small amount of RAM, but I still do not recommend working with less than 32 GB.
- Video processor The faster the better. A lot of video memory is not needed, 4 GB is enough. I would recommend the NVidia GTX card, because some of the software does not support AMD.
- CPU. The more cores, the better.
- Difficult angles of shooting: when scanning a stone, you can take pictures at any angle, and in the huge castle there are hard-to-reach places. If possible, use the drone, but I did not have it, so I had to solve the problem differently, as I will discuss below.
- Complex construction: unlike stone, the castle has more complex forms, not to mention the fact that the stones do not have internal premises. The task becomes even more difficult, you need to make sure that everything you need is removed. How to achieve this? Pre-planning and on-site verification.
Learn your purpose (pre-planning)
I work in the historical monument of Byblos, a city in Lebanon that has been inhabited for more than ten thousand years. However, the castle itself dates back to the 12th century. This is a relatively small castle compared to the newer ones built in some European countries, but each wall of this castle is made of highly detailed masonry, polished by time itself.
By studying the goal, I mean that you need to sketch on paper views from above and from the side, break them into several elements, choose the order of shooting and highlight those areas in which you need to take more pictures.
In addition, errors accumulate during scanning, which leads to the creation of displaced geometry, so you should always make a full set of circular images of the object so that the scans are automatically corrected. Open geometry may not be accurate.
I also took the opportunity and made many shots of the surrounding area from the castle walls, which made it possible to add a landscape to the scan.
Hint: Do not take multiple images at different angles from one point (panoramic images). Most often this leads to undesirable errors.
A useful way to scan small tunnels in which, due to limited space, it is difficult to take pictures from all angles: walk in a straight line, and at each step, take a picture with a forward-looking camera. This technique gives less resolution, but it may be enough.

There is a very high probability that you will miss several angles during scanning and the images will not overlap enough, which will result in areas with low resolution appearing in the scan, so I highly recommend checking the result in place. Reality Capture 3D scanning software, for example, can check the overlap of a huge number of images on a laptop in just a few minutes. This is incredibly useful - it will let you know in which areas more images are needed.

White dots mark the places from which the pictures were taken. Blue dots are manually added survey points to help link some items that the software cannot link automatically. Note that there are a lot of survey points on the roof of the castle, and this is normal, because I didn’t have a drone and I couldn’t take enough roofs. Fortunately, I managed to tie them by hand, which might not be possible for large locks. Total software snapped 4000 photos.
What do you need?
If you are trying to save as much as possible, this is what you need:
- The camera (aha), necessarily a "DSLR" (DSLR). The new smartphones, for example, in the Galaxy S7 are pretty good cameras, but if you earn 3D scanning, then buy a DSLR. I did not have a "SLR", so I borrowed it from my aunt. It was the Nikon d3200, and since I scanned the rock lock, I didn’t need a camera with greater sharpness.
- Lens. Cameras are sold with lenses with a variable focal length (18-55 mm), but it is recommended to use a lens with a fixed focal length. However, if you use the limit value (18 or 55) for the entire scan, then everything should be fine.
- Tripod. Yes, you will need it, especially if you are shooting in low light conditions, for example, inside the castle, and you cannot use the flash, that is, you will take pictures with a long shutter speed.
- Monopod is useful, but if you do not shake hands and selected the desired shutter speed, you can do without it. On the other hand, it costs only 10 dollars, so why not?
- Sd card I used a 64 GB SD card. I had a laptop with me, and if the card were full, I could just transfer the pictures to a hard disk.
What I did not use
- Battery. I did not have it, but if you are going to take a lot of pictures, I recommend buying a second or even a third battery.
- Drone. He can greatly facilitate your work, and if there is such an opportunity, then consider buying it. I did not have a drone, so I had to climb and take pictures from various dangerous points. Fortunately, it worked, but how much do you want to tempt fate, especially in large castles?
- Chrome ball and gray ball. This device is used to obtain perfect color fidelity and a perfect light removal process. It is tempting to use any opportunity to create the perfect scan. But first ask yourself, is it worth it? There are other techniques to eliminate lighting that do not require this device, while providing quite decent results. In my case, this device would add to the project another large layer of complexity that was not worth any possible quality improvement.
- Calibration target Color checker. This is an expensive but useful device for calibrating the camera. I did not use it when scanning.
Software
I tested a bunch of photogrammetric software, and any of the packages listed below adequately deal with small scans, but I needed to process large amounts of data (4000 photos with a resolution of 24 megapixels).
- Agisoft Photoscan. Agisoft is the most popular software in the entertainment industry. It has a friendly interface and amazing quality of finished scans. The standard version costs $ 180, but if you need the option of creating survey points, which can be very useful when creating large scans, you will have to buy a professional version for $ 3,500. At the same time, Agisoft consumes a lot of computing resources, and if you want to process a large amount of data, you will need an incredibly powerful computer. Not to mention that Agisoft is a bit slower than its competitors on this list.
- Pix4d. Because of the specialized set of tools, this software is most common in industry and agriculture. On a powerful computer, it can process large amounts of data, and at the same time a little faster than Agisoft. Subscription to this package costs $ 350 per month. However, I did not really like the quality of the resulting textures.
- Autodesk Recap. This is a cloud software that has a free version and creates good quality scans. Unfortunately, the processing set is limited to 250 photos, and it takes forever to upload large amounts of data to the cloud.
- Reality Capture. A beginner who took the market by storm. This is an incredibly fast software, it can process large amounts of data and is able to work on a regular computer with an NVidia video processor. It can even be run on a laptop, but I do not recommend doing this, unless you have a gaming laptop with good cooling - a strong and long load on the laptop reduces its life. Reality Capture has excellent fast-snap features that allow you to link images on a laptop in seconds. This is a handy tool to check the data set at the location to make sure that there are enough snapshots. Compared to Agisoft, this software scans a bit more noisy. It costs 99 euros for three months, but this version can handle no more than 2500 images. If you need more, you will have to buy the CLI version for 7,500 euros per year. Fortunately for me, when scanning the castle, Reality Capture was in beta status and was free for 60 days. This is more than enough to complete the scan.


Expenses
This is the interesting part. I borrowed the camera, the software was free, but I still needed to process the scan, because my laptop could not cope with it. Here Milosz Lukács helped me, he offered to process the data on his computer, and my gratitude knows no bounds. He also helped me in the data binding process, showed a couple of tricks for correcting some of my mistakes peculiar to beginners. As a result, I only had to spend money on a tripod, monopod and SD card, for a total of $ 70 + shipping. That is, yes, I managed to scan the castle from top to bottom for only $ 70! I proved that with desire, you can find a way. I was lucky, but luck came when I began to communicate and make friends.
Can this be repeated?
Six months before the start of the scan of the castle, I did not know anything about 3D scanning. And although I am tempted to say that I did it alone, it will not be true - they helped me, and in many ways this help was received from the community and industry professionals. How did I manage to find them? Pretty simple - in the Facebook 3D Scanning Users Group. First I joined the group, then I explained what I wanted to do, and I received great support from the community. One of the band members, professional Jeffrey Ian Wilson even wrote to me in a “lichku”, and we had a fruitful conversation. He put me on the right path, realized that I was ready for a complex project and made recommendations. In addition, he advised to treat his recommendations with a certain degree of skepticism. The same applies to my advice: in fact, my experience in 3D scanning is only six months, when I scanned the castle, I made mistakes, fortunately, they were not too serious and I managed to fix them. If I managed to scan the lock, it does not mean that I am the best assistant in scanning locks. I just share my experience, study and try everything yourself. I answer the question in the section heading: yes, you can repeat my “feat”, if you have the determination, then nothing is impossible.
Finally
I sincerely hope that our experience can be useful for readers, and if something interesting comes out of this, email me on Twitter or share on Facebook, I’ll be happy to take a look.
Processing a scan from one billion polygons and porting it into the game engine is another story, worthy of another post.