|
What is Displacement map?
Displacement map is a set of values describing the distance between two meshes. Usually we call them low and high resolution surface but it does not matter what is the mesh resolution. It is possible to extract displacement map between 2 low or 2 high resolution surfaces.
How to render it?
You will need a rendering engine which can read and render meshes with displacement maps. Currently the best option is Renderman, but mental ray or some other renderers are capable of rendering meshes with displacement maps.
What data is stored in the 32 bit map?
A 32 bit map would record the actual distance data (by default in millimeters). A negative value will represent a high resolution surface being under the low resolution surface at a particular area. A positive value describes a high resolution surface resigning above a low resolution surface at a particular area. A value of 0 represent an area where the high resolution and the low resolution surfaces are on top of each other.
Since a 32 bit map can have much larger values than 1 along with large negative values we call this map a high dynamic range map. Our Image Browser is able to display a 32 bit map. To help diagnose the 32 bit displacement map the Image Browser allow us to change the exposure stops using “+”, “-” and “0” hotkeys. Please note, changing the exposure will not effect the saved map. It is purely for display purposes in order to see some areas of the map better. Your rendering engine need to be able to read correctly both the negative and positive values in order to render this map correctly.
What data is stored in the 8 and 16 bit map?
An 8 or 16 bit map will have a normalized version of the 32 bit data values ranging between 0-1. Our extraction solution will first save a temporary 32 bit map and than it will read it back and normalize it. If you would like to render this map correctly than you will tell your rendering engine how much to displace the surface during rendering. This is called “gain” or “height” or used similar wording. How can I find out what your “gain” value is? It is suggested to record this as part of the map name such as name_%g_%f .
%g - minimum value of the displacement map
%f - maximum value of the displacement map
If “Keep Zero As Middle Grey” = OFF than the largest positive value will be equal to 1 and the largest negative value will be equal to 0.
For example if the 32 bit maps min = -2 and max =4 than on the normalozed map 0 will represent -2, 1 will represent +4.
If “Keep Zero As Middle Grey” = ON than 50% gray will represent the area where the low res and the high res mesh is on top of each other and will normalize based on this. For example if the 32 bit maps min = -2 and max =4 than on the normalized map 0 will represent -4, 1 will represent +4, and 0.5 will represent 0 (no displacement). Since the 0-1 value in this example represent something which is 8 times larger (between -4 and +4) than the rendering engine will need to multiply the map value 8 times. You will have to find out where can you set this in your shader.
Please note, the max values will never be larger than the half of the searchDistance since at this distance the map will be clipped. The min value will never be smaller than - searchDistance/2 .
What is a Search Distance?
The extraction code searches up to a specified distance in order to find the high resolution surface. For example if the search distance is 4 than the searched area starts 2 units above the low res surface and ends 2 units below the surface.
What are the “Ray Center” options?
The ray starts a specified distance above the low res surface and start searching toward a specified units under the low res surface. The “Ray Center” option specifies if we will store (bake) the distance when it hits the first found high res surface, the last found high res surface, or the one which has the shortest distance to the low resolution surface
STEPS TO EXTRACT DISPLACEMENT MAP (see attached image) :
Step1.
Create a low resolution mesh.
Step2.
Create or import a high resolution mesh. You can subdivide your low resolution mesh and design/detail it if you wish, but you can even import a scan to use it as a high resolution geometry for extraction. Please note, Mudbox extraction works on arbitrary meshes.
Step3.
The Low resolution and the high resolution surface gets aligned. In our case the subdivision surface of the low resolution mesh need to be closely aligned to the high resolution surface. This is because in this example we choose to extract between two subdivision surfaces an due to this M1 is the subdivided version of the low resolution mesh. Please note, we did not need to subdivide M1 by hand, we just specified in the UI that we would like the low resolution mesh to be treated as a subdivision surface. In this case we will also need to render our low resolution mesh as a subdivision surface otherwise the extracted displacement map will not make sense.
The “Subdivision” options for the low resolution surface are:
Good - will subdivide the low res mesh high enough that the largest face will cover a 64 texel area (64 pixel area in UV space)
High - will subdivide the low res mesh high enough that the largest face will cover a 16 texel area (16 pixel area in UV space)
Highest - will subdivide the low res mesh high enough that the largest face will cover a 4 texel area (4 pixel area in UV space)
Usually a subdivision setting of “Good” is sufficient in order to create a smooth curvature (with no faceting). The higher the map size the lower this setting need to be.
What is happening during the extraction:
a.) Mudbox picks the next pixel in the UV space (P0), and finds the corresponding point on the surface of the mesh (P1).
b.) Looks at the search distance and finds P2. In our example the search distance is 2 units, so P2 will be one units above the low res mesh (subdivided version) along the normal direction. The blue area on the image represents the searced area around the low res mesh. As you see the high resolution surface is always within this volume.
c.) It will shoot a ray opposite the normal direction. The ray ends at P3. The distance between P2 and P3 is equal to the “Search Distance”.
d.) It found the high res surface at P4. It will keep looking if it finds another candidate and than it will use the “Ray Center” setting to determine which data to store.
e.) The distance data will be stored, so the map will have a distance information as a gray level image.
TIPS:
- make sure that your UV shells are proportional to one another. You don’t want to make the “ear” UV shell as large as the full body. When the “Subdivision” option is set than Mudbox will find the largest face in UV space and will subdivide it enough time that the largest subdivided face covers a few pixel area. If you scaled a UV very large than the full mesh will get subdivided to a very high level and most likely the extraction will fail or will take very long time.
- make sure you use the latest version of Mudbox
- the UVs should not go all the way to the edge of the map
- use “good” subdivision option for low and high res mesh rather than using anything above this
- use higher value than 0 for the Search Distance
- try exporting your low and high res mesh as obj file, import it into a new
| Attachment
|
|
|