As you may have noticed in the various other pages, we work a lot within Unity, almost exclusively in fact. And for most of our projects, if we needed an environment, we defaulted to our 360 capture of our own studio space.
We recently decided it would be fun, and a further improvement of our skills if we started capturing some more environments around Philadelphia to use in the future.
The process was pretty neat, and frankly not too difficult to pull off. We decided to use Meshroom from AliceVision to process our Photos and turn them into 3D textured geometry.
My boss Alan had some prior experience with doing photogrammetry, but I haven't yet until this point. I'd seen and bookmarked some tutorials in the past, so I had a decent understanding of the overall process.
I primarily used the Photoscanning video tutorial from Gleb Alexandrov as well as the a guide from Sketchfab to learn the process.
I first did a quick run through, following Gleb's video and the results came out pretty decently.
The process is pretty straight forward, the only troubling part I imagine is getting pictures in the beginning, and then optimizations at the end if building for real-time use.
The Meshroom process itself though is pretty much setup by default, I didn't really mess with any of the settings, except for the Texturing node at the end, and doing some basic editing in Blender after the Meshing node, where I then imported it back in with the Mesh Decimate node.
I brought the .obj model and texture data into Blender, and everything looked pretty good, though quite dense still at 1.3 million triangles.
I then began the process of optimizing, which put simply was duplicating the mesh, and running the decimate modifier on it, knocking the triangle count down to about 1% of it's original, meaning around 13,000 triangles.
I then did a bit more manual editing, namely removing doubles, limited dissolve and so on, and then began the most complicated part of the process, I thought, which was creating a new UV unwrap for this low-poly version that didn't stretch too much. This only difficult due to the some of the crevices that were scanned began to have some really weird geometry, especially after all the decimation, it took a while but I was eventually quite happy with the results.
Here you can see the results, the UVs still have some problem areas, but for the most part, at a 4K final bake, I figure it would look fine.
So that's what I did, using just Blender's baking system, I bake out 4K images for the Diffuse, Ambient Occulsuion, and Normal Map from the high-poly to the low-poly.
I did a few more finishing touches like using the Data Transfer to grab some of the normals from the high-poly, as well as a Weighted Normal modifier to do some final corrections (Note: I have no idea if using the Data Transfer was even necessary, I thought it shaded a bit better when I did, but that would be overided by the Weighted Normal node, and of course, the Normal Map when being rendered so š¤·Ā
The final triangle count still ended up around 12K triangles, which would still be a bit too much for real-time use in a game engine, maybe, but the results speak for themselves I think.
With that out of the way, and feeling confident about the general process and workflow, we decided to step out into an alleyway close to the studio space, and get capturing.
The video from Gleb is a good run through with some handy tips about the entire process, and some steps weren't quite necessary. For example, he recommends using Darkroom to batch process all the photos will color correction and such, but we were able to use our photos as is and dump them straight into Meshroom.
The Meshroom for Beginners also has a handy chart/reference for the best camera settings, that being:
fast shutter speed or tripod to reduce motion blur
reduce the aperture (high f-stop) to have a large depth of field
reduced ISO to minimize noise
I personally used the Canon EOS Rebel T7, but I'll be frank and say I really don't understand cameras too well. Alan adjusted some of the settings for me before I got my hands on it, the only thing I had to do was reduce the exposure a bit as we were shooting outside. We also had the benefit of it being a cloudy and overcast day, so relatively even ambient lighting.
We went to this nearby alley, figuring all the small details and bits would make for an excellent capture, though I was a bit dubious with all the reflective surfaces like the windows and metallic objects.
Between Alan and I, we captured maybe a couple hundred photos of both sides of both facades of the buildings on either side (we also brought in our work-study student Nikki, but we only had 2 cameras on hand so she stood around for moral support).
I personally captured just a bit of the building on the right side, while Alan took the left.
We captured a couple hundred pictures of both sides of the alley, and went through the same process. The results came out surprisingly well I thought, being my first time actually capturing photos myself, and we also didn't need to edit them in Lightroom or Darkroom in any way.
The result isn't the most clean, mainly because we had to separate it up into chunks, and I just tried to overlay them on one another to get a feel for it, but still not the worst ever. It should be possible to edit it up a bit more and get a better final and optimized result, but Alan thought we should just throw it into Unity as is and walk around to get a feel for it.
Happy with the results, we decided to try a different direction, and these models can always be optimized and better edited to look better in the future.
The final result in Unity can be see below:
Pleased with the result, and interested in making a comparison, Alan thought it would be fun to try and re-create the alley again, but in a slightly different way.
So another method of creating a virtualized version of an environment is to take 360 degree spherical capture using a specialized camera, in our case, we use the Insta360 Pro. This image, when stitched together in specialized software can then be displayed, both as an HDRI image if we so please, but also projected onto mesh surfaces as a texture to re-create the environment.
From what I can tell, this method is far better and simple in a way for creating an entire environment, where as photogrammetry seems often better for single subjects, where you want an immense amount of detail. The only drawback is that photogrammetry could be achieved with free software, and just using one's phone camera, where as this 360 Box Modeling technique will require a 360 camera, which can cost thousands of dollars. That said, there are cheaper alternatives, and you may be able to get away with something much less specialized.
Above you can see some of the 360 spherical photos we captured of the same alleyway.
The process for this is pretty simple, and should be possible in most DCC modeling software, as long as they along spherical texture projection. Alan and Nikki prefer to use Maya, but I prefer Blender, and it's pretty much the same in both.
The setup is pretty simple, you want to bring in one of your 360 captures as a texture, and start with a plane.
Assign a new shader to that plane, and assign the 360 texture, use the Object's Texture Coordinates
Assign a Empty or anything you want really to act as the Object's source for controlling the texture coordinates, and you're good to go. The Empty in this case, can be moved, rotated, and even scaled, and will change how the 360 image get's displayed and projected onto the mesh.
Try and align your ground or road to an even direction for simplicity, in this case, the road runs along the Y-axis, and from there we can start creating extrusions, adding more cubes or planes, and roughly blocking out various details and shapes, all use the same shader with projected textures.
Furthermore, we take multiple captures, and if the texture starts getting skewed because it's far away or something, we can use another capture, assign a new shader, and use that on objects or individual faces to try and get the best results.
With this method, depending on the environment and capture, you're going to be getting quite a few errors, stretching or warping in some places, and general visual artifacts, but I find you have much greater detail and control at a broad level, and the capturing process is much more simple.Ā
That said, this can also be quite tricky to work and model with, when your working with multiple captures in a close space, textures are stretching or warping in strange ways you don't expect, it's a bit hard to wrap your head around it, but all in all, it's not too bad.
The results above can also be cleaned up quite a bit, once you have everything in place, group objects together like buildings, small details, ground and so on, and bake the textures out. Once you have textures baked out, and you're not relying on projection, you can turn this simple diffuse map into a PBR material by extracting normals and roughness, you can also go in and fix problem areas manually, and paint out certain problem areas as well.
For example, here you can see the pole has been skewed onto the sidewalk and wall itself due to the way it's captured.
After getting that initial geometry in place, and baking the textures, we can take it into Substance or Photoshop and clone-stamp that pole out of the ground and wall so it looks better.