Ransen Software.

PhotoToMesh Home Page  
Photo To Mesh Home





PhotoToMesh transfer function (V5/V6)

When you go from a grey-scale image to a 3D object you have to "map" the levels of grey in the image to heights in the final mesh. This is sometimes called "creating the heightfield". From the heightfield the mesh (rectangular or cylindrical) is made. For example the dark gray level in the image shown below results in a mesh height of 20% of the max mesh height:

From pixel to heightfield height

The most obvious way to convert from grey levels to mesh heights is to use a linear transfer function, which means that a grey level of 0 is a height level of 0.0 (black) and a grey level of 255 (white) is a the highest point in the mesh. The screenshot above shows the photo to STL linear transfer function.

With a linear transform it also means that a quarter brightness (64/255, roughly dark grey) corresponds to a quarter height. Similarly three quarters brightness (192/255, light grey) corresponds to a three quarters of the mesh height.

You can drag the upper and lower limits left and right to enhance the contrast of the heightfield. To drag place the mouse over one of the vertical lines in the graph area.

Heightfield from pixel settings

Compare the two images in the dialog shown above. The top one is the heightfield before applying the transfer function, the lower one is after applying the transform. By dragging the left hand line to the center you are saying that all greys below 50% should be treated a 0% mesh height. So the image after the transform is much darker than the original one. It also means that there is less variation in the mesh, which might be a good thing, depending on your original image and what you want to do with the mesh.

You can brighten the image (and this increase the amount of mesh which is high) by dragging the righthand bar to the left:

Grayscale to heightfield transform function

In the above case many pixels which are more than about 66% bright give a mesh height of 100%.

One last thing to explain is the Linear and Sinusoid options. If you click on Sinusoid you will get a smoother transition from black to middle grey to white:

Brightening and smoothing a mesh for STL output

That may or may not be pleasing or useful to you!

Help Home Page



(c) Ransen Software 2017