Upload
hoangnhan
View
220
Download
4
Embed Size (px)
Citation preview
AN APPROACH TO PHOTOGRAMMETRY, AGISOFT
PHOTOSCAN AND PREPARING THE MESH FOR A
CG WORKFLOW
A PART OF NCCA INNOVATIONS PROJECT BY THOMAS RICE
1
AN APPROACH TO
PHOTOGRAMMETRY,
AGISOFT PHOTOSCAN
AND PREPARING THE
MESH FOR A CG
WORKFLOW
2
CONTENTS:
1.0 – Introduction
2.0 – Capturing images of your subject
3.0 – Basic rules of taking photos for photogrammetry
4.0 - A technique for shooting
5.0 - How to capture the images
6.0 - Taking the images into Agisoft Photoscan
7.0 - Importing the mesh into Zbrush for cleanup
8.0 - Bibliography
3
1.0 Introduction
This is a guide based on the Innovations project that I undertook at the NCCA Bournemouth University.
It will detail an approach to capturing images for photogrammetry using a single camera in the hope to
raise awareness of the technology to the average CG artist.
I have chosen to use photoscanning software Agisoft Photoscan as it is the best I can obtain at this
point in time, but there are many others available out there some of which are free (Autodesk 123D
catch).
While my methods may not be the best it is one way of tackling the problem and I hope that the reader
of this can develop the techniques to continue the creation of innovation.
4
2.0 Capturing images of your subject
Firstly you should choose an appropriate subject, in general most objects can be photoscanned but
here is a small list of object that I have found to not work.
Fig.1 Reflective object - (S-media-cache-ak0.pinimg.com)
Fig. 2 Glass object - rackcdn.com
5
Fig.3 Shiny and thin geometry
Objects to avoid
Reflective
Shiny
Transparent
Hard to detect thin geometry
The above objects will generate a mesh that will that is either extremely badly detailed or nothing at all
in the case of glass. This is due to the fact that the processing needs to detect points as reference and
if you have reflections on your geometry it will confuse the calculations.
6
3.0 Basic rules of taking photos for photogrammetry
This section is very important to understand in order to achieve the optimal mesh.
Lighting conditions
Shooting outside:
You should avoid environments with strong casting shadows as it interferes with the
feature matching processes.
Ideally shoot on an overcast day or in the shade to try to guarantee even lighting.
Shoot in the morning or afternoon when the sun is not directly above the subject.
Shooting inside
Soft diffuse lighting should be used
Do not use the camera flash
Even lighting from all angles should be used
Do not interfere with the light rays when moving to take photographs
Equipment
Any camera can be used but the higher the quality the sharper the photos.
A fixed lens is recommended, any focal length can work but 50mm is the most favored.
A tripod should be used to avoid camera shake and to account for slow shutter speeds.
Shooting
The object should not move
Photoscan software doesn’t handle repeated backgrounds such as bricks well
Have as much of the object as possible in frame
Take a photo every 5 degrees in the pattern as suggested in fig.3
Use as low as an ISO as possible to ensure the sharpest image
A low aperture will help to focus the software on your target and not the background
Exposure should be set so the object is well exposed and the background under.
Objects that are reflective, shiny, transparent will not work with this process.
7
4.0 A technique for shooting
This technique was developed during experimentation for my project. I’ve found to be most effective for
human scan with a single camera as it takes advantage of how the processing software works.
The plan view describes how you should shoot when capturing an object that is not a room or
landscape. Taking images in a 360 degree curve, you should focus on your subject and try to keep as
much in frame as possible.
The side view describes how you should shoot when capturing a landscape or interior, follow the
outside walls of the location taking images every time there is a 60% overlap.
Fig 3. The recommended shooting angles for indoor and outdoor situations. (ReCap)
Expanding on this technique the below method has been developed to generate the best results from a
scan.
5.0 How to capture the images
1. Make sure that your camera setting are correct so that you can capture the sharpest image
while moving the camera at a constant speed.
2. Using a continuous shoot mode on your camera and aiming at the top of your subject.
3. Continuously take images while moving the camera down the subject until you reach the
bottom.
4. Repeat this method in the pattern suggest in fig.3 until you have a full 360 degree coverage.
5. If you require more detail in specific areas it is then suggested to take a full 360 degree close up
scan of that area.
8
Fig 4. Shooting from top to bottom of the model with continuous shot.
9
Fig 5. Shooting close up images for more detail.
10
Fig 6. Illustration of the new technique for shooting.
The technique developed is relatively simple but very effective for its purpose. Firstly the camera
settings need to be correct to achieve the sharpest picture possible while moving the camera
(continuous shooting). When these settings are correct the photographer should then start at either the
bottom or the top of the model and progressively bring the camera to the opposite position in the y axis
(top/bottom) while capturing images of the subject. This is then to be repeated for a full 360 degrees of
the model making sure there is at least a 60% overlap between photos. Then for areas that need to be
more detailed e.g. the head, take 360 degree images of that area making sure that most of the frame is
taken up by the target.
Using the old method for capturing a full human, you would be sacrificing pixels to make sure that the
whole body was in shot. Anything that is out of focus is useless, so when capturing the whole body in
one shot you risk the chance of part of the body not being sharp enough. With this new technique you
capture sections of the body in high detail which then allows for more accurate processing.
While this technique is very effective you will still get some blurred images so it is recommended to
remove these images from the processing stage.
11
6.0 Taking the images into Agisoft Photoscan
Agisoft photoscan is my software of choice for processing the images, as mentioned before you can
use whatever you choose.
At this point I feel it will be worth explaining a way of masking that will could save you much time if your
images generate good results.
Agisoft Photoscan allows the user to generate a “mask” for each image that informs the software of the
areas that you want to calculate. This is traditionally done by taking each image into a photo editing
software and generating an alpha.
Fig 16. Left is the original image. Right image mask.
This process is lengthy and can be very awkward when the subject is not easily differentiated from the
background. When you have 30+ images this process becomes extremely time consuming there for a
new technique was needed.
A method that sometimes works is the “import mas by model” mask option. My suggested way of using
this is to put your alignment, dense point cloud and mesh setting to their lowest and generate a model.
Then use this model as your mask, Import -> Import Masks -> Import from model.
12
Fig 17. Import options masks generated from simple model (black and white images).
NOTE – please note that you should use the lassoo tool to select any points which you can see
are not your subject and delete them from the calculations to save processing power for
unwanted object and to sharpen your mask.
The above should be done at the start of this process but if you are learning how to use this software
please read the below to familiarize yourself with the processes first.
Generating the mesh
Step 1
Firstly load the images into the software – Workflow -> Add Photos
You will see that your images are loaded at the bottom of the screen.
Step 2
The next step is to align the photos, this is where the software compares all of the images and
calculated the camera location and point location of your subject. To do this go to Workflow -> Align
Photos
13
Step 3
The time this takes will depend on the amount of photos and complexity of your scene. You should now
have a point cloud displayed, use the selection tools underneath the Workflow menu to select any
points that you think are errors or you do not want to be in your scene. By doing this you will save
computation time on wasted elements and it allows a cleaner mesh before its generated. Once you
have selected your points (red points are the selected ones) press the X symbol next to the right of the
selection tools to delete the points.
Step 4
In order to build a mesh you have to build a dense cloud. Go to Workflow -> Build Dense Cloud and
choose the quality you desire.
Step 5
Once your cloud is built then go to Workflow -> Build Mesh to build your mesh from the cloud.
14
Step 6
Finally go to Workflow -> Build Texture to build your texture.
This will give you a mesh that is textured from your photographs, it will undoubtedly need clean up in an
external program. If you want to export the model and texture go to File -> Export model and make
sure that the texture is also selected to export that with the object.
7.0 Importing the mesh into Zbrush for cleanup
Step 1 – Import into Zbrush
Import model into Zbrush
Create a duplicate
Hide duplicate model
We create a duplacite so that we can alter the topology
and poly count of our model for easier sculpting then
reporject our changes at a later time.
15
Step 2 – Dynamesh
Under Geomentry -> Dynamesh. This will retopologise your mesh and delete any points
faces that can cause problems, it is also perfect for filling gaps that could be missing in your
geometry. The dynamesh resolution is up to you but should be high enough to retain most of
the detail.
Step 5 – Cleaning noise and adding back lost detail
Use a combination of a low intensity Smooth and Flatten brush to gently remove the noise on
the model. Other brushes can be used to add detail back to areas that are lacking.
16
Step 6 – Retopologising
At this stage it is wise to retopologise your model in any software package that you see fit.
Export the model from Zbrush.
I prefer to use topogun as you can use your mesh as a guide and draw new lines over to top
of it, this way you do not alter the geometry.
Step 7 – Reprojecting
Import the retopologised model back into Zbrush. Once
you are happy with that model save a morph target of it.
Moph target tab – StoreMT.
Divide your new mesh until it comes close to the amount of
polygons that the original mesh had.
Turn on the visibility of the original mesh then highlight your
new mesh.
Under Subtool – project, click the Project all button to
reproject all of the detail from the original mesh onto the new
mesh.
17
Step 8 – Using the morph target
You will notice that you have lost all of the work you did on the new model and that it has been replaced
by the old.
The trick now is to select the Morph brush and paint in the areas that you corrected earlier.
By storing the morph target of your new mesh it allows you to use the morph brush to paint the new
mesh back, therefore allowing you to keep the detail from the original mesh and correct any errors
present.
Step 9 – Taking the mesh back into Agisoft and creating a texture.
Once you are happy with your new retopologized and detailed mesh it is then time to take it back into
Agisoft Photoscan to reproject your texture.
Export your model from Zbrush.
Open the scene that you generated your model from and click on Tools – Import – Import
Mesh.
The mesh should be in the same position and scale as the original mesh
Finally go to Workflow – Build Texture
This should reproject the texture onto your newly topologized model. The texture will probably need
some clean up too, I recommend that you take it into Photoshop or another dedicated 3D texturing
program to make this as simple as possible.
18
Bibliography
Fig.1 –
S-media-cache-ak0.pinimg.com,. N.p., 2015. Web. 3 Mar. 2015.
Fig.2 -
http://65e226e929a5af0b2a5cb2b05f995fc8916f7d7814d5d83ccb0d.r53.cf3.rackcdn.com/produ
cts/1000/wine-white-wine-glass-set-of-4.jpg
Fig. 3 –
News, Autodesk. 'What Makes Photos Good For Photogrammetry?'. ReCap Product News.
N.p., 2014. Web. 21 Feb. 2015.