Friday, January 17, 2020

3D Scanning Workflow - Step #1: Material File Correction

A lot of users make the mistake of believing that the results they achieve from their color 3D scanner or photogrammetry applications a done deal.  It either worked as they hoped or it didn't.

Nothing could be farther from the truth.

There is a LOT that can be done with a capture that may seem unacceptable.  But, to turn that capture into some usable there may be a bit of processing that needs to be applied.  We're going to call this "The 3D Capture Workflow" and it will involve one or more post-processing steps.

While capture devices and software often allow several file types to be created, the most common from which to start is the Alias Wavefront Object or .OBJ file type.  The primary saved file will often have one or more child files, usually .MTL and .JPG (or .PNG).

ALIAS WAVEFRONT OBJECT FILE (.OBJ)


We usually open an .OBJ file in a 3D viewer application.   The result is something like this... a color 3D object that can be rotated or viewed from all sides.


Santa Capture Viewed in Meshlab

But, the .OBJ file is actually a text document that can be opened in any text editor.  It primarily contains all of the "Vertex Position" data which defines the underlying SHAPE of the captured object.  And, it also contains a pointer to the MESH MATERIAL file. Here are the first few lines of our sample .OBJ file.
# File produced by Open Asset Import Library (http://www.assimp.sf.net)
# (assimp v4.1.0)

mtllib SantaTest01.mtl

# 57085 vertex positions
v  -6.74224853515625 52.62289428710938 -80.77588653564453
v  -6.03680419921875 52.62289428710938 -80.8377685546875
v .....
In this case the child material file is called "SantaTest01.mtl".   Let's take a look at that file.

MESH MATERIAL DEFINITION FILE (.MTL)

Like the .OBJ file, the .MTL file is a text file.  It's basic purpose is to point to one or more image files that define the color information that provides the object with a color surface.
# File produced by Open Asset Import Library (http://www.assimp.sf.net)
# (assimp v4.1.0)

newmtl SantaTest01_material
illum 1
map_Kd SantaTest01.jpg
In this case, there is only one child image file that is called "SantaTest01.jpg".  It is this file that we will be focusing on for the first step of our post-processing workflow.

COLOR MESH MAP FILE (.JPG)

What provides the color detail of our 3D object is actually a flat image file.  Before viewing the .JPG, let's revisit our capture from a different angle.

Santa Capture - Back View
While generally this capture would be acceptable, it is not perfect and can be improved with just a little work on our part.   There are two issues.  The first, as pointed out by the blue arrow is that this tin object is highly reflective.  Normally, this could be solved by spraying an anti-glare material on the object.  But, our goal is to work with objects of some historical value and there is no way a museum is ever going to let us spray one of their historic objects even if it means a better capture outcome.  We will simply have to learn how to deal with specular issues some other way.

The other issue, as pointed out by the green arrow, is that is a seam in an area where there is no such seam in the original object.  while not a 'show stopper', if we can learn how to diminish the affect of that seam, we can obtain a better final result.

To understand and fix (or at least improve) both of these issues, let's turn to the Mesh Map file... SantaTest01.jpg.

SantaTest01.jpg Mesh Map File
As is plain to see, the surface of the Santa capture is defined by SIX individual sections within one .JPG file.  It becomes obvious that where two of these overlap there is some discrepancy in the brightness that results in the seam we see.  And, it's also apparent that if we are to reduce the specular issues we need to address several places in this image.  Once these are addressed, we should see an improvement in the final 3D object.

AFFINITY PHOTO / AFFINITY DESIGNER

Any image processing application could be used.  But, I have chosen to use Affinity Photo for this purpose.  The reason for choosing this application is two-fold.  First, it is VERY reasonable in cost... just $49.99.   And, it is amazingly complete is terms of matching the much more expensive Adobe Photoshop.   Secondly, while I am a complete novice at using Affinity Photo, I have found some amazingly easy lessons that should let me get up to speed enough at least well enough to improve this image and, consequently, improve the overall result of the capture.

The Affinity team has create a number of great free tutorials available on their web site and/or YouTube. But, the training potential also extends to 3rd party experts like Ally and Ezra Anderson of Affinity Revolution training company.

AFFINITY REVOLUTION TRAINING COURSES

Affinity Revolution has a number of terrific free training videos on their YouTube channel.  I have seen enough to believe that, using their training, I will be able to become proficient enough to be able to significantly improve any capture.

Yes, I realize revealing my ignorance in product that I intend to rely on not only for myself; but, others, may be more than a bit foolish.  So, let me explain how I came to this place.  While I started out, decades ago, as an Adobe user, I was never really a fan.  When I came upon an image application called PhotoImpact, I immediately adopted it as my goto image processing program.

Unfortunately, Ulead, the original company that produced PhotoImpact went out of business and sold the rights to Corel who has never updated the product and it became simply too buggy in the new operating versions to remain with it.  I have tried many other candidates over the last ten years and none of them were impressive enough to make the switch until I recently found Affinity.

So, it's not as if I am starting from scratch.  I know what has to be done.  I simply have to become familiar with the ways Affinity offers to do it.  And, I am confident enough in the training options available that sooner (I hope) or later I can fix the above image enough to be able to point out how to do so to those wanting to fix their own captures.

The positive thing is that if it turns out to be SOONER, rather than LATER, you should be convinced that Affinity products (either Affinity Photo or Affinity Designer) can do the same for you.  It's a gamble that I find worth taking.  So, I plan on seeing a lot of Ally or Ezra over the next few days.


The other positive I hope that comes from revealing my 'newbie' status with Affinity is that everyone that reads this will understand that at some point in our journey ALL of use are 'newbies' and especially if we have any sense of adventure and/or curiosity in trying to better our lives and find new tools.  The fun is in seeing how fast we can leave our 'newbie' status behind us to become as proficient as we have to be in order to accomplish our goals.

Let the adventure begin!


No comments:

Post a Comment