Exercise: Texture a mesh with camera parameters, adjust textures and export
In this exercise, we will use camera parameters in order to do a very accurate texture mapping. There are two kinds of parameters:
External parameters (different for each picture)
Internal parameters (different for each camera)
Open the file and launch the command
Open the file “TextureParam&CameraPath.3dr” saved in the previous exercise.
Check external and internal parameters
Select an image in the treeview, 1029 for instance, and go to the Edit Image: external and internal parameters are already filled because these images come from an existing textured mesh. In most cases, you will have to define these parameters. External parameters can be computed thanks to Estimate Pose. Internal parameters can be computed thanks to Calibrate Camera. The Edit Image dialog box goal is to edit manually these data. Then you can save or load these parameters (excam, incam or xml).
Internal parameters are:
The sensor size and the pixel size
The focal length
General tab
The lens misalignment
Principal point of autocollimation - PPA (offset from the PPS)
Principal point of symmetry - PPS (offset from the CCD center)
Distortion tab
The radial distortion (from k0 to k6)
The tangential distortion (from p1 to p2)
External parameters are:
The camera position
The camera rotations
Learn more: Edit Image
Apply textures
Once all parameters (internal and external) are entered for all textures, show only the mesh MeshToTexture, select it and the three images and go to Standard Texture. Choose to texture Fully visible triangles with Best Projection image choice.
If you observe in detail the result, you should see that some triangles are not textured because they are not visible from any point of view corresponding to the camera positions:
Some parts represent a big surface and can be considered as “normal” zones, in particular on the left part of the picture 1029.
Some parts represent a very small surface (1 or 2 triangles) in the very deep holes of the rock.
You can try other options (At least one visible vertex and Invisible parts) to texture blank areas. Click the Preview button again to see the difference.
Adjust textures
By default, when a triangle can be textured by several pictures, a choice is made according to two parameters:
The distance between the camera position and the triangle.
The angle between the camera orientation and the triangle normal.
However, in some cases, you may want to select manually the texture to apply. To do this, show only the textured mesh, select it and go to Adjust Textures.
Thanks to the dialog box, you can represent the textures by unique colors or visualize them separately to better visualize where each one is mapped on the mesh. You also have tools to display images in the 3D scene.
In the central toolbar, you have selection tools, filters which are applied to the selection and actions which are going to be done on the next selection. For instance, select the texture 1032 (displayed in red in our example):
Display Colors so as to better understand where textures are currently applied,
Select through to select triangles hidden by others from user viewpoint,
Select No Filter to select triangles hidden by others from camera viewpoint,
Choose Update textures to replace previous applied texture,
Draw a rectangle as shown below
The selected area will take the color of the texture 1032.
Then select options Remove Current Texture, and “erase” some triangles on the right. They will become white, means that they will not be textured.
Click OK to validate.
Export a textured mesh
Now that the texture is applied and adjusted, we can export the mesh. You can select it, then go to Export. OBJ, GLB and FBX formats allow the export of textured meshes. Note that some software are not able to handle files with big coordinates, so maybe you will have to translate your mesh near the origin to remove them.