Saturday, October 24, 2015

Faux Photometric Stereo Part I: Intro and Capture system

    Intro

     I have resurrected this old blog so that I may quickly share a process I have cobbled together for making texture maps that produce results that kind-of-but-not-really look like photometric stereo.  This capture and processing method should help with creating more realistic looking material shaders for real-time engines. What this process can do : Capture quality images and provide a solid base to create material shaders. What is cannot do: 100% faithful recreation of the material captured.  Artistic input is still needed to create a material that looks convincing.  Overly shiny/mirrored/clear coat/high gloss materials will require extensive work to look proper in a real-time engine.  Below is a an example of the end result inside of Unreal Engine 4.



     I will have a more in depth guide going over the development of an automated system at a later date. The paper bag texture used for the this guide was captured using a non-automated process, this means that it will be very easy for anyone on a budget to reproduce similar results, but your results may vary.

     I would love to say that the development of this process was all me, but I can't in good faith take credit for other people's hard work when I was smashing their processes together like a child attempting to hammer a square peg through a round hole. So I would like to give credit where credit is due:

Normal Map Photography - Ryan Clark - A great guide to manual normal map generation using light direction.

How To Split Specular And Diffuse In Real Images - John Hable - This guide is more about solving a specular map programmatically, but I am still wobbly when it comes to writing code. This guide inspired me to figure out how to achieve similar results with Photoshop filters.

Paul Debevec and his team at USC ICT Graphics Lab - If you don't know who ICT is, get acquainted.  These people are breaking the uncanny valley. 

Christopher Ellis - You tried your best to instill in me the power of tinkering during our time together at ATVI, but it didn't take hold until long after we parted ways. Thank you.

Now on to the guide!

Supplies used for Capture System

     I used some items that people on a budget may not be able to acquire, I just happen to be lucky enough to work at a place that has these materials just lying around. Below is what I used, but like everything in life, there are many ways to complete a task.

Capturing Needs:

  • DSLR - Anything will work. Better results can be achieved with better equipment.
  • Remote Shutter Release.
  • Framing/tripod - A pile of Alufix was just sitting around the studio.  I used this to create an obstruction free stand for the camera. More on this later.
  • Cutting mat with measurements.
  • Color chart.
  • Circular or Linear Polarizing Filter for Camera.
  • Light Source, preferably one that produces a sharp shadow.
  • Linear Polarizing film for light source(s).
  • Tripod or stand for light.

Setting up Capture System

(Fig.1) The Capture Setup. Blue = Framing. Orange = Camera. 
Yellow = Lights and their positions. Green = Cutting mat with measurements.
Light Blue = Capture Subject. Purple = Color Chart.

Camera Mount

     Unfortunately I never took images of the Alufix fixture made to support the camera, and I have already broken it down and moved onto a more compact design.  The framing was set up in a "T" shape, then legs were mounted to the sides to raise it off the ground to approximately 1 meter.  How high to raise the camera is dictated by how large the item being captured is and the focal distance of the camera lens (calculate depth of field).

Camera Setup

     The lens needs to be equipped with a polarizing filter and the camera should be in manual mode.  Manual mode allows for fine tuning of the images and insures that the lighting is more uniform from image to image. Pay attention to the type of polarizing filter used as it can mess with the camera's sensors.  The light meter is particularly sensitive to linear polarizing filters and will give false readings. If the lens is a variable zoom lens, find the focal length that works for the subject, then tape that ring down so it cannot move. For this process to work all images need to be taken with the same focal length and distance. A remote shutter release will also help prevent the camera from moving around during the capture. Also shooting in a RAW format is recommended as further tweaking can be done after the capture session.

Light Setup

     I built a light from a led strip, and scrap ply board.  It gave off a good amount of light and was extremely cheap to make. I have moved away from using this light because it produces soft shadows and the best light for this system is a spotlight. The sharper the shadows, the more accurate the normal map.
(Fig. 2) LED strip light.

(Fig. 3) LED strip light with polarizing film.

Color Chart

     A color chart will help correct the color of the raw images after the capture.  If only one light source is being used then the chart only needs to be in one photo. If multiple light sources are being used, the chart needs to be in every shot as lights can vary in color and brightness (especially cheaper LEDS).


Capturing the Images

Brief Overview 

     It is necessary to take eight images for this process, four images that lack specular information and four which contain specular information. It is possible that more images of the subject lit from different directions and angles would help create a more complete map, but I haven't gone that far in my testing.  The four non-specular images will help us create our color and normal maps. The four specular images plus the color map will help create a good base for the specular map.  The specular map could also be used as a roughness map (covered in Part II). 

The Capture Process

     The light(s) should be set up equidistant from the subject and arranged left, right, top, and bottom. (Please refer to Fig. 1). The reason for these particular light positions goes back to Ryan Clark's article.  For the paper bag photo set, the light was attached to a tripod.  Since I was using a single light, I would capture an image and then move the light.  A major problem of moving a light by hand is that it is hard to keep the same distance away from the subject in every image. Varying light intensity will effect the end results.

What I captured:

Polarized



Non-Polarized




Thanks for reading! Part II will cover processing the images, and should be released eventually.






No comments: