Disclaimer, this article is not an introduction to photogrammetry, but rather a case study of scanning the Petra Treasury and the challenges that came with. These are my personal process and tools that I wanted to share with you. If you are interested in diving in depth into the topic of photogrammetry, then I would recommend you check out one of my previous articles here.
During my trip to Jordan, I reached out to Princess Sumaya University for Technology to organize a visit and given my experience in scanning archaeological sites in Lebanon, I was asked to give a presentation on the topic. While I can easily give an old presentation that students have probably not seen before, and it would work out fine, I wanted to do better.
Jordan is an archaeological rich country, home of the city of Petra, and I thought it would be interesting if I scanned the iconic Treasury, and used that in my presentation instead of using an old project.
Al-Khazneh (The Treasury) of Petra featured in Indiana Jones and the Last Crusade
That sounded like a cool idea, except for a few things:
I was informed of the topic a week before my trip, which meant that I did not have much time to prepare the presentation
I was attending the Jordan 8th Gaming Summit, which meant I had even less time to prepare the presentation
I was traveling to Amman, and Petra was 3-4 hours away by car in the middle of nowhere, therefore it would take me all day to get to Petra and come back
It takes a lot of time to process a scan, and I don’t a have a pocket server on me
I did not have access to a drone, and the Treasury is a little bit taller than me, therefore it will be challenging to get those top view shots.
In short, preparing, scanning, and presenting in 3 days? challenge accepted!
The organizers of the Gaming Summit had scheduled a trip to Petra for the speakers of the event, which took care of the transportation issue for me, and since I will be visiting with other fellow speakers, I found it the be a great opportunity to both scan and network.
To process the scan I decided to use Reality Capture since it can run on a laptop with a limited amount of RAM as long as it has an Nvidia graphics card. Additionally, It can handle a lot of photos while remaining relatively fast. This tool made perfect sense for this for this specific case, however, for your particular project, you still need to do research to see which is the best solution that suits you.
The presentation consisted of a few steps, the content to explain (slides), the scan, and a demo scene inside of Unreal. Luckily I was not starting from scratch. On Friday, I took a quick look at my previous presentations, and picked the slides that are most relevant, then prepared a quick intro to photogrammetry targeted towards students.
Quickly after, I started researching the Treasury, I only had one shot at scanning it, and the first thing I did was to study the target and its environment. I looked up the treasury on Google and Youtube and searched for references from different angles. Then I saved them for offline use since they might be useful later, especially when I did not know if I will have internet access on site.
I selected a picture of the treasury, and I started visualizing how I would go and take photos of it.
The blue sections are walls that are facing me, and usually are the easiest to scan. The higher sections are further away from the camera, and therefore with the lack of closeup photos they will be generated at a lower resolution, but the quality should still be enough.
The green sections are the poles, and the best way to scan those is by taking a full circle around them.
The purple sections are the floor and the ceiling, and you just need to take inclined pictures while moving.
The red sections are areas that are not visible from ground level, and a top view is needed. This is where a drone can come in handy, but I did not have that privilege.
To solve the top view problem I took a look at the environment.
From these pictures we can deduce a few things:
There are some higher areas that I can get to, and take those high shots
It might be a little tricky to fit the entire treasury in one photo since it was facing a cliff, and therefore there wasn’t enough room to get further away from it
There will be lots of tourist blocking the view
These couple of hours of researching info were enough to confirm that there is a chance scanning the Treasury might actually work. Then I quickly hopped on a plane a headed to Jordan
Arriving at the site, I found out that there are guides that can take you up the cliff to take a selfie with the treasury. Though I was warned by locals that it is illegal to go up there, and plus it was very windy that day, enough for the wind to throw you off the cliff, therefore that idea flew straight out of my head (see what I did there).
The second set back was that the treasury is actually closed and guarded, and you are not allowed to enter it, meaning you can only take photos from a distance. This meant that some areas of the scan will be slightly lower in resolution, and the back of the poles will be occluded.
Great, so limited angles, limited space to take the photos, no top view, and lots of tourist moving around, that was just great!
Tight restrictions meant that I had to make each photo count, and be extra careful not to take blurry one, nor panoramic ones (multiple photos in-place), as those are the most hurtful to your resulting scan.
On the bright sight, it was an overcast day, therefore I didn’t have hard shadows in my photos. (Small win, but I will take it!)
Well now that I have the on-sight photos, I was back on the bus, which coincidentally has a power plug, so I didn’t have to worry about battery life, sweet!
After going over the captured set, and after removing any repetitive or blurry photos, I threw the photos into Reality Capture and hit align. The result was great, 150/150 photos aligned perfectly!
The picture above is a top view of the alignment points of the Treasury generated from the photos. The white points represent the camera position of where I took the photos. Then, I defined the scan bounds since I was mostly interested in the treasury, there was no point in wasting laptop resources on calculating the surroundings.
After building the mesh, I found that RC did a good job of removing the tourists (since they weren’t consistent between photos), and the scan looked great, except for occluded areas (top sections).
Remember those google images and youtube videos I had saved? Well some of them were drone footage (4k FTW!), and all I had to do was to convert the videos to photos, then throw everything into a new project a see what sticks, and it worked! Well kinda, each video generated a few chunks, that I had to manually attach to each other using ground control point.
Since the video footages were taken in different weather conditions, using different cameras, using different lenses, and some of them have been post-processed, I had to manually help RC by identifying 3 points in common with all the chunks (the more spaced the better).
Amazingly that worked as well. I did, however, disable those extra photos from being processed during the texture reconstruction step, and only kept the original set, to maintain color consistency, and avoid artifacts which is a setting you can set for each photo in RC.
Here’s the result
What is even impressive is that I managed to set up the project and process the scan during a 3h bus ride! Then the bus arrived back to Amman, where I had to run to the UE4 meetup; It was a very productive day!
I was set to give the presentation in the morning, and all that was needed was to create a nice environment scene inside of Unreal showing that had the scan nicely blended in. So I went to bed because I like to sleep, and I am more efficient when I am well rested (don’t do burn out kids :)! ) which left me with 2 hours prior to the presentation to finish the project.
First I needed some assets that match the Treasury, so opened the Epic Launcher, and searched the free assets and projects provided by Epic until I came across the Racing Game who has embraced a middle eastern feel.
The next step was to optimize the asset by reducing the polycount, fixing the UVs, and bake a normal map. I didn’t have time to do my conventional workflow, luckily Unreal has a built-in new tool which is the Proxy Geometry Tool. It is worth noting that is tool intention is to create optimized assets to use with Hierarchical LODs for objects in the distance and not made optimize 3D scans. If you are looking to make the most of your scan, you might be better off using the conventional workflow. However this is an automated process that takes a few minutes, and for the purpose of the presentation, it was perfect.
And this is the scene I ended up with
Finally, I gave the presentation, and it was very well received. I definitely enjoyed working on this project, and I am extremely grateful for Dr. Shaidah Jusoh Ibrahim and the Department of Computer Graphics and Animation for hosting me.
If you are interested in a similar topic, you can check out my GDC talk about how I scanned the Byblos Castle in Lebanon on a zero budget. The castle took me 6 months to plan and scan, though of course, it was a more advanced target, and most of that duration was spent on learning photogrammetry and practicing. Though it is nice to see that such a workflow took me less than 3 days from preparation to presentation, thanks to the advancement in the tools, and the access to free resources.